8 The name **afb-daemon** stands for *Application
9 Framework Binder Daemon*. That is why afb-daemon
10 is also named ***the binder***.
12 **Afb-daemon** is in charge to bind one instance of
13 an application to the AGL framework and AGL system.
15 On the following figure, you can use a typical use
18 <a id="binder-fig-basis"><h4>Figure: binder afb-daemon, basis</h4></a>
20 ![binder-basis][binder-basis]
22 The application and its companion binder run in secured and isolated
23 environment set for them. Applications are intended to access to AGL
24 system through the binder.
26 The binder afb-daemon serves multiple purposes:
28 1. It acts as a gateway for the application to access the system;
30 2. It acts as an HTTP server for serving files to HTML5 applications;
32 3. It allows HTML5 applications to have native extensions subject
33 to security enforcement for accessing hardware ressources or
34 for speeding parts of algorithm.
36 Use cases of the binder afb-daemon
37 ----------------------------------
39 This section tries to give a better understanding of the binder
40 usage through several use cases.
42 ### Remotely running application
44 One of the most interesting aspect of using the binder afb-daemon
45 is the ability to run applications remotely. This feature is
46 possible because the binder afb-daemon implements native web
49 So the [figure binder, basis](#binder-fig-basis) would become
50 when the application is run remotely:
52 <a id="binder-fig-remote"><h4>Figure: binder afb-daemon and remotely running application</h4></a>
55 ### Adding native features to HTML5/QML applications
57 Applications can provide with their packaged delivery a binding.
58 That binding will be instantiated for each application instance.
59 The methods of the binding will be accessible by applications and
60 will be executed within the security context.
62 ### Offering services to the system
64 It is possible to run the binder afb-daemon as a daemon that provides the
67 This will be used for:
69 1. offering common APIs
71 2. provide application's services (services provided as application)
73 In that case, the figure showing the whole aspects is
75 <a id="binder-fig-remote"><h4>Figure: binder afb-daemon for services</h4></a>
77 ![afb-for-services][afb-for-services]
79 For this case, the binder afb-daemon takes care to attribute one single session
80 context to each client instance. It allows bindings to store and retrieve data
81 associated to each of its client.
83 The bindings of the binder afb-daemon
84 ------------------------------------
86 The binder can instantiate bindings. The primary use of bindings
87 is to add native methods that can be accessed by applications
88 written with any language through web technologies ala JSON RPC.
90 This simple idea is declined to serves multiple purposes:
92 1. add native feature to applications
94 2. add common API available by any applications
96 3. provide customers services
98 A specific document explains how to write an afb-daemon binder binding:
99 [HOWTO WRITE a BINDING for AFB-DAEMON](afb-binding-writing.html)
102 Launching the binder afb-daemon
103 -------------------------------
105 The launch options for binder **afb-daemon** are:
109 Prints help with available options
113 Display version and copyright
117 Increases the verbosity, can be repeated
121 HTTP listening TCP port [default 1234]
125 HTTP Root Directory [default $AFBDIR or else $HOME/.AFB]
129 Angular Base Root URL [default /opa]
131 This is used for any application of kind OPA (one page application).
132 When set, any missing document whose url has the form /opa/zzz
133 is translated to /opa/#!zzz
137 HTML Root API URL [default /api]
139 The bindings are available within that url.
143 Maps a path located anywhere in the file system to the
144 a subdirectory. The syntax for mapping a PATH to the
145 subdirectory NAME is: --alias=/NAME:PATH.
147 Example: --alias=/icons:/usr/share/icons maps the
148 content of /usr/share/icons within the subpath /icons.
150 This option can be repeated.
154 binding API timeout in seconds [default 20]
156 Defines how many seconds maximum a method is allowed to run.
161 Client Session Timeout in seconds [default 3600]
165 Client cache end of live [default 100000 that is 27,7 hours]
169 Sessions file path [default rootdir/sessions]
173 Maximum count of simultaneous sessions [default 10]
177 Load bindings from given paths separated by colons
178 as for dir1:dir2:binding1.so:... [default = $libdir/afb]
180 You can mix path to directories and to bindings.
181 The sub-directories of the given directories are searched
184 The bindings are the files terminated by '.so' (the extension
185 so denotes shared object) that contain the public entry symbol.
189 Load the binding of given path.
193 Initial Secret token to authenticate.
195 If not set, no client can authenticate.
197 If set to the empty string, then any initial token is accepted.
201 Set the mode: either local, remote or global.
203 The mode indicate if the application is run locally on the host
204 or remotely through network.
208 Set the #fd to signal when ready
210 If set, the binder afb-daemon will write "READY=1\n" on the file
211 descriptor whose number if given (/proc/self/fd/xxx).
215 Transparent binding to a binder afb-daemon service through dbus.
217 It creates an API of name xxxx that is implemented remotely
218 and queried via DBUS.
222 Provides a binder afb-daemon service through dbus.
224 The name xxxx must be the name of an API defined by a binding.
225 This API is exported through DBUS.
229 Get all in foreground mode (default)
233 Get all in background mode
236 Future development of afb-daemon
237 --------------------------------
239 - The binder afb-daemon would launch the applications directly.
241 - The current setting of mode (local/remote/global) might be reworked to a
242 mechanism for querying configuration variables.
244 - Implements "one-shot" initial token. It means that after its first
245 authenticated use, the initial token is removed and no client can connect
248 - Creates some intrinsic APIs.
250 - Make the service connection using WebSocket not DBUS.
252 - Management of targeted events.
256 - Integration of the protocol JSON-RPC for the websockets.
258 [binder-basis]: pictures/AFB_overview.svg (Binder AFB daemon basis)
259 [afb-for-services]: pictures/AFB_for_services.svg (Binder AFB daemon for services)