Improves the documentation
[src/app-framework-binder.git] / doc / afb-overview.md
1 Overview of AFB-DAEMON
2 ======================
3     version: 1
4     Date:    30 mai 2016
5     Author:  José Bollo
6
7 TABLE-OF-CONTENT-HERE
8
9 Roles of afb-daemon
10 -------------------
11
12 The name **afb-daemon** stands for *Application
13 Framework Binder Daemon*. That is why afb-daemon
14 is also named ***the binder***.
15
16 **Afb-daemon** is in charge to bind one instance of
17 an application to the AGL framework and AGL system.
18
19 On the following figure, you can use a typical use
20 of afb-daemon:
21
22 <a id="binder-fig-basis"><h4>Figure: binder afb-daemon, basis</h4></a>
23
24         . . . . . . . . . . . . . . . . . . . . . . . . . .
25         .        Isolated security context                .
26         .                                                 .
27         .        +------------------------------+         .
28         .        |                              |         .
29         .        |    A P P L I C A T I O N     |         .
30         .        |                              |         .
31         .        +--------------+---------------+         .
32         .                       |                         .
33         .                       |                         .
34         .   +-------------------+----------------------+  .
35         .   |                            :             |  .
36         .   |        b i n d e r         :             |  .
37         .   |    A F B - D A E M O N     :   PLUGINS   |  .
38         .   |                            :             |  .
39         .   +-------------------+----------------------+  .
40         .                       |                         .
41         . . . . . . . . . . . . | . . . . . . . . . . . . .
42                                 |
43                                 v
44                            AGL SYSTEM
45
46 The application and its companion binder run in secured and isolated
47 environment set for them. Applications are intended to access to AGL
48 system through the binder.
49
50 The binder afb-daemon serves multiple purposes:
51
52 1. It acts as a gateway for the application to access the system;
53
54 2. It acts as an HTTP server for serving files to HTML5 applications;
55
56 3. It allows HTML5 applications to have native extensions subject
57 to security enforcement for accessing hardware ressources or
58 for speeding parts of algorithm.
59
60 Use cases of the binder afb-daemon
61 ----------------------------------
62
63 This section tries to give a better understanding of the binder
64 usage through several use cases.
65
66 ### Remotely running application
67
68 One of the most interresting aspect of using the binder afb-daemon
69 is the ability to run applications remotely. This feature is
70 possible because the binder afb-daemon implements native web
71 protocols.
72
73 So the [figure binder, basis](#binder-fig-1) would become
74 when the application is run remotely:
75
76 <a id="binder-fig-remote"><h4>Figure: binder afb-daemon and remotely running application</h4></a>
77
78                      +------------------------------+
79                      |                              |
80                      |    A P P L I C A T I O N     |
81                      |                              |
82                      +--------------+---------------+
83                                     |
84                                ~ ~ ~ ~ ~ ~
85                               :  NETWORK  :
86                                ~ ~ ~ ~ ~ ~
87                                     |
88         . . . . . . . . . . . . . . | . . . . . . . . . . . . . .
89         . Isolated security         |                           .
90         .   context                 |                           .
91         .                           |                           .
92         .     . . . . . . . . . . . . . . . . . . . . . . . .   .
93         .     .                                             .   .
94         .     .               F I R E W A L L               .   .
95         .     .                                             .   .
96         .     . . . . . . . . . . . . . . . . . . . . . . . .   .
97         .                           |                           .
98         .       +-------------------+----------------------+    .
99         .       |                            :             |    .
100         .       |    A F B - D A E M O N     :   PLUGINS   |    .
101         .       |                            :             |    .
102         .       +-------------------+----------------------+    .
103         .                           |                           .
104         . . . . . . . . . . . . . . | . . . . . . . . . . . . . .
105                                     |
106                                     v
107                                AGL SYSTEM
108
109 ### Adding native features to HTML5/QML applications
110
111 Applications can provide with their packaged delivery a plugin.
112 That plugin will be instanciated for each application instance.
113 The methods of the plugin will be accessible by applications and
114 will be excuted within the security context.
115
116 ### Offering services to the system
117
118 It is possible to run the binder afb-daemon as a daemon that provides the
119 API of its plugins.
120
121 This will be used for:
122
123 1. offering common APIs
124
125 2. provide application's services (services provided as application)
126
127 In that case, the figure showing the whole aspects is
128
129 <a id="binder-fig-remote"><h4>Figure: binder afb-daemon for services</h4></a>
130
131         . . . . . . . . . . . . . . . . . . . . . . 
132         .  Isolated security context application  . 
133         .                                         . 
134         .    +------------------------------+     . 
135         .    |                              |     . 
136         .    |    A P P L I C A T I O N     |     . 
137         .    |                              |     . 
138         .    +--------------+---------------+     .     . . . . . . . . . . . . . . . . . . . . . .
139         .                   |                     .     .        Isolated security context A      .
140         .                   |                     .     .                                         .
141         . +-----------------+------------------+  .     . +------------------------------------+  .
142         . |                        :           |  .     . |                        :           |  .
143         . |      b i n d e r       :           |  .     . |      b i n d e r       :  service  |  .
144         . |  A F B - D A E M O N   :  PLUGINS  |  .     . |  A F B - D A E M O N   :  PLUGINS  |  .
145         . |                        :           |  .     . |                        :     A     |  .
146         . +-----------------+------------------+  .     . +-----------------+------------------+  .
147         .                   |                     .     .                   |                     .
148         . . . . . . . . . . | . . . . . . . . . . .     . . . . . . . . . . | . . . . . . . . . . .
149                             |                                               |
150                             v                                               v
151                  ================================================================================
152                                              D - B U S   &   C Y N A R A
153                  ================================================================================
154                             ^                                               ^
155                             |                                               |
156         . . . . . . . . . . | . . . . . . . . . . .     . . . . . . . . . . | . . . . . . . . . . .
157         .                   |                     .     .                   |                     .
158         . +-----------------+------------------+  .     . +-----------------+------------------+  .
159         . |                        :           |  .     . |                        :           |  .
160         . |      b i n d e r       :  service  |  .     . |      b i n d e r       :  service  |  .
161         . |  A F B - D A E M O N   :  PLUGINS  |  .     . |  A F B - D A E M O N   :  PLUGINS  |  .
162         . |                        :     B     |  .     . |                        :     C     |  .
163         . +------------------------------------+  .     . +------------------------------------+  .
164         .                                         .     .                                         .
165         .        Isolated security context B      .     .        Isolated security context C      .
166         . . . . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . . . . .
167
168
169 The plugins of the binder afb-daemon
170 ------------------------------------
171
172 The binder can instanciate plugins. The primary use of plugins
173 is to add native methods that can be accessed by applications
174 written with any language through web technologies ala JSON RPC.
175
176 This simple idea is declined to serves multiple purposes:
177
178 1. add native feature to applications
179
180 2. add common API available by any applications
181
182 3. provide customers services
183
184 A specific document shows