3 <link rel="stylesheet" type="text/css" href="doc.css">
7 <a name="Overview.of.AFB-DAEMON"></a>
8 <h1>Overview of AFB-DAEMON</h1>
16 <li><a href="#Overview.of.AFB-DAEMON">Overview of AFB-DAEMON</a>
18 <li><a href="#Roles.of.afb-daemon">Roles of afb-daemon</a></li>
19 <li><a href="#Use.cases.of.the.binder.afb-daemon">Use cases of the binder afb-daemon</a>
21 <li><a href="#Remotely.running.application">Remotely running application</a></li>
22 <li><a href="#Adding.native.features.to.HTML5.QML.applications">Adding native features to HTML5/QML applications</a></li>
23 <li><a href="#Offering.services.to.the.system">Offering services to the system</a></li>
26 <li><a href="#The.plugins.of.the.binder.afb-daemon">The plugins of the binder afb-daemon</a></li>
27 <li><a href="#Launching.the.binder.afb-daemon">Launching the binder afb-daemon</a></li>
28 <li><a href="#Future.development.of.afb-daemon">Future development of afb-daemon</a></li>
33 <a name="Roles.of.afb-daemon"></a>
34 <h2>Roles of afb-daemon</h2>
36 <p>The name <strong>afb-daemon</strong> stands for <em>Application
37 Framework Binder Daemon</em>. That is why afb-daemon
38 is also named <strong><em>the binder</em></strong>.</p>
40 <p><strong>Afb-daemon</strong> is in charge to bind one instance of
41 an application to the AGL framework and AGL system.</p>
43 <p>On the following figure, you can use a typical use
46 <p><a id="binder-fig-basis"><h4>Figure: binder afb-daemon, basis</h4></a></p>
48 <pre><code>. . . . . . . . . . . . . . . . . . . . . . . . . .
49 . Isolated security context .
51 . +------------------------------+ .
53 . | A P P L I C A T I O N | .
55 . +--------------+---------------+ .
58 . +-------------------+----------------------+ .
61 . | A F B - D A E M O N : PLUGINS | .
63 . +-------------------+----------------------+ .
65 . . . . . . . . . . . . | . . . . . . . . . . . . .
71 <p>The application and its companion binder run in secured and isolated
72 environment set for them. Applications are intended to access to AGL
73 system through the binder.</p>
75 <p>The binder afb-daemon serves multiple purposes:</p>
78 <li><p>It acts as a gateway for the application to access the system;</p></li>
79 <li><p>It acts as an HTTP server for serving files to HTML5 applications;</p></li>
80 <li><p>It allows HTML5 applications to have native extensions subject
81 to security enforcement for accessing hardware ressources or
82 for speeding parts of algorithm.</p></li>
86 <a name="Use.cases.of.the.binder.afb-daemon"></a>
87 <h2>Use cases of the binder afb-daemon</h2>
89 <p>This section tries to give a better understanding of the binder
90 usage through several use cases.</p>
92 <a name="Remotely.running.application"></a>
93 <h3>Remotely running application</h3>
95 <p>One of the most interresting aspect of using the binder afb-daemon
96 is the ability to run applications remotely. This feature is
97 possible because the binder afb-daemon implements native web
100 <p>So the <a href="#binder-fig-1">figure binder, basis</a> would become
101 when the application is run remotely:</p>
103 <p><a id="binder-fig-remote"><h4>Figure: binder afb-daemon and remotely running application</h4></a></p>
105 <pre><code> +------------------------------+
107 | A P P L I C A T I O N |
109 +--------------+---------------+
115 . . . . . . . . . . . . . . | . . . . . . . . . . . . . .
116 . Isolated security | .
119 . . . . . . . . . . . . . . . . . . . . . . . . . .
121 . . F I R E W A L L . .
123 . . . . . . . . . . . . . . . . . . . . . . . . . .
125 . +-------------------+----------------------+ .
127 . | A F B - D A E M O N : PLUGINS | .
129 . +-------------------+----------------------+ .
131 . . . . . . . . . . . . . . | . . . . . . . . . . . . . .
137 <a name="Adding.native.features.to.HTML5.QML.applications"></a>
138 <h3>Adding native features to HTML5/QML applications</h3>
140 <p>Applications can provide with their packaged delivery a plugin.
141 That plugin will be instanciated for each application instance.
142 The methods of the plugin will be accessible by applications and
143 will be excuted within the security context.</p>
145 <a name="Offering.services.to.the.system"></a>
146 <h3>Offering services to the system</h3>
148 <p>It is possible to run the binder afb-daemon as a daemon that provides the
149 API of its plugins.</p>
151 <p>This will be used for:</p>
154 <li><p>offering common APIs</p></li>
155 <li><p>provide application’s services (services provided as application)</p></li>
159 <p>In that case, the figure showing the whole aspects is</p>
161 <p><a id="binder-fig-remote"><h4>Figure: binder afb-daemon for services</h4></a></p>
163 <pre><code>. . . . . . . . . . . . . . . . . . . . . .
164 . Isolated security context application .
166 . +------------------------------+ .
168 . | A P P L I C A T I O N | .
170 . +--------------+---------------+ . . . . . . . . . . . . . . . . . . . . . . .
171 . | . . Isolated security context A .
173 . +-----------------+------------------+ . . +------------------------------------+ .
175 . | b i n d e r : | . . | b i n d e r : service | .
176 . | A F B - D A E M O N : PLUGINS | . . | A F B - D A E M O N : PLUGINS | .
177 . | : | . . | : A | .
178 . +-----------------+------------------+ . . +-----------------+------------------+ .
180 . . . . . . . . . . | . . . . . . . . . . . . . . . . . . . . . | . . . . . . . . . . .
183 ================================================================================
184 D - B U S & C Y N A R A
185 ================================================================================
188 . . . . . . . . . . | . . . . . . . . . . . . . . . . . . . . . | . . . . . . . . . . .
190 . +-----------------+------------------+ . . +-----------------+------------------+ .
192 . | b i n d e r : service | . . | b i n d e r : service | .
193 . | A F B - D A E M O N : PLUGINS | . . | A F B - D A E M O N : PLUGINS | .
194 . | : B | . . | : C | .
195 . +------------------------------------+ . . +------------------------------------+ .
197 . Isolated security context B . . Isolated security context C .
198 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
201 <p>For this case, the binder afb-daemon takes care to attribute one single session
202 context to each client instance. It allows plugins to store and retrieve data
203 associated to each of its client.</p>
205 <a name="The.plugins.of.the.binder.afb-daemon"></a>
206 <h2>The plugins of the binder afb-daemon</h2>
208 <p>The binder can instanciate plugins. The primary use of plugins
209 is to add native methods that can be accessed by applications
210 written with any language through web technologies ala JSON RPC.</p>
212 <p>This simple idea is declined to serves multiple purposes:</p>
215 <li><p>add native feature to applications</p></li>
216 <li><p>add common API available by any applications</p></li>
217 <li><p>provide customers services</p></li>
221 <p>A specific document explains how to write an afb-daemon binder plugin:
222 <a href="afb-plugin-writing.html">HOWTO WRITE a PLUGIN for AFB-DAEMON</a></p>
224 <a name="Launching.the.binder.afb-daemon"></a>
225 <h2>Launching the binder afb-daemon</h2>
227 <p>The launch options for binder <strong>afb-daemon</strong> are:</p>
231 Prints help with available options
235 Display version and copyright
239 Increases the verbosity, can be repeated
243 HTTP listening TCP port [default 1234]
247 HTTP Root Directory [default $AFBDIR or else $HOME/.AFB]
251 Angular Base Root URL [default /opa]
253 This is used for any application of kind OPA (one page application).
254 When set, any missing document whose url has the form /opa/zzz
255 is translated to /opa/#!zzz
259 HTML Root API URL [default /api]
261 The plugins are available within that url.
265 Maps a path located anywhere in the file system to the
266 a subdirectory. The syntax for mapping a PATH to the
267 subdirectory NAME is: --alias=/NAME:PATH.
269 Example: --alias=/icons:/usr/share/icons maps the
270 content of /usr/share/icons within the subpath /icons.
272 This option can be repeated.
276 Plugin API timeout in seconds [default 20]
278 Defines how many seconds maximum a method is allowed to run.
283 Client Session Timeout in seconds [default 3600]
287 Client cache end of live [default 100000 that is 27,7 hours]
291 Sessions file path [default rootdir/sessions]
295 Maximum count of simultaneous sessions [default 10]
299 Load Plugins from given paths separated by colons
300 as for dir1:dir2:plugin1.so:... [default = $libdir/afb]
302 You can mix path to directories and to plugins.
303 The sub-directories of the given directories are searched
306 The plugins are the files terminated by '.so' (the extension
307 so denotes shared object) that contain the public entry symbol.
311 Load the plugin of given path.
315 Initial Secret token to authenticate.
317 If not set, no client can authenticate.
319 If set to the empty string, then any initial token is accepted.
323 Set the mode: either local, remote or global.
325 The mode indicate if the application is run locally on the host
326 or remotely through network.
330 Set the #fd to signal when ready
332 If set, the binder afb-daemon will write "READY=1\n" on the file
333 descriptor whose number if given (/proc/self/fd/xxx).
337 Transparent binding to a binder afb-daemon service through dbus.
339 It creates an API of name xxxx that is implemented remotely
340 and queried via DBUS.
344 Provides a binder afb-daemon service through dbus.
346 The name xxxx must be the name of an API defined by a plugin.
347 This API is exported through DBUS.
351 Get all in foreground mode (default)
355 Get all in background mode
358 <a name="Future.development.of.afb-daemon"></a>
359 <h2>Future development of afb-daemon</h2>
362 <li><p>The binder afb-daemon would launch the applications directly.</p></li>
363 <li><p>The current setting of mode (local/remote/global) might be reworked to a
364 mechanism for querying configuration variables.</p></li>
365 <li><p>Implements “one-shot” initial token. It means that after its first
366 authenticated use, the initial token is removed and no client can connect
368 <li><p>Creates some intrinsic APIs.</p></li>
369 <li><p>Make the service connection using WebSocket not DBUS.</p></li>
370 <li><p>Management of targetted events.</p></li>
371 <li><p>Securisation of LOA.</p></li>
372 <li><p>Integration of the protocol JSON-RPC for the websockets.</p></li>