summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-06-23 20:34:57 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-06-23 20:42:57 +0200
commit7059e59cddc1c81321639875636e88895bc14309 (patch)
tree2e857745ae2dd18814bdfe2d6e3806151a51a43e /doc
parentef908d903929988ad01f9df94415fc9c3ddebcac (diff)
vocabulary: moving from 'plugin' to 'binding'
Change-Id: Ic9e118df2bede1fefbb591f8ae7887266b7324ca Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'doc')
-rw-r--r--doc/FAQ.html2
-rw-r--r--doc/afb-application-writing.html2
-rw-r--r--doc/afb-bindings-overview.html (renamed from doc/afb-plugins-overview.html)54
-rw-r--r--doc/afb-bindings-overview.md (renamed from doc/afb-plugins-overview.md)40
-rw-r--r--doc/afb-bindings-writing.html (renamed from doc/afb-plugin-writing.html)314
-rw-r--r--doc/afb-bindings-writing.md (renamed from doc/afb-plugin-writing.md)352
-rw-r--r--doc/afb-daemon-vocabulary.html14
-rw-r--r--doc/afb-daemon-vocabulary.md16
-rw-r--r--doc/afb-overview.html42
-rw-r--r--doc/afb-overview.md44
-rw-r--r--doc/afb-tests-overview.html6
-rw-r--r--doc/afb-tests-overview.md4
12 files changed, 448 insertions, 442 deletions
diff --git a/doc/FAQ.html b/doc/FAQ.html
index 0cad0b5b..e5f64273 100644
--- a/doc/FAQ.html
+++ b/doc/FAQ.html
@@ -16,7 +16,7 @@
<header>
<h1 class="title">Frequently Asked Question about AFB-DAEMON</h1>
<h2 class="author">José Bollo</h2>
-<h3 class="date">27 mai 2016</h3>
+<h3 class="date">10 juin 2016</h3>
</header>
<nav id="TOC">
<ul>
diff --git a/doc/afb-application-writing.html b/doc/afb-application-writing.html
index 1f1fcc1c..ad1911df 100644
--- a/doc/afb-application-writing.html
+++ b/doc/afb-application-writing.html
@@ -37,7 +37,7 @@ code > span.er { color: #ff0000; font-weight: bold; }
<h1 class="title">HOWTO WRITE an APPLICATION above AGL FRAMEWORK</h1>
<h2 class="author">José Bollo</h2>
<h2 class="author">Fulup Ar Foll</h2>
-<h3 class="date">09 juin 2016</h3>
+<h3 class="date">10 juin 2016</h3>
</header>
<nav id="TOC">
<ul>
diff --git a/doc/afb-plugins-overview.html b/doc/afb-bindings-overview.html
index 291b7f79..b731aff2 100644
--- a/doc/afb-plugins-overview.html
+++ b/doc/afb-bindings-overview.html
@@ -4,9 +4,8 @@
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
- <meta name="author" content="Manuel Bachmann">
<meta name="author" content="José Bollo">
- <title>Overview of plugins shipped with AFB-Daemon</title>
+ <title>Overview of bindings shipped with AFB-Daemon</title>
<style type="text/css">code{white-space: pre;}</style>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
@@ -15,16 +14,15 @@
</head>
<body>
<header>
-<h1 class="title">Overview of plugins shipped with AFB-Daemon</h1>
-<h2 class="author">Manuel Bachmann</h2>
+<h1 class="title">Overview of bindings shipped with AFB-Daemon</h1>
<h2 class="author">José Bollo</h2>
-<h3 class="date">09 juin 2016</h3>
+<h3 class="date">23 juin 2016</h3>
</header>
<nav id="TOC">
<ul>
-<li><a href="#overview-of-plugins-shipped-with-afb-daemon">Overview of plugins shipped with AFB-Daemon</a><ul>
-<li><a href="#list-of-plugins">List of plugins</a></li>
-<li><a href="#detail-of-plugins">Detail of plugins</a><ul>
+<li><a href="#overview-of-bindings-shipped-with-afb-daemon">Overview of bindings shipped with AFB-Daemon</a><ul>
+<li><a href="#list-of-bindings">List of bindings</a></li>
+<li><a href="#detail-of-bindings">Detail of bindings</a><ul>
<li><a href="#hello-world">Hello World</a></li>
<li><a href="#authentication">Authentication</a></li>
<li><a href="#tic-tac-toe">Tic Tac Toe</a></li>
@@ -35,12 +33,12 @@
</ul></li>
</ul>
</nav>
-<h1 id="overview-of-plugins-shipped-with-afb-daemon">Overview of plugins shipped with AFB-Daemon</h1>
+<h1 id="overview-of-bindings-shipped-with-afb-daemon">Overview of bindings shipped with AFB-Daemon</h1>
<pre><code>Version: 1
Date: 09 juin 2016
Author: Manuel Bachmann</code></pre>
-<h2 id="list-of-plugins">List of plugins</h2>
-<p>Here are the plugins shipped in the source tree:</p>
+<h2 id="list-of-bindings">List of bindings</h2>
+<p>Here are the bindings shipped in the source tree:</p>
<ul>
<li>Hello World</li>
<li>Authentication</li>
@@ -49,11 +47,11 @@ Author: Manuel Bachmann</code></pre>
<li>Radio <em>(1 backend: RTLSDR RTL2832U)</em></li>
<li>Media <em>(1 backend: Rygel UPnP)</em></li>
</ul>
-<p>All plugins may not be built, depending on the development libraries present on the system at build time.</p>
-<h2 id="detail-of-plugins">Detail of plugins</h2>
+<p>All bindings may not be built, depending on the development libraries present on the system at build time.</p>
+<h2 id="detail-of-bindings">Detail of bindings</h2>
<h3 id="hello-world">Hello World</h3>
-<p>A sample Hello World plugin for demonstration and learning purposes.</p>
-<p>This plugin provides a few unauthenticated requests, all beginning with &quot;ping&quot;, to demonstrate basic binder capabilities.</p>
+<p>A sample Hello World binding for demonstration and learning purposes.</p>
+<p>This binding provides a few unauthenticated requests, all beginning with &quot;ping&quot;, to demonstrate basic binder capabilities.</p>
<p><strong>Verbs</strong>:</p>
<ul>
<li><em>ping:</em> returns a success response</li>
@@ -65,8 +63,8 @@ Author: Manuel Bachmann</code></pre>
</ul>
<p><br /></p>
<h3 id="authentication">Authentication</h3>
-<p>An sample Authentication plugin for demonstration purposes.</p>
-<p>This plugin provides a few requests to demonstrate the binder's token-based security mechanism.</p>
+<p>An sample Authentication binding for demonstration purposes.</p>
+<p>This binding provides a few requests to demonstrate the binder's token-based security mechanism.</p>
<p>Calling &quot;<em>connect</em>&quot; with a security token will initiate a session, calling &quot;<em>refresh</em>&quot; will issue a new token and invalidate the previous one, calling &quot;<em>logout</em>&quot; will invalidate all tokens and close the session.</p>
<p><strong>Verbs</strong>:</p>
<ul>
@@ -78,8 +76,8 @@ Author: Manuel Bachmann</code></pre>
</ul>
<p><br /></p>
<h3 id="tic-tac-toe">Tic Tac Toe</h3>
-<p>A sample Tic Tac Toe game plugin.</p>
-<p>This plugin provides an interactive Tic Tac Toe game where the binder returns the grid as a JSON response.</p>
+<p>A sample Tic Tac Toe game binding.</p>
+<p>This binding provides an interactive Tic Tac Toe game where the binder returns the grid as a JSON response.</p>
<p><strong>Verbs</strong>:</p>
<ul>
<li><em>new:</em> starts a new game</li>
@@ -93,12 +91,12 @@ Author: Manuel Bachmann</code></pre>
</ul>
<p><br /></p>
<h3 id="audio">Audio</h3>
-<p>A sample Audio plugin with 2 backends:</p>
+<p>A sample Audio binding with 2 backends:</p>
<ul>
<li>ALSA (mandatory)</li>
<li>PulseAudio (optional)</li>
</ul>
-<p>This plugin is able to initialize a specific soundcard, define volume levels, channels (mono/stereo...), mute sound, and play a 22,050 Hz PCM stream.</p>
+<p>This binding is able to initialize a specific soundcard, define volume levels, channels (mono/stereo...), mute sound, and play a 22,050 Hz PCM stream.</p>
<p><strong>Verbs</strong>:</p>
<ul>
<li><em>ping:</em> returns a success response</li>
@@ -109,15 +107,15 @@ Author: Manuel Bachmann</code></pre>
<li><em>play</em>: gets or sets the playing status (on-off)</li>
</ul>
<p><em>(if PulseAudio development libraries are not found at build time, only ALSA will be available)</em></p>
-<p><em>(if a PulseAudio server is not found at runtime, the plugin will dynamically fall back to ALSA)</em></p>
+<p><em>(if a PulseAudio server is not found at runtime, the binding will dynamically fall back to ALSA)</em></p>
<p><em>(a specifc backend can be forced by using this syntax before running afb-daemon : <strong>$ export AFB_AUDIO_OUTPUT=Alsa</strong>)</em></p>
<p><br /></p>
<h3 id="radio">Radio</h3>
-<p>A sample AM/FM Radio plugin with 1 backend:</p>
+<p>A sample AM/FM Radio binding with 1 backend:</p>
<ul>
<li>RTLSDR - Realtek RTL2832U dongles (mandatory)</li>
</ul>
-<p>This plugin is able to initialize specific RTL2832U dongles, switch between AM/FM modes, define frequency, mute sound, and play sound (if combining with the <strong>audio</strong> plugin).</p>
+<p>This binding is able to initialize specific RTL2832U dongles, switch between AM/FM modes, define frequency, mute sound, and play sound (if combining with the <strong>audio</strong> binding).</p>
<p><strong>Verbs</strong>:</p>
<ul>
<li><em>ping:</em> returns a success response</li>
@@ -128,14 +126,14 @@ Author: Manuel Bachmann</code></pre>
<li><em>mute</em>: sets device mute status (on-off)</li>
<li><em>play</em>: sets device playing status (on-off)</li>
</ul>
-<p><em>(if rtlsdr development libraries are not found at build time, this plugin will not be built)</em></p>
+<p><em>(if rtlsdr development libraries are not found at build time, this binding will not be built)</em></p>
<p><br /></p>
<h3 id="media">Media</h3>
-<p>A sample Media Server plugin with 1 backend:</p>
+<p>A sample Media Server binding with 1 backend:</p>
<ul>
<li>Rygel</li>
</ul>
-<p>This plugin is able to detect a local Rygel UPnP media server, list audio files, select an audio file for playback, play/pause/seek in this file, upload an audio file to the server.</p>
+<p>This binding is able to detect a local Rygel UPnP media server, list audio files, select an audio file for playback, play/pause/seek in this file, upload an audio file to the server.</p>
<p><strong>Verbs</strong>:</p>
<ul>
<li><em>ping:</em> returns a success response</li>
@@ -148,7 +146,7 @@ Author: Manuel Bachmann</code></pre>
<li><em>seek:</em> seeks in the currently selected audio file, in seconds</li>
<li><em>upload:</em> uploads an audio file, with a POST request</li>
</ul>
-<p><em>(if GUPnP/GSSDP development libraries are not fund at build time, this plugin will not be built)</em></p>
+<p><em>(if GUPnP/GSSDP development libraries are not fund at build time, this binding will not be built)</em></p>
<p><br /></p>
<hr />
<p><br /></p>
diff --git a/doc/afb-plugins-overview.md b/doc/afb-bindings-overview.md
index dfbe6010..03650cd4 100644
--- a/doc/afb-plugins-overview.md
+++ b/doc/afb-bindings-overview.md
@@ -1,14 +1,14 @@
-Overview of plugins shipped with AFB-Daemon
+Overview of bindings shipped with AFB-Daemon
===========================================
Version: 1
Date: 09 juin 2016
Author: Manuel Bachmann
-List of plugins
+List of bindings
---------------
-Here are the plugins shipped in the source tree:
+Here are the bindings shipped in the source tree:
* Hello World
* Authentication
@@ -17,17 +17,17 @@ Here are the plugins shipped in the source tree:
* Radio _(1 backend: RTLSDR RTL2832U)_
* Media _(1 backend: Rygel UPnP)_
-All plugins may not be built, depending on the development libraries present on the system at build time.
+All bindings may not be built, depending on the development libraries present on the system at build time.
-Detail of plugins
+Detail of bindings
-----------------
### Hello World
-A sample Hello World plugin for demonstration and learning purposes.
+A sample Hello World binding for demonstration and learning purposes.
-This plugin provides a few unauthenticated requests, all beginning with "ping", to demonstrate basic binder capabilities.
+This binding provides a few unauthenticated requests, all beginning with "ping", to demonstrate basic binder capabilities.
**Verbs**:
@@ -43,9 +43,9 @@ This plugin provides a few unauthenticated requests, all beginning with "ping",
### Authentication
-An sample Authentication plugin for demonstration purposes.
+An sample Authentication binding for demonstration purposes.
-This plugin provides a few requests to demonstrate the binder's token-based security mechanism.
+This binding provides a few requests to demonstrate the binder's token-based security mechanism.
Calling "_connect_" with a security token will initiate a session, calling "_refresh_" will issue a new token and invalidate the previous one, calling "_logout_" will invalidate all tokens and close the session.
@@ -62,9 +62,9 @@ Calling "_connect_" with a security token will initiate a session, calling "_ref
### Tic Tac Toe
-A sample Tic Tac Toe game plugin.
+A sample Tic Tac Toe game binding.
-This plugin provides an interactive Tic Tac Toe game where the binder returns the grid as a JSON response.
+This binding provides an interactive Tic Tac Toe game where the binder returns the grid as a JSON response.
**Verbs**:
@@ -82,12 +82,12 @@ This plugin provides an interactive Tic Tac Toe game where the binder returns th
### Audio
-A sample Audio plugin with 2 backends:
+A sample Audio binding with 2 backends:
* ALSA (mandatory)
* PulseAudio (optional)
-This plugin is able to initialize a specific soundcard, define volume levels, channels (mono/stereo...), mute sound, and play a 22,050 Hz PCM stream.
+This binding is able to initialize a specific soundcard, define volume levels, channels (mono/stereo...), mute sound, and play a 22,050 Hz PCM stream.
**Verbs**:
@@ -100,7 +100,7 @@ This plugin is able to initialize a specific soundcard, define volume levels, ch
_(if PulseAudio development libraries are not found at build time, only ALSA will be available)_
-_(if a PulseAudio server is not found at runtime, the plugin will dynamically fall back to ALSA)_
+_(if a PulseAudio server is not found at runtime, the binding will dynamically fall back to ALSA)_
_(a specifc backend can be forced by using this syntax before running afb-daemon : **$ export AFB_AUDIO_OUTPUT=Alsa**)_
@@ -109,11 +109,11 @@ _(a specifc backend can be forced by using this syntax before running afb-daemon
### Radio
-A sample AM/FM Radio plugin with 1 backend:
+A sample AM/FM Radio binding with 1 backend:
* RTLSDR - Realtek RTL2832U dongles (mandatory)
-This plugin is able to initialize specific RTL2832U dongles, switch between AM/FM modes, define frequency, mute sound, and play sound (if combining with the **audio** plugin).
+This binding is able to initialize specific RTL2832U dongles, switch between AM/FM modes, define frequency, mute sound, and play sound (if combining with the **audio** binding).
**Verbs**:
@@ -125,18 +125,18 @@ This plugin is able to initialize specific RTL2832U dongles, switch between AM/F
* _mute_: sets device mute status (on-off)
* _play_: sets device playing status (on-off)
-_(if rtlsdr development libraries are not found at build time, this plugin will not be built)_
+_(if rtlsdr development libraries are not found at build time, this binding will not be built)_
<br />
### Media
-A sample Media Server plugin with 1 backend:
+A sample Media Server binding with 1 backend:
* Rygel
-This plugin is able to detect a local Rygel UPnP media server, list audio files, select an audio file for playback, play/pause/seek in this file, upload an audio file to the server.
+This binding is able to detect a local Rygel UPnP media server, list audio files, select an audio file for playback, play/pause/seek in this file, upload an audio file to the server.
**Verbs**:
@@ -150,7 +150,7 @@ This plugin is able to detect a local Rygel UPnP media server, list audio files,
* _seek:_ seeks in the currently selected audio file, in seconds
* _upload:_ uploads an audio file, with a POST request
-_(if GUPnP/GSSDP development libraries are not fund at build time, this plugin will not be built)_
+_(if GUPnP/GSSDP development libraries are not fund at build time, this binding will not be built)_
<br />
diff --git a/doc/afb-plugin-writing.html b/doc/afb-bindings-writing.html
index 6c866fb6..8017e190 100644
--- a/doc/afb-plugin-writing.html
+++ b/doc/afb-bindings-writing.html
@@ -5,8 +5,7 @@
<meta name="generator" content="pandoc">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="author" content="José Bollo">
- <meta name="author" content="Fulup Ar Foll">
- <title>HOWTO WRITE a PLUGIN for AFB-DAEMON</title>
+ <title>HOWTO WRITE a BINDING for AFB-DAEMON</title>
<style type="text/css">code{white-space: pre;}</style>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
@@ -34,25 +33,24 @@ code > span.er { color: #ff0000; font-weight: bold; }
</head>
<body>
<header>
-<h1 class="title">HOWTO WRITE a PLUGIN for AFB-DAEMON</h1>
+<h1 class="title">HOWTO WRITE a BINDING for AFB-DAEMON</h1>
<h2 class="author">José Bollo</h2>
-<h2 class="author">Fulup Ar Foll</h2>
-<h3 class="date">09 juin 2016</h3>
+<h3 class="date">23 juin 2016</h3>
</header>
<nav id="TOC">
<ul>
-<li><a href="#howto-write-a-plugin-for-afb-daemon">HOWTO WRITE a PLUGIN for AFB-DAEMON</a><ul>
+<li><a href="#howto-write-a-binding-for-afb-daemon">HOWTO WRITE a BINDING for AFB-DAEMON</a><ul>
<li><a href="#summary">Summary</a><ul>
-<li><a href="#nature-of-a-plugin">Nature of a plugin</a></li>
-<li><a href="#class-of-plugins">Class of plugins</a></li>
-<li><a href="#live-cycle-of-plugins-within-afb-daemon">Live cycle of plugins within afb-daemon</a></li>
-<li><a href="#plugin-contend">Plugin Contend</a></li>
+<li><a href="#nature-of-a-binding">Nature of a binding</a></li>
+<li><a href="#class-of-bindings">Class of bindings</a></li>
+<li><a href="#live-cycle-of-bindings-within-afb-daemon">Live cycle of bindings within afb-daemon</a></li>
+<li><a href="#binding-contend">Binding Contend</a></li>
</ul></li>
<li><a href="#the-tic-tac-toe-example">The Tic-Tac-Toe example</a></li>
<li><a href="#dependencies-when-compiling">Dependencies when compiling</a></li>
<li><a href="#header-files-to-include">Header files to include</a></li>
<li><a href="#choosing-names">Choosing names</a><ul>
-<li><a href="#names-for-api-plugin">Names for API (plugin)</a></li>
+<li><a href="#names-for-api-binding">Names for API (binding)</a></li>
<li><a href="#names-for-methods">Names for methods</a></li>
<li><a href="#names-for-arguments">Names for arguments</a></li>
<li><a href="#forging-names-widely-available">Forging names widely available</a></li>
@@ -67,7 +65,7 @@ code > span.er { color: #ff0000; font-weight: bold; }
<li><a href="#arguments-for-received-files">Arguments for received files</a></li>
<li><a href="#arguments-as-a-json-object">Arguments as a JSON object</a></li>
</ul></li>
-<li><a href="#initialisation-of-the-plugin-and-declaration-of-methods">Initialisation of the plugin and declaration of methods</a></li>
+<li><a href="#initialisation-of-the-binding-and-declaration-of-methods">Initialisation of the binding and declaration of methods</a></li>
<li><a href="#sending-messages-to-the-log-system">Sending messages to the log system</a><ul>
<li><a href="#verbs-for-logging-messages">Verbs for logging messages</a></li>
<li><a href="#managing-verbosity">Managing verbosity</a></li>
@@ -75,72 +73,72 @@ code > span.er { color: #ff0000; font-weight: bold; }
</ul></li>
<li><a href="#sending-events">Sending events</a></li>
<li><a href="#writing-an-asynchronous-method-implementation">Writing an asynchronous method implementation</a></li>
-<li><a href="#how-to-build-a-plugin">How to build a plugin</a><ul>
+<li><a href="#how-to-build-a-binding">How to build a binding</a><ul>
<li><a href="#example-for-cmake-meta-build-system">Example for cmake meta build system</a></li>
-<li><a href="#exporting-the-function-pluginafbv1register">Exporting the function pluginAfbV1Register</a></li>
+<li><a href="#exporting-the-function-afbbindingv1register">Exporting the function afbBindingV1Register</a></li>
<li><a href="#building-within-yocto">Building within yocto</a></li>
</ul></li>
</ul></li>
</ul>
</nav>
-<h1 id="howto-write-a-plugin-for-afb-daemon">HOWTO WRITE a PLUGIN for AFB-DAEMON</h1>
+<h1 id="howto-write-a-binding-for-afb-daemon">HOWTO WRITE a BINDING for AFB-DAEMON</h1>
<pre><code>version: 1
Date: 09 juin 2016
Author: José Bollo</code></pre>
<h2 id="summary">Summary</h2>
<p>Afb-daemon binders serve files through HTTP protocol and offers to developers the capability to expose application API methods through HTTP or WebSocket protocol.</p>
-<p>Binder plugins are used to add API to afb-daemon. This part describes how to write a plugin for afb-daemon.</p>
+<p>Binder bindings are used to add API to afb-daemon. This part describes how to write a binding for afb-daemon.</p>
<p>Excepting this summary, this document target developers.</p>
-<p>Before moving further through an example, here after a short overview of binder plugins fundamentals.</p>
-<h3 id="nature-of-a-plugin">Nature of a plugin</h3>
-<p>A plugin is an independent piece of software. A plugin is self contain and exposes application logic as sharable library. A plugin is intended to be dynamically loaded by afb-daemon to expose application API.</p>
-<p>Technically, a binder plugin does not reference and is not linked with any afb-daemon library.</p>
-<h3 id="class-of-plugins">Class of plugins</h3>
-<p>Application binder supports two kinds of plugins: application plugins and service plugins. Technically both class of plugin are equivalent are use the same coding convention. Only sharing mode and security context diverge.</p>
-<h4 id="application-plugins">Application-plugins</h4>
-<p>Application-plugins implements the glue in between application's UI and services. Every AGL application has a corresponding binder that typically activates one or many plugins to interface the application logic with lower platform services. When an application is started by the AGL application framework, a dedicate binder is started that loads/activates application plugin(s). API expose by application-plugin are executed within corresponding application security context.</p>
-<p>Application plugins generally handle a unique context for a unique client. As the application framework start a dedicated instance of afb_daemon for each AGL application, if a given plugin is used within multiple application each of those application get a new and private instance of eventually &quot;shared&quot; plugin.</p>
-<h4 id="service-plugins">Service-plugins</h4>
-<p>Service-plugins enable API activation within corresponding service security context and not within calling application context. Service-plugins are intended to run as a unique instance. Service-plugins can be shared in between multiple clients.</p>
-<p>Service-plugins can either be stateless or manage client context. When managing context each client get a private context.</p>
+<p>Before moving further through an example, here after a short overview of binder bindings fundamentals.</p>
+<h3 id="nature-of-a-binding">Nature of a binding</h3>
+<p>A binding is an independent piece of software. A binding is self contain and exposes application logic as sharable library. A binding is intended to be dynamically loaded by afb-daemon to expose application API.</p>
+<p>Technically, a binder binding does not reference and is not linked with any afb-daemon library.</p>
+<h3 id="class-of-bindings">Class of bindings</h3>
+<p>Application binder supports two kinds of bindings: application bindings and service bindings. Technically both class of binding are equivalent are use the same coding convention. Only sharing mode and security context diverge.</p>
+<h4 id="application-bindings">Application-bindings</h4>
+<p>Application-bindings implements the glue in between application's UI and services. Every AGL application has a corresponding binder that typically activates one or many bindings to interface the application logic with lower platform services. When an application is started by the AGL application framework, a dedicate binder is started that loads/activates application binding(s). API expose by application-binding are executed within corresponding application security context.</p>
+<p>Application bindings generally handle a unique context for a unique client. As the application framework start a dedicated instance of afb_daemon for each AGL application, if a given binding is used within multiple application each of those application get a new and private instance of eventually &quot;shared&quot; binding.</p>
+<h4 id="service-bindings">Service-bindings</h4>
+<p>Service-bindings enable API activation within corresponding service security context and not within calling application context. Service-bindings are intended to run as a unique instance. Service-bindings can be shared in between multiple clients.</p>
+<p>Service-bindings can either be stateless or manage client context. When managing context each client get a private context.</p>
<p>Sharing may either be global to the platform (ie: GPS service) or dedicated to a given user (ie: user preferences)</p>
-<h3 id="live-cycle-of-plugins-within-afb-daemon">Live cycle of plugins within afb-daemon</h3>
-<p>Application and service plugins are loaded and activated each time a new afb-daemon is started.</p>
-<p>At launch time, every loaded plugin initialise itself. If a single plugin initialisation fail corresponding instance of afb-daemon self aborts.</p>
-<p>Conversely, when a plugin initialisation succeeds, it should register its unique name as well as the list of verbs attached to the methods it exposes.</p>
-<p>When initialised, on request from application clients to the right API/verb, plugin methods are activated by the afb-daemon attached to the application or service.</p>
-<p>At exit time, no special action is enforced by afb-daemon. When a specific actions is required at afb-daemon stop, developers should use 'atexit/on_exit' during plugin initialisation sequence to register a custom exit function.</p>
-<h3 id="plugin-contend">Plugin Contend</h3>
-<p>Afb-daemon's plugin register two classes of objects: names and functions.</p>
-<p>Plugins declare categories of names: - A unique plugin name to access all API expose by this plugin, - One name for each methods/verbs provided by this plugin.</p>
-<p>Plugins declare two categories of functions: - function use for the initialisation - functions implementing exposed API methods</p>
-<p>Afb-daemon parses URI requests to extract the API(plugin name) and the VERB(method to activate). As an example, URI <strong>foo/bar</strong> translates to plugin named <strong>foo</strong> and method named <strong>bar</strong>. To serve such a request, afb-daemon looks for an active plugin named <strong>foo</strong> and then within this plugin for a method named <strong>bar</strong>. When find afb-daemon calls corresponding method with attached parameter if any.</p>
+<h3 id="live-cycle-of-bindings-within-afb-daemon">Live cycle of bindings within afb-daemon</h3>
+<p>Application and service bindings are loaded and activated each time a new afb-daemon is started.</p>
+<p>At launch time, every loaded binding initialise itself. If a single binding initialisation fail corresponding instance of afb-daemon self aborts.</p>
+<p>Conversely, when a binding initialisation succeeds, it should register its unique name as well as the list of verbs attached to the methods it exposes.</p>
+<p>When initialised, on request from application clients to the right API/verb, binding methods are activated by the afb-daemon attached to the application or service.</p>
+<p>At exit time, no special action is enforced by afb-daemon. When a specific actions is required at afb-daemon stop, developers should use 'atexit/on_exit' during binding initialisation sequence to register a custom exit function.</p>
+<h3 id="binding-contend">Binding Contend</h3>
+<p>Afb-daemon's binding register two classes of objects: names and functions.</p>
+<p>Bindings declare categories of names: - A unique binding name to access all API expose by this binding, - One name for each methods/verbs provided by this binding.</p>
+<p>Bindings declare two categories of functions: - function use for the initialisation - functions implementing exposed API methods</p>
+<p>Afb-daemon parses URI requests to extract the API(binding name) and the VERB(method to activate). As an example, URI <strong>foo/bar</strong> translates to binding named <strong>foo</strong> and method named <strong>bar</strong>. To serve such a request, afb-daemon looks for an active binding named <strong>foo</strong> and then within this binding for a method named <strong>bar</strong>. When find afb-daemon calls corresponding method with attached parameter if any.</p>
<p>Afb-daemon ignores letter case when parsing URI. Thus <strong>TicTacToe/Board</strong> and <strong>tictactoe/board</strong> are equivalent.</p>
-<h4 id="the-name-of-the-plugin">The name of the plugin</h4>
-<p>The name of a given plugin is also known as the name of the API prefix that defines the plugin.</p>
-<p>The name of a plugin SHOULD be unique within a given afb-daemon instance.</p>
-<p>For example, when a client of afb-daemon calls a URI named <strong>foo/bar</strong>. Afb-daemon extracts the prefix <strong>foo</strong> and the suffix <strong>bar</strong>. <strong>foo</strong> must match a plugin name and <strong>bar</strong> a VERB attached to some method.</p>
+<h4 id="the-name-of-the-binding">The name of the binding</h4>
+<p>The name of a given binding is also known as the name of the API prefix that defines the binding.</p>
+<p>The name of a binding SHOULD be unique within a given afb-daemon instance.</p>
+<p>For example, when a client of afb-daemon calls a URI named <strong>foo/bar</strong>. Afb-daemon extracts the prefix <strong>foo</strong> and the suffix <strong>bar</strong>. <strong>foo</strong> must match a binding name and <strong>bar</strong> a VERB attached to some method.</p>
<h4 id="names-of-methods">Names of methods</h4>
-<p>Each plugin exposes a set of methods that can be called by the clients of a given afb-daemon.</p>
-<p>VERB's name attached to a given plugin (API) MUST be unique within a plugin.</p>
-<p>Plugins static declaration link VERBS to corresponding methods. When clients emit requests on a given API/VERB corresponding method is called by afb-daemon.</p>
+<p>Each binding exposes a set of methods that can be called by the clients of a given afb-daemon.</p>
+<p>VERB's name attached to a given binding (API) MUST be unique within a binding.</p>
+<p>Bindings static declaration link VERBS to corresponding methods. When clients emit requests on a given API/VERB corresponding method is called by afb-daemon.</p>
<h4 id="initialisation-function">Initialisation function</h4>
-<p>Plugin's initialisation function serves several purposes.</p>
+<p>Binding's initialisation function serves several purposes.</p>
<ol type="1">
-<li><p>It allows afb-daemon to control plugin version depending on initialisation function name. As today, the only supported initialisation function is <strong>pluginAfbV1Register</strong>. This identifies version &quot;one&quot; of plugins.</p></li>
-<li><p>It allows plugins to initialise itself.</p></li>
+<li><p>It allows afb-daemon to control binding version depending on initialisation function name. As today, the only supported initialisation function is <strong>afbBindingV1Register</strong>. This identifies version &quot;one&quot; of bindings.</p></li>
+<li><p>It allows bindings to initialise itself.</p></li>
<li><p>It enables names declarations: descriptions, requirements and implementations of exposed API/VERB.</p></li>
</ol>
<h4 id="functions-instantiation-of-apiverbs">Functions instantiation of API/VERBs</h4>
-<p>When an API/VERB is called, afb-daemon constructs a request object. Then it passes this request object to the implementation function corresponding to requested method, this within attached API plugin.</p>
+<p>When an API/VERB is called, afb-daemon constructs a request object. Then it passes this request object to the implementation function corresponding to requested method, this within attached API binding.</p>
<p>An implementation function receives a request object that is used to: get arguments of the request, send answer, store session data.</p>
-<p>A plugin MUST set an answer to every received requests.</p>
+<p>A binding MUST set an answer to every received requests.</p>
<p>Nevertheless it is not mandatory to set the answer before returning from API/VERB implementing function. This behaviour is important for asynchronous actions.</p>
<p>API/VERB implementation that set an answer before returning are called <em>synchronous implementations</em>. Those that do not systematically set an answer before returning are called <em>asynchronous implementations</em>.</p>
<p>Asynchronous implementations typically launch asynchronous actions. They record some context at request time and provide answer to the request only at completion of asynchronous actions.</p>
<h2 id="the-tic-tac-toe-example">The Tic-Tac-Toe example</h2>
-<p>This part explains how to write an afb-plugin. For the sake of being practical it uses many examples based on tic-tac-toe. This plugin example is in <em>plugins/samples/tic-tac-toe.c</em>.</p>
-<p>This plugin is named <strong><em>tictactoe</em></strong>.</p>
+<p>This part explains how to write an afb-binding. For the sake of being practical it uses many examples based on tic-tac-toe. This binding example is in <em>bindings/samples/tic-tac-toe.c</em>.</p>
+<p>This binding is named <strong><em>tictactoe</em></strong>.</p>
<h2 id="dependencies-when-compiling">Dependencies when compiling</h2>
<p>Afb-daemon provides a configuration file for <em>pkg-config</em>. Typing the command</p>
<pre><code>pkg-config --cflags afb-daemon</code></pre>
@@ -150,32 +148,32 @@ Author: José Bollo</code></pre>
<p>For linking, you should use</p>
<pre><code>$ pkg-config --libs afb-daemon
-ljson-c</code></pre>
-<p>Afb-daemon automatically includes dependency to json-c. This is activated through <strong>Requires</strong> keyword in pkg-config. While almost every plugin replies on <strong>json-c</strong> this is not a must have dependency.</p>
-<p>Internally, afb-daemon relies on <strong>libsystemd</strong> for its event loop, as well as for its binding to D-Bus. Plugins developers are encouraged to leverage <strong>libsystemd</strong> when possible. Nevertheless there is no hard dependency to <strong>libsystemd</strong> if ever you rather not use it, feel free to do so.</p>
+<p>Afb-daemon automatically includes dependency to json-c. This is activated through <strong>Requires</strong> keyword in pkg-config. While almost every binding replies on <strong>json-c</strong> this is not a must have dependency.</p>
+<p>Internally, afb-daemon relies on <strong>libsystemd</strong> for its event loop, as well as for its binding to D-Bus. Bindings developers are encouraged to leverage <strong>libsystemd</strong> when possible. Nevertheless there is no hard dependency to <strong>libsystemd</strong> if ever you rather not use it, feel free to do so.</p>
<blockquote>
-<p>Afb-daemon plugin are fully self contain. They do not enforce dependency on any libraries from the application framework. Afb-daemon dependencies requirer to run AGL plugins are given at runtime through pointers leveraging read-only memory feature.</p>
+<p>Afb-daemon binding are fully self contain. They do not enforce dependency on any libraries from the application framework. Afb-daemon dependencies requirer to run AGL bindings are given at runtime through pointers leveraging read-only memory feature.</p>
</blockquote>
<h2 id="header-files-to-include">Header files to include</h2>
-<p>Plugin <em>tictactoe</em> has following includes:</p>
+<p>Binding <em>tictactoe</em> has following includes:</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="ot">#define _GNU_SOURCE</span>
<span class="ot">#include &lt;stdio.h&gt;</span>
<span class="ot">#include &lt;string.h&gt;</span>
<span class="ot">#include &lt;json-c/json.h&gt;</span>
-<span class="ot">#include &lt;afb/afb-plugin.h&gt;</span></code></pre>
-<p>Header <em>afb/afb-plugin.h</em> is the only hard dependency, it includes all features that a plugin MUST HAVE. Outside of includes used to support application logic, common external headers used within plugins are:</p>
+<span class="ot">#include &lt;afb/afb-binding.h&gt;</span></code></pre>
+<p>Header <em>afb/afb-binding.h</em> is the only hard dependency, it includes all features that a binding MUST HAVE. Outside of includes used to support application logic, common external headers used within bindings are:</p>
<ul>
<li><em>json-c/json.h</em>: should be include to handle json objects;</li>
<li><em>systemd/sd-event.h</em>: should be include to access event main loop;</li>
<li><em>systemd/sd-bus.h</em>: should be include for dbus connections.</li>
</ul>
-<p>The <em>tictactoe</em> plugin does not leverage systemd features, also only json.h is used on top of mandatory afb/afb-plugin.h.</p>
-<p>When including <em>afb/afb-plugin.h</em>, the macro **_GNU_SOURCE** MUST be defined.</p>
+<p>The <em>tictactoe</em> binding does not leverage systemd features, also only json.h is used on top of mandatory afb/afb-binding.h.</p>
+<p>When including <em>afb/afb-binding.h</em>, the macro **_GNU_SOURCE** MUST be defined.</p>
<h2 id="choosing-names">Choosing names</h2>
-<p>Designers of plugins should define a unique name for every API plugin as well as for methods VERBs. They should also define names for request arguments passed as name/value pair in URI.</p>
+<p>Designers of bindings should define a unique name for every API binding as well as for methods VERBs. They should also define names for request arguments passed as name/value pair in URI.</p>
<p>While forging names, designers should respect few rules to ensure that created names are valid and easy to use across platforms.</p>
<p>All names and strings are UTF-8 encoded.</p>
-<h3 id="names-for-api-plugin">Names for API (plugin)</h3>
-<p>Plugin API name are checked. All characters are authorised except:</p>
+<h3 id="names-for-api-binding">Names for API (binding)</h3>
+<p>Binding API name are checked. All characters are authorised except:</p>
<ul>
<li>the control characters (000 .. 01f)</li>
<li>the characters of the set { ' ', '&quot;', '#', '%', '&amp;', ''', '/', '?', '`', '7f' }</li>
@@ -184,7 +182,7 @@ Author: José Bollo</code></pre>
<p>Afb-daemon makes no distinction between lower case and upper case when searching for API/VERB.</p>
<h3 id="names-for-methods">Names for methods</h3>
<p>The names of methods VERBs are totally free and not checked.</p>
-<p>However, the validity rules for method's VERB name are the same as for Plugin API name except that the dot(.) character is forbidden.</p>
+<p>However, the validity rules for method's VERB name are the same as for Binding API name except that the dot(.) character is forbidden.</p>
<p>Afb-daemon makes no case distinction when searching for an API by name.</p>
<h3 id="names-for-arguments">Names for arguments</h3>
<p>Argument's name are not restricted and can be everything you wish.</p>
@@ -221,7 +219,7 @@ Author: José Bollo</code></pre>
}</code></pre>
<p>This example shows many aspects of a synchronous method implementation. Let summarise it:</p>
<ol type="1">
-<li><p>The function <strong>board_of_req</strong> retrieves the context stored for the plugin: the board.</p></li>
+<li><p>The function <strong>board_of_req</strong> retrieves the context stored for the binding: the board.</p></li>
<li><p>The macro <strong>INFO</strong> sends a message of kind <em>INFO</em> to the logging system. The global variable named <strong>afbitf</strong> used represents the interface to afb-daemon.</p></li>
<li><p>The function <strong>describe</strong> creates a json_object representing the board.</p></li>
<li><p>The function <strong>afb_req_success</strong> sends the reply, attaching to it the object <em>description</em>.</p></li>
@@ -233,7 +231,7 @@ Author: José Bollo</code></pre>
</blockquote>
<p>The definition of <strong>struct afb_req</strong> is:</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
-<span class="co"> * Describes the request by plugins from afb-daemon</span>
+<span class="co"> * Describes the request by bindings from afb-daemon</span>
<span class="co"> */</span>
<span class="kw">struct</span> afb_req {
<span class="dt">const</span> <span class="kw">struct</span> afb_req_itf *itf; <span class="co">/* the interfacing functions */</span>
@@ -249,17 +247,17 @@ Author: José Bollo</code></pre>
<p>The first time, to retrieve the board attached to the session of the request.</p>
<p>The second time, to send the reply: an object that describes the current board.</p>
<h3 id="associating-a-client-context-to-a-session">Associating a client context to a session</h3>
-<p>When <em>tic-tac-toe</em> plugin receives a request, it musts get the board describing the game associated to the session.</p>
-<p>For a plugin, having data associated to a session is common. This data is called &quot;plugin context&quot; for the session. Within <em>tic-tac-toe</em> plugin the context is the board.</p>
+<p>When <em>tic-tac-toe</em> binding receives a request, it musts get the board describing the game associated to the session.</p>
+<p>For a binding, having data associated to a session is common. This data is called &quot;binding context&quot; for the session. Within <em>tic-tac-toe</em> binding the context is the board.</p>
<p>Requests <em>afb_req</em> offer four functions for storing and retrieving session associated context.</p>
<p>These functions are:</p>
<ul>
-<li><p><strong>afb_req_context_get</strong>: retrieves context data stored for current plugin.</p></li>
-<li><p><strong>afb_req_context_set</strong>: store context data of current plugin.</p></li>
-<li><p><strong>afb_req_context</strong>: if exist retrieves context data of current plugin. if context does not yet exist, creates a new context and store it.</p></li>
+<li><p><strong>afb_req_context_get</strong>: retrieves context data stored for current binding.</p></li>
+<li><p><strong>afb_req_context_set</strong>: store context data of current binding.</p></li>
+<li><p><strong>afb_req_context</strong>: if exist retrieves context data of current binding. if context does not yet exist, creates a new context and store it.</p></li>
<li><p><strong>afb_req_context_clear</strong>: reset the stored context data.</p></li>
</ul>
-<p>The plugin <em>tictactoe</em> use a convenient function to retrieve its context: the board. This function is <em>board_of_req</em>:</p>
+<p>The binding <em>tictactoe</em> use a convenient function to retrieve its context: the board. This function is <em>board_of_req</em>:</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
<span class="co"> * retrieves the board of the request</span>
<span class="co"> */</span>
@@ -270,7 +268,7 @@ Author: José Bollo</code></pre>
<p>The function <strong>afb_req_context</strong> ensures an existing context for the session of the request. Its two last arguments are functions to allocate and free context. Note function type casts to avoid compilation warnings.</p>
<p>Here is the definition of the function <strong>afb_req_context</strong></p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
-<span class="co"> * Gets the pointer stored by the plugin for the session of &#39;req&#39;.</span>
+<span class="co"> * Gets the pointer stored by the binding for the session of &#39;req&#39;.</span>
<span class="co"> * If the stored pointer is NULL, indicating that no pointer was</span>
<span class="co"> * already stored, afb_req_context creates a new context by calling</span>
<span class="co"> * the function &#39;create_context&#39; and stores it with the freeing function</span>
@@ -285,24 +283,24 @@ Author: José Bollo</code></pre>
}
<span class="kw">return</span> result;
}</code></pre>
-<p>The second argument if the function that creates the context. For plugin <em>tic-tac-toe</em> (function <strong>get_new_board</strong>). The function <strong>get_new_board</strong> creates a new board and set usage its count to 1. The boards are checking usage count to free resources when not used.</p>
-<p>The third argument is a function that frees context resources. For plugin <em>tic-tac-toe</em> (function <strong>release_board</strong>). The function <strong>release_board</strong> decrease usage count of the board passed in argument. When usage count falls to zero, data board are freed.</p>
+<p>The second argument if the function that creates the context. For binding <em>tic-tac-toe</em> (function <strong>get_new_board</strong>). The function <strong>get_new_board</strong> creates a new board and set usage its count to 1. The boards are checking usage count to free resources when not used.</p>
+<p>The third argument is a function that frees context resources. For binding <em>tic-tac-toe</em> (function <strong>release_board</strong>). The function <strong>release_board</strong> decrease usage count of the board passed in argument. When usage count falls to zero, data board are freed.</p>
<p>Definition of other functions dealing with contexts:</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
-<span class="co"> * Gets the pointer stored by the plugin for the session of &#39;req&#39;.</span>
-<span class="co"> * When the plugin has not yet recorded a pointer, NULL is returned.</span>
+<span class="co"> * Gets the pointer stored by the binding for the session of &#39;req&#39;.</span>
+<span class="co"> * When the binding has not yet recorded a pointer, NULL is returned.</span>
<span class="co"> */</span>
<span class="dt">void</span> *afb_req_context_get(<span class="kw">struct</span> afb_req req);
<span class="co">/*</span>
-<span class="co"> * Stores for the plugin the pointer &#39;context&#39; to the session of &#39;req&#39;.</span>
+<span class="co"> * Stores for the binding the pointer &#39;context&#39; to the session of &#39;req&#39;.</span>
<span class="co"> * The function &#39;free_context&#39; will be called when the session is closed</span>
-<span class="co"> * or if plugin stores an other pointer.</span>
+<span class="co"> * or if binding stores an other pointer.</span>
<span class="co"> */</span>
<span class="dt">void</span> afb_req_context_set(<span class="kw">struct</span> afb_req req, <span class="dt">void</span> *context, <span class="dt">void</span> (*free_context)(<span class="dt">void</span>*));
<span class="co">/*</span>
-<span class="co"> * Frees the pointer stored by the plugin for the session of &#39;req&#39;</span>
+<span class="co"> * Frees the pointer stored by the binding for the session of &#39;req&#39;</span>
<span class="co"> * and sets it to NULL.</span>
<span class="co"> *</span>
<span class="co"> * Shortcut for: afb_req_context_set(req, NULL, NULL)</span>
@@ -367,9 +365,9 @@ Author: José Bollo</code></pre>
<p>For conveniency, these functions automatically call <strong>json_object_put</strong> to release <strong>obj</strong>. Because <strong>obj</strong> usage count is null after being passed to a reply function, it SHOULD not be used anymore. If exceptionally <strong>obj</strong> needs to remain usable after reply function then using <strong>json_object_get</strong> on <strong>obj</strong> to increase usage count and cancels the effect the <strong>json_object_put</strong> is possible.</p>
</blockquote>
<h2 id="getting-argument-of-invocation">Getting argument of invocation</h2>
-<p>Many methods expect arguments. Afb-daemon's plugins retrieve arguments by name and not by position.</p>
+<p>Many methods expect arguments. Afb-daemon's bindings retrieve arguments by name and not by position.</p>
<p>Arguments are passed by requests through either HTTP or WebSockets.</p>
-<p>For example, the method <strong>join</strong> of plugin <strong>tic-tac-toe</strong> expects one argument: the <em>boardid</em> to join. Here is an extract:</p>
+<p>For example, the method <strong>join</strong> of binding <strong>tic-tac-toe</strong> expects one argument: the <em>boardid</em> to join. Here is an extract:</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
<span class="co"> * Join a board</span>
<span class="co"> */</span>
@@ -457,9 +455,9 @@ Author: José Bollo</code></pre>
<p>Argument named <strong>file</strong> should have both its value and path defined.</p>
<p>The value is the name of the file as it was set by the HTTP client. Generally it is the filename on client side.</p>
<p>The path is the effective path of saved file on the temporary local storage area of the application. This is a randomly generated and unique filename. It is not linked with the original filename as used on client side.</p>
-<p>After success the plugin can use the uploaded file directly from local storage path with no restriction: read, write, remove, copy, rename... Nevertheless when request reply is set and query terminated, the uploaded temporary file at path is destroyed.</p>
+<p>After success the binding can use the uploaded file directly from local storage path with no restriction: read, write, remove, copy, rename... Nevertheless when request reply is set and query terminated, the uploaded temporary file at path is destroyed.</p>
<h3 id="arguments-as-a-json-object">Arguments as a JSON object</h3>
-<p>Plugins may also request every arguments of a given call as one single object. This feature is provided by the function <strong>afb_req_json</strong> defined here after:</p>
+<p>Bindings may also request every arguments of a given call as one single object. This feature is provided by the function <strong>afb_req_json</strong> defined here after:</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
<span class="co"> * Gets from the request &#39;req&#39; the json object hashing the arguments.</span>
<span class="co"> * The returned object must not be released using &#39;json_object_put&#39;.</span>
@@ -473,39 +471,39 @@ Author: José Bollo</code></pre>
<blockquote>
<p>In fact, for Websockets requests, the function <strong>afb_req_value</strong> can be seen as a shortcut to <strong><em>json_object_get_string(json_object_object_get(afb_req_json(req), name))</em></strong></p>
</blockquote>
-<h2 id="initialisation-of-the-plugin-and-declaration-of-methods">Initialisation of the plugin and declaration of methods</h2>
-<p>To be active, plugin's methods should be declared to afb-daemon. Furthermore, the plugin itself must be recorded.</p>
-<p>The registration mechanism is very basic: when afb-need starts, it loads all plugins listed in: command line or configuration file.</p>
-<p>Loading a plugin follows the following steps:</p>
+<h2 id="initialisation-of-the-binding-and-declaration-of-methods">Initialisation of the binding and declaration of methods</h2>
+<p>To be active, binding's methods should be declared to afb-daemon. Furthermore, the binding itself must be recorded.</p>
+<p>The registration mechanism is very basic: when afb-need starts, it loads all bindings listed in: command line or configuration file.</p>
+<p>Loading a binding follows the following steps:</p>
<ol type="1">
-<li><p>Afb-daemon loads the plugin with <em>dlopen</em>.</p></li>
-<li><p>Afb-daemon searches for a symbol named <strong>pluginAfbV1Register</strong> using <em>dlsym</em>. This symbol is assumed to be the exported initialisation function of the plugin.</p></li>
-<li><p>Afb-daemon builds an interface object for the plugin.</p></li>
-<li><p>Afb-daemon calls the found function <strong>pluginAfbV1Register</strong> with interface pointer as parameter.</p></li>
-<li><p>Function <strong>pluginAfbV1Register</strong> setups the plugin and initialises it.</p></li>
-<li><p>Function <strong>pluginAfbV1Register</strong> returns the pointer to a structure describing the plugin: version, name (prefix or API name), and list of methods.</p></li>
-<li><p>Afb-daemon checks that the returned version and name can be managed. If so, plugin and its methods are register to become usable as soon as afb-daemon initialisation is finished.</p></li>
+<li><p>Afb-daemon loads the binding with <em>dlopen</em>.</p></li>
+<li><p>Afb-daemon searches for a symbol named <strong>afbBindingV1Register</strong> using <em>dlsym</em>. This symbol is assumed to be the exported initialisation function of the binding.</p></li>
+<li><p>Afb-daemon builds an interface object for the binding.</p></li>
+<li><p>Afb-daemon calls the found function <strong>afbBindingV1Register</strong> with interface pointer as parameter.</p></li>
+<li><p>Function <strong>afbBindingV1Register</strong> setups the binding and initialises it.</p></li>
+<li><p>Function <strong>afbBindingV1Register</strong> returns the pointer to a structure describing the binding: version, name (prefix or API name), and list of methods.</p></li>
+<li><p>Afb-daemon checks that the returned version and name can be managed. If so, binding and its methods are register to become usable as soon as afb-daemon initialisation is finished.</p></li>
</ol>
-<p>Here after the code used for <strong>pluginAfbV1Register</strong> from plugin <em>tic-tac-toe</em>:</p>
+<p>Here after the code used for <strong>afbBindingV1Register</strong> from binding <em>tic-tac-toe</em>:</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
-<span class="co"> * activation function for registering the plugin called by afb-daemon</span>
+<span class="co"> * activation function for registering the binding called by afb-daemon</span>
<span class="co"> */</span>
-<span class="dt">const</span> <span class="kw">struct</span> AFB_plugin *pluginAfbV1Register(<span class="dt">const</span> <span class="kw">struct</span> AFB_interface *itf)
+<span class="dt">const</span> <span class="kw">struct</span> afb_binding *afbBindingV1Register(<span class="dt">const</span> <span class="kw">struct</span> afb_binding_interface *itf)
{
afbitf = itf; <span class="co">// records the interface for accessing afb-daemon</span>
- <span class="kw">return</span> &amp;plugin_description; <span class="co">// returns the description of the plugin</span>
+ <span class="kw">return</span> &amp;binding_description; <span class="co">// returns the description of the binding</span>
}</code></pre>
-<p>It is a very minimal initialisation function because <em>tic-tac-toe</em> plugin doesn't have any application related initialisation step. It merely record daemon's interface and returns its description.</p>
-<p>The variable <strong>afbitf</strong> is a plugin global variable. It keeps the interface to afb-daemon that should be used for logging and pushing events. Here is its declaration:</p>
+<p>It is a very minimal initialisation function because <em>tic-tac-toe</em> binding doesn't have any application related initialisation step. It merely record daemon's interface and returns its description.</p>
+<p>The variable <strong>afbitf</strong> is a binding global variable. It keeps the interface to afb-daemon that should be used for logging and pushing events. Here is its declaration:</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
<span class="co"> * the interface to afb-daemon</span>
<span class="co"> */</span>
-<span class="dt">const</span> <span class="kw">struct</span> AFB_interface *afbitf;</code></pre>
-<p>The description of the plugin is defined here after.</p>
+<span class="dt">const</span> <span class="kw">struct</span> afb_binding_interface *afbitf;</code></pre>
+<p>The description of the binding is defined here after.</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
<span class="co"> * array of the methods exported to afb-daemon</span>
<span class="co"> */</span>
-<span class="dt">static</span> <span class="dt">const</span> <span class="kw">struct</span> AFB_method_desc_v1 plugin_methods[] = {
+<span class="dt">static</span> <span class="dt">const</span> <span class="kw">struct</span> afb_verb_desc_v1 binding_methods[] = {
<span class="co">/* VERB&#39;S NAME SESSION MANAGEMENT FUNCTION TO CALL SHORT DESCRIPTION */</span>
{ .name= <span class="st">&quot;new&quot;</span>, .session= AFB_SESSION_NONE, .callback= new, .info= <span class="st">&quot;Starts a new game&quot;</span> },
{ .name= <span class="st">&quot;play&quot;</span>, .session= AFB_SESSION_NONE, .callback= play, .info= <span class="st">&quot;Asks the server to play&quot;</span> },
@@ -519,21 +517,21 @@ Author: José Bollo</code></pre>
};
<span class="co">/*</span>
-<span class="co"> * description of the plugin for afb-daemon</span>
+<span class="co"> * description of the binding for afb-daemon</span>
<span class="co"> */</span>
-<span class="dt">static</span> <span class="dt">const</span> <span class="kw">struct</span> AFB_plugin plugin_description =
+<span class="dt">static</span> <span class="dt">const</span> <span class="kw">struct</span> afb_binding binding_description =
{
<span class="co">/* description conforms to VERSION 1 */</span>
- .type= AFB_PLUGIN_VERSION_1,
- .v1= { <span class="co">/* fills the v1 field of the union when AFB_PLUGIN_VERSION_1 */</span>
- .prefix= <span class="st">&quot;tictactoe&quot;</span>, <span class="co">/* the API name (or plugin name or prefix) */</span>
- .info= <span class="st">&quot;Sample tac-tac-toe game&quot;</span>, <span class="co">/* short description of of the plugin */</span>
- .methods = plugin_methods <span class="co">/* the array describing the methods of the API */</span>
+ .type= AFB_BINDING_VERSION_1,
+ .v1= { <span class="co">/* fills the v1 field of the union when AFB_BINDING_VERSION_1 */</span>
+ .prefix= <span class="st">&quot;tictactoe&quot;</span>, <span class="co">/* the API name (or binding name or prefix) */</span>
+ .info= <span class="st">&quot;Sample tac-tac-toe game&quot;</span>, <span class="co">/* short description of of the binding */</span>
+ .methods = binding_methods <span class="co">/* the array describing the methods of the API */</span>
}
};</code></pre>
-<p>The structure <strong>plugin_description</strong> describes the plugin. It declares the type and version of the plugin, its name, a short description and its methods list.</p>
+<p>The structure <strong>binding_description</strong> describes the binding. It declares the type and version of the binding, its name, a short description and its methods list.</p>
<p>The list of methods is an array of structures describing the methods and terminated by a NULL marker.</p>
-<p>In version one of afb-damon plugin, a method description contains 4 fields:</p>
+<p>In version one of afb-damon binding, a method description contains 4 fields:</p>
<ul>
<li><p>the name of the method,</p></li>
<li><p>the session management flags,</p></li>
@@ -542,10 +540,10 @@ Author: José Bollo</code></pre>
</ul>
<p>The structure describing methods is defined as follows:</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
-<span class="co"> * Description of one method of the API provided by the plugin</span>
-<span class="co"> * This enumeration is valid for plugins of type 1</span>
+<span class="co"> * Description of one method of the API provided by the binding</span>
+<span class="co"> * This enumeration is valid for bindings of type 1</span>
<span class="co"> */</span>
-<span class="kw">struct</span> AFB_method_desc_v1
+<span class="kw">struct</span> afb_verb_desc_v1
{
<span class="dt">const</span> <span class="dt">char</span> *name; <span class="co">/* name of the method */</span>
<span class="kw">enum</span> AFB_session_v1 session; <span class="co">/* authorisation and session requirements of the method */</span>
@@ -635,7 +633,7 @@ Author: José Bollo</code></pre>
</blockquote>
<h2 id="sending-messages-to-the-log-system">Sending messages to the log system</h2>
<p>Afb-daemon provides 4 levels of verbosity and 5 methods for logging messages.</p>
-<p>The verbosity is managed. Options allow the change the verbosity of afb-daemon and the verbosity of the plugins can be set plugin by plugin.</p>
+<p>The verbosity is managed. Options allow the change the verbosity of afb-daemon and the verbosity of the bindings can be set binding by binding.</p>
<p>The methods for logging messages are defined as macros that test the verbosity level and that call the real logging function only if the message must be output. This avoid evaluation of arguments of the formatting messages if the message must not be output.</p>
<h3 id="verbs-for-logging-messages">Verbs for logging messages</h3>
<p>The 5 logging methods are:</p>
@@ -683,8 +681,8 @@ Author: José Bollo</code></pre>
</table>
<p>You can note that the 2 methods <strong>WARNING</strong> and <strong>INFO</strong> have the same level of verbosity. But they don't have the same <em>syslog level</em>. It means that they are output with a different level on the logging system.</p>
<p>All of these methods have the same signature:</p>
-<pre class="sourceCode c"><code class="sourceCode c"><span class="dt">void</span> ERROR(<span class="dt">const</span> <span class="kw">struct</span> AFB_interface *afbitf, <span class="dt">const</span> <span class="dt">char</span> *message, ...);</code></pre>
-<p>The first argument <strong>afbitf</strong> is the interface to afb daemon that the plugin received at initialisation time when <strong>pluginAfbV1Register</strong> is called.</p>
+<pre class="sourceCode c"><code class="sourceCode c"><span class="dt">void</span> ERROR(<span class="dt">const</span> <span class="kw">struct</span> afb_binding_interface *afbitf, <span class="dt">const</span> <span class="dt">char</span> *message, ...);</code></pre>
+<p>The first argument <strong>afbitf</strong> is the interface to afb daemon that the binding received at initialisation time when <strong>afbBindingV1Register</strong> is called.</p>
<p>The second argument <strong>message</strong> is a formatting string compatible with printf/sprintf.</p>
<p>The remaining arguments are arguments of the formating message like with printf.</p>
<h3 id="managing-verbosity">Managing verbosity</h3>
@@ -761,8 +759,8 @@ Author: José Bollo</code></pre>
</table>
<p>The message is pushed to standard error. The final destination of the message depends on how systemd service was configured through its variable <strong>StandardError</strong>. It can be journal, syslog or kmsg. (See man sd-daemon).</p>
<h2 id="sending-events">Sending events</h2>
-<p>Since version 0.5, plugins can broadcast events to any potential listener. As today only unattended even are supported. Targeted events are expected for next coming version.</p>
-<p>The plugin <em>tic-tac-toe</em> broadcasts events when the board changes. This is done in the function <strong>changed</strong>:</p>
+<p>Since version 0.5, bindings can broadcast events to any potential listener. As today only unattended even are supported. Targeted events are expected for next coming version.</p>
+<p>The binding <em>tic-tac-toe</em> broadcasts events when the board changes. This is done in the function <strong>changed</strong>:</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
<span class="co"> * signals a change of the board</span>
<span class="co"> */</span>
@@ -779,12 +777,12 @@ Author: José Bollo</code></pre>
afb_daemon_broadcast_event(afbitf-&gt;daemon, reason, description);
}</code></pre>
<p>The description of the changed board is pushed via the daemon interface.</p>
-<p>Within plugin <em>tic-tac-toe</em>, <em>reason</em> indicates the origin of the change. In function <strong>afb_daemon_broadcast_event</strong> the second parameter is the name of broadcasted event. The third argument is the object that is transmitted with the event.</p>
+<p>Within binding <em>tic-tac-toe</em>, <em>reason</em> indicates the origin of the change. In function <strong>afb_daemon_broadcast_event</strong> the second parameter is the name of broadcasted event. The third argument is the object that is transmitted with the event.</p>
<p>Function <strong>afb_daemon_broadcast_event</strong> is defined here after:</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
<span class="co"> * Broadcasts widely the event of &#39;name&#39; with the data &#39;object&#39;.</span>
<span class="co"> * &#39;object&#39; can be NULL.</span>
-<span class="co"> * &#39;daemon&#39; MUST be the daemon given in interface when activating the plugin.</span>
+<span class="co"> * &#39;daemon&#39; MUST be the daemon given in interface when activating the binding.</span>
<span class="co"> *</span>
<span class="co"> * For conveniency, the function calls &#39;json_object_put&#39; for &#39;object&#39;.</span>
<span class="co"> * Thus, in the case where &#39;object&#39; should remain available after</span>
@@ -794,9 +792,9 @@ Author: José Bollo</code></pre>
<blockquote>
<p>Be aware, as with reply functions <strong>object</strong> is automatically released using <strong>json_object_put</strong> when using this function. Call <strong>json_object_get</strong> before calling <strong>afb_daemon_broadcast_event</strong> to keep <strong>object</strong> available after function returns.</p>
</blockquote>
-<p>Event name received by listeners is prefixed with plugin name. So when a change occurs after a move, the reason is <strong>move</strong> and every clients receive an event <strong>tictactoe/move</strong>.</p>
+<p>Event name received by listeners is prefixed with binding name. So when a change occurs after a move, the reason is <strong>move</strong> and every clients receive an event <strong>tictactoe/move</strong>.</p>
<blockquote>
-<p>Note that nothing is said about case sensitivity of event names. However, the event is always prefixed with the name that the plugin declared, with the same case, followed with a slash /. Thus it is safe to compare event using a case sensitive comparison.</p>
+<p>Note that nothing is said about case sensitivity of event names. However, the event is always prefixed with the name that the binding declared, with the same case, followed with a slash /. Thus it is safe to compare event using a case sensitive comparison.</p>
</blockquote>
<h2 id="writing-an-asynchronous-method-implementation">Writing an asynchronous method implementation</h2>
<p>The <em>tic-tac-toe</em> example allows two clients or more to share the same board. This is implemented by the method <strong>join</strong> that illustrated partly how to retrieve arguments.</p>
@@ -814,7 +812,7 @@ Author: José Bollo</code></pre>
| |&lt;-----------------+ success of move .
| | | .
|&lt;-------------|------------------+ success of wait &lt;</code></pre>
-<p>Here, this is an invocation of the plugin by an other client that unblock the suspended <em>wait</em> call. Nevertheless in most case this should be a timer, a hardware event, a sync with a concurrent process or thread, ...</p>
+<p>Here, this is an invocation of the binding by an other client that unblock the suspended <em>wait</em> call. Nevertheless in most case this should be a timer, a hardware event, a sync with a concurrent process or thread, ...</p>
<p>Common case of an asynchronous implementation.</p>
<p>Here is the listing of the function <strong>wait</strong>:</p>
<pre class="sourceCode c"><code class="sourceCode c"><span class="dt">static</span> <span class="dt">void</span> wait(<span class="kw">struct</span> afb_req req)
@@ -867,26 +865,26 @@ Author: José Bollo</code></pre>
<blockquote>
<p>The reference count <strong>MUST</strong> be decremented using <strong>afb_req_unref</strong> to free resources and avoid memory leaks. This usage count decrement should happen <strong>AFTER</strong> setting reply or bad things may happen.</p>
</blockquote>
-<h2 id="how-to-build-a-plugin">How to build a plugin</h2>
-<p>Afb-daemon provides a <em>pkg-config</em> configuration file that can be queried by providing <strong>afb-daemon</strong> in command line arguments. This configuration file provides data that should be used for plugins compilation. Examples:</p>
+<h2 id="how-to-build-a-binding">How to build a binding</h2>
+<p>Afb-daemon provides a <em>pkg-config</em> configuration file that can be queried by providing <strong>afb-daemon</strong> in command line arguments. This configuration file provides data that should be used for bindings compilation. Examples:</p>
<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">pkg-config</span> --cflags afb-daemon
$ <span class="kw">pkg-config</span> --libs afb-daemon</code></pre>
<h3 id="example-for-cmake-meta-build-system">Example for cmake meta build system</h3>
-<p>This example is the extract for building the plugin <em>afm-main</em> using <em>CMAKE</em>.</p>
+<p>This example is the extract for building the binding <em>afm-main</em> using <em>CMAKE</em>.</p>
<pre class="sourceCode cmake"><code class="sourceCode cmake"><span class="fu">pkg_check_modules</span>(afb afb-daemon)
<span class="kw">if</span>(afb_FOUND)
- <span class="kw">message</span>(<span class="ot">STATUS</span> <span class="st">&quot;Creation afm-main-plugin for AFB-DAEMON&quot;</span>)
- <span class="kw">add_library</span>(afm-main-plugin <span class="ot">MODULE</span> afm-main-plugin.c)
- <span class="kw">target_compile_options</span>(afm-main-plugin <span class="ot">PRIVATE</span> <span class="dv">${afb_CFLAGS}</span>)
- <span class="kw">target_include_directories</span>(afm-main-plugin <span class="ot">PRIVATE</span> <span class="dv">${afb_INCLUDE_DIRS}</span>)
- <span class="kw">target_link_libraries</span>(afm-main-plugin utils <span class="dv">${afb_LIBRARIES}</span>)
- <span class="kw">set_target_properties</span>(afm-main-plugin <span class="ot">PROPERTIES</span>
+ <span class="kw">message</span>(<span class="ot">STATUS</span> <span class="st">&quot;Creation afm-main-binding for AFB-DAEMON&quot;</span>)
+ <span class="kw">add_library</span>(afm-main-binding <span class="ot">MODULE</span> afm-main-binding.c)
+ <span class="kw">target_compile_options</span>(afm-main-binding <span class="ot">PRIVATE</span> <span class="dv">${afb_CFLAGS}</span>)
+ <span class="kw">target_include_directories</span>(afm-main-binding <span class="ot">PRIVATE</span> <span class="dv">${afb_INCLUDE_DIRS}</span>)
+ <span class="kw">target_link_libraries</span>(afm-main-binding utils <span class="dv">${afb_LIBRARIES}</span>)
+ <span class="kw">set_target_properties</span>(afm-main-binding <span class="ot">PROPERTIES</span>
<span class="ot">PREFIX</span> <span class="st">&quot;&quot;</span>
- <span class="ot">LINK_FLAGS</span> <span class="st">&quot;-Wl,--version-script=</span><span class="dv">${CMAKE_CURRENT_SOURCE_DIR}</span><span class="st">/afm-main-plugin.export-map&quot;</span>
+ <span class="ot">LINK_FLAGS</span> <span class="st">&quot;-Wl,--version-script=</span><span class="dv">${CMAKE_CURRENT_SOURCE_DIR}</span><span class="st">/afm-main-binding.export-map&quot;</span>
)
- <span class="kw">install</span>(<span class="ot">TARGETS</span> afm-main-plugin <span class="ot">LIBRARY</span> <span class="ot">DESTINATION</span> <span class="dv">${plugin_dir}</span>)
+ <span class="kw">install</span>(<span class="ot">TARGETS</span> afm-main-binding <span class="ot">LIBRARY</span> <span class="ot">DESTINATION</span> <span class="dv">${binding_dir}</span>)
<span class="kw">else</span>()
- <span class="kw">message</span>(<span class="ot">STATUS</span> <span class="st">&quot;Not creating the plugin for AFB-DAEMON&quot;</span>)
+ <span class="kw">message</span>(<span class="ot">STATUS</span> <span class="st">&quot;Not creating the binding for AFB-DAEMON&quot;</span>)
<span class="kw">endif</span>()</code></pre>
<p>Let now describe some of these lines.</p>
<pre class="sourceCode cmake"><code class="sourceCode cmake"><span class="fu">pkg_check_modules</span>(afb afb-daemon)</code></pre>
@@ -901,50 +899,50 @@ $ <span class="kw">pkg-config</span> --libs afb-daemon</code></pre>
<tbody>
<tr class="odd">
<td style="text-align: left;">afb_FOUND</td>
-<td style="text-align: left;">Set to 1 if afb-daemon plugin development files exist</td>
+<td style="text-align: left;">Set to 1 if afb-daemon binding development files exist</td>
</tr>
<tr class="even">
<td style="text-align: left;">afb_LIBRARIES</td>
-<td style="text-align: left;">Only the libraries (w/o the '-l') for compiling afb-daemon plugins</td>
+<td style="text-align: left;">Only the libraries (w/o the '-l') for compiling afb-daemon bindings</td>
</tr>
<tr class="odd">
<td style="text-align: left;">afb_LIBRARY_DIRS</td>
-<td style="text-align: left;">The paths of the libraries (w/o the '-L') for compiling afb-daemon plugins</td>
+<td style="text-align: left;">The paths of the libraries (w/o the '-L') for compiling afb-daemon bindings</td>
</tr>
<tr class="even">
<td style="text-align: left;">afb_LDFLAGS</td>
-<td style="text-align: left;">All required linker flags for compiling afb-daemon plugins</td>
+<td style="text-align: left;">All required linker flags for compiling afb-daemon bindings</td>
</tr>
<tr class="odd">
<td style="text-align: left;">afb_INCLUDE_DIRS</td>
-<td style="text-align: left;">The '-I' preprocessor flags (w/o the '-I') for compiling afb-daemon plugins</td>
+<td style="text-align: left;">The '-I' preprocessor flags (w/o the '-I') for compiling afb-daemon bindings</td>
</tr>
<tr class="even">
<td style="text-align: left;">afb_CFLAGS</td>
-<td style="text-align: left;">All required cflags for compiling afb-daemon plugins</td>
+<td style="text-align: left;">All required cflags for compiling afb-daemon bindings</td>
</tr>
</tbody>
</table>
-<p>If development files are found, the plugin can be added to the set of target to build.</p>
-<pre class="sourceCode cmake"><code class="sourceCode cmake"><span class="kw">add_library</span>(afm-main-plugin <span class="ot">MODULE</span> afm-main-plugin.c)</code></pre>
-<p>This line asks to create a shared library having a single source file named afm-main-plugin.c to be compiled. The default name of the created shared object is <strong>libafm-main-plugin.so</strong>.</p>
-<pre class="sourceCode cmake"><code class="sourceCode cmake"><span class="kw">set_target_properties</span>(afm-main-plugin <span class="ot">PROPERTIES</span>
+<p>If development files are found, the binding can be added to the set of target to build.</p>
+<pre class="sourceCode cmake"><code class="sourceCode cmake"><span class="kw">add_library</span>(afm-main-binding <span class="ot">MODULE</span> afm-main-binding.c)</code></pre>
+<p>This line asks to create a shared library having a single source file named afm-main-binding.c to be compiled. The default name of the created shared object is <strong>libafm-main-binding.so</strong>.</p>
+<pre class="sourceCode cmake"><code class="sourceCode cmake"><span class="kw">set_target_properties</span>(afm-main-binding <span class="ot">PROPERTIES</span>
<span class="ot">PREFIX</span> <span class="st">&quot;&quot;</span>
- <span class="ot">LINK_FLAGS</span> <span class="st">&quot;-Wl,--version-script=</span><span class="dv">${CMAKE_CURRENT_SOURCE_DIR}</span><span class="st">/afm-main-plugin.export-map&quot;</span>
+ <span class="ot">LINK_FLAGS</span> <span class="st">&quot;-Wl,--version-script=</span><span class="dv">${CMAKE_CURRENT_SOURCE_DIR}</span><span class="st">/afm-main-binding.export-map&quot;</span>
)</code></pre>
<p>This lines are doing two things:</p>
<ol type="1">
-<li><p>It renames the built library from <strong>libafm-main-plugin.so</strong> to <strong>afm-main-plugin.so</strong> by removing the implicitly added prefix <em>lib</em>. This step is not mandatory because afb-daemon doesn't check names of files at load time. The only filename convention used by afb-daemon relates to <strong>.so</strong> termination. *.so pattern is used when afb-daemon automatically discovers plugin from a directory hierarchy.</p></li>
-<li><p>It applies a version script at link time to only export the reserved name <strong>pluginAfbV1Register</strong> for registration entry point. By default, when building a shared library linker exports all the public symbols (C functions that are not <strong>static</strong>).</p></li>
+<li><p>It renames the built library from <strong>libafm-main-binding.so</strong> to <strong>afm-main-binding.so</strong> by removing the implicitly added prefix <em>lib</em>. This step is not mandatory because afb-daemon doesn't check names of files at load time. The only filename convention used by afb-daemon relates to <strong>.so</strong> termination. *.so pattern is used when afb-daemon automatically discovers binding from a directory hierarchy.</p></li>
+<li><p>It applies a version script at link time to only export the reserved name <strong>afbBindingV1Register</strong> for registration entry point. By default, when building a shared library linker exports all the public symbols (C functions that are not <strong>static</strong>).</p></li>
</ol>
<p>Next line are:</p>
-<pre class="sourceCode cmake"><code class="sourceCode cmake"><span class="kw">target_include_directories</span>(afm-main-plugin <span class="ot">PRIVATE</span> <span class="dv">${afb_INCLUDE_DIRS}</span>)
-<span class="kw">target_link_libraries</span>(afm-main-plugin utils <span class="dv">${afb_LIBRARIES}</span>)</code></pre>
+<pre class="sourceCode cmake"><code class="sourceCode cmake"><span class="kw">target_include_directories</span>(afm-main-binding <span class="ot">PRIVATE</span> <span class="dv">${afb_INCLUDE_DIRS}</span>)
+<span class="kw">target_link_libraries</span>(afm-main-binding utils <span class="dv">${afb_LIBRARIES}</span>)</code></pre>
<p>As you can see it uses the variables computed by <strong><em>pkg_check_modules(afb afb-daemon)</em></strong> to configure the compiler and the linker.</p>
-<h3 id="exporting-the-function-pluginafbv1register">Exporting the function pluginAfbV1Register</h3>
-<p>The function <strong>pluginAfbV1Register</strong> MUST be exported. This can be achieved using a version script at link time. Here after is a version script used for <em>tic-tac-toe</em> (plugins/samples/export.map).</p>
-<pre><code>{ global: pluginAfbV1Register; local: *; };</code></pre>
-<p>This sample <a href="https://sourceware.org/binutils/docs-2.26/ld/VERSION.html#VERSION">version script</a> exports as global the symbol <em>pluginAfbV1Register</em> and hides any other symbols.</p>
+<h3 id="exporting-the-function-afbbindingv1register">Exporting the function afbBindingV1Register</h3>
+<p>The function <strong>afbBindingV1Register</strong> MUST be exported. This can be achieved using a version script at link time. Here after is a version script used for <em>tic-tac-toe</em> (bindings/samples/export.map).</p>
+<pre><code>{ global: afbBindingV1Register; local: *; };</code></pre>
+<p>This sample <a href="https://sourceware.org/binutils/docs-2.26/ld/VERSION.html#VERSION">version script</a> exports as global the symbol <em>afbBindingV1Register</em> and hides any other symbols.</p>
<p>This version script is added to the link options using the option <strong>--version-script=export.map</strong> is given directly to the linker or using the option <strong>-Wl,--version-script=export.map</strong> when the option is given to the C compiler.</p>
<h3 id="building-within-yocto">Building within yocto</h3>
<p>Adding a dependency to afb-daemon is enough. See below:</p>
diff --git a/doc/afb-plugin-writing.md b/doc/afb-bindings-writing.md
index 9e13d0d5..9efc5bd3 100644
--- a/doc/afb-plugin-writing.md
+++ b/doc/afb-bindings-writing.md
@@ -1,4 +1,4 @@
-HOWTO WRITE a PLUGIN for AFB-DAEMON
+HOWTO WRITE a BINDING for AFB-DAEMON
===================================
version: 1
Date: 09 juin 2016
@@ -13,110 +13,110 @@ Afb-daemon binders serve files through HTTP protocol
and offers to developers the capability to expose application API methods through
HTTP or WebSocket protocol.
-Binder plugins are used to add API to afb-daemon.
-This part describes how to write a plugin for afb-daemon.
+Binder bindings are used to add API to afb-daemon.
+This part describes how to write a binding for afb-daemon.
Excepting this summary, this document target developers.
Before moving further through an example, here after
-a short overview of binder plugins fundamentals.
+a short overview of binder bindings fundamentals.
-### Nature of a plugin
+### Nature of a binding
-A plugin is an independent piece of software. A plugin is self contain and exposes application logic as sharable library.
-A plugin is intended to be dynamically loaded by afb-daemon to expose application API.
+A binding is an independent piece of software. A binding is self contain and exposes application logic as sharable library.
+A binding is intended to be dynamically loaded by afb-daemon to expose application API.
-Technically, a binder plugin does not reference and is not linked with any afb-daemon library.
+Technically, a binder binding does not reference and is not linked with any afb-daemon library.
-### Class of plugins
+### Class of bindings
-Application binder supports two kinds of plugins: application plugins and service plugins.
-Technically both class of plugin are equivalent are use the same coding convention. Only sharing mode and security context diverge.
+Application binder supports two kinds of bindings: application bindings and service bindings.
+Technically both class of binding are equivalent are use the same coding convention. Only sharing mode and security context diverge.
-#### Application-plugins
+#### Application-bindings
-Application-plugins implements the glue in between application's UI and services. Every AGL application
-has a corresponding binder that typically activates one or many plugins to interface the application logic with lower platform services.
-When an application is started by the AGL application framework, a dedicate binder is started that loads/activates application plugin(s).
-API expose by application-plugin are executed within corresponding application security context.
+Application-bindings implements the glue in between application's UI and services. Every AGL application
+has a corresponding binder that typically activates one or many bindings to interface the application logic with lower platform services.
+When an application is started by the AGL application framework, a dedicate binder is started that loads/activates application binding(s).
+API expose by application-binding are executed within corresponding application security context.
-Application plugins generally handle a unique context for a unique client. As the application framework start
-a dedicated instance of afb_daemon for each AGL application, if a given plugin is used within multiple application each of those
-application get a new and private instance of eventually "shared" plugin.
+Application bindings generally handle a unique context for a unique client. As the application framework start
+a dedicated instance of afb_daemon for each AGL application, if a given binding is used within multiple application each of those
+application get a new and private instance of eventually "shared" binding.
-#### Service-plugins
+#### Service-bindings
-Service-plugins enable API activation within corresponding service security context and not within calling application context.
-Service-plugins are intended to run as a unique instance. Service-plugins can be shared in between multiple clients.
+Service-bindings enable API activation within corresponding service security context and not within calling application context.
+Service-bindings are intended to run as a unique instance. Service-bindings can be shared in between multiple clients.
-Service-plugins can either be stateless or manage client context. When managing context each client get a private context.
+Service-bindings can either be stateless or manage client context. When managing context each client get a private context.
Sharing may either be global to the platform (ie: GPS service) or dedicated to a given user (ie: user preferences)
-### Live cycle of plugins within afb-daemon
+### Live cycle of bindings within afb-daemon
-Application and service plugins are loaded and activated each time a new afb-daemon is started.
+Application and service bindings are loaded and activated each time a new afb-daemon is started.
-At launch time, every loaded plugin initialise itself.
-If a single plugin initialisation fail corresponding instance of afb-daemon self aborts.
+At launch time, every loaded binding initialise itself.
+If a single binding initialisation fail corresponding instance of afb-daemon self aborts.
-Conversely, when a plugin initialisation succeeds, it should register
+Conversely, when a binding initialisation succeeds, it should register
its unique name as well as the list of verbs attached to the methods it exposes.
-When initialised, on request from application clients to the right API/verb, plugin methods
+When initialised, on request from application clients to the right API/verb, binding methods
are activated by the afb-daemon attached to the application or service.
At exit time, no special action is enforced by afb-daemon. When a specific actions is required at afb-daemon stop,
-developers should use 'atexit/on_exit' during plugin initialisation sequence to register a custom exit function.
+developers should use 'atexit/on_exit' during binding initialisation sequence to register a custom exit function.
-### Plugin Contend
+### Binding Contend
-Afb-daemon's plugin register two classes of objects: names and functions.
+Afb-daemon's binding register two classes of objects: names and functions.
-Plugins declare categories of names:
- - A unique plugin name to access all API expose by this plugin,
- - One name for each methods/verbs provided by this plugin.
+Bindings declare categories of names:
+ - A unique binding name to access all API expose by this binding,
+ - One name for each methods/verbs provided by this binding.
-Plugins declare two categories of functions:
+Bindings declare two categories of functions:
- function use for the initialisation
- functions implementing exposed API methods
-Afb-daemon parses URI requests to extract the API(plugin name) and the VERB(method to activate).
-As an example, URI **foo/bar** translates to plugin named **foo** and method named **bar**.
-To serve such a request, afb-daemon looks for an active plugin named **foo** and then within this plugin for a method named **bar**.
+Afb-daemon parses URI requests to extract the API(binding name) and the VERB(method to activate).
+As an example, URI **foo/bar** translates to binding named **foo** and method named **bar**.
+To serve such a request, afb-daemon looks for an active binding named **foo** and then within this binding for a method named **bar**.
When find afb-daemon calls corresponding method with attached parameter if any.
Afb-daemon ignores letter case when parsing URI. Thus **TicTacToe/Board** and **tictactoe/board** are equivalent.
-#### The name of the plugin
+#### The name of the binding
-The name of a given plugin is also known as the name
-of the API prefix that defines the plugin.
+The name of a given binding is also known as the name
+of the API prefix that defines the binding.
-The name of a plugin SHOULD be unique within a given afb-daemon instance.
+The name of a binding SHOULD be unique within a given afb-daemon instance.
For example, when a client of afb-daemon calls a URI named **foo/bar**. Afb-daemon
-extracts the prefix **foo** and the suffix **bar**. **foo** must match a plugin name and **bar** a VERB attached to some method.
+extracts the prefix **foo** and the suffix **bar**. **foo** must match a binding name and **bar** a VERB attached to some method.
#### Names of methods
-Each plugin exposes a set of methods that can be called
+Each binding exposes a set of methods that can be called
by the clients of a given afb-daemon.
-VERB's name attached to a given plugin (API) MUST be unique within a plugin.
+VERB's name attached to a given binding (API) MUST be unique within a binding.
-Plugins static declaration link VERBS to corresponding methods.
+Bindings static declaration link VERBS to corresponding methods.
When clients emit requests on a given API/VERB corresponding method is called by afb-daemon.
#### Initialisation function
-Plugin's initialisation function serves several purposes.
+Binding's initialisation function serves several purposes.
-1. It allows afb-daemon to control plugin version depending on initialisation function name.
-As today, the only supported initialisation function is **pluginAfbV1Register**. This identifies
-version "one" of plugins.
+1. It allows afb-daemon to control binding version depending on initialisation function name.
+As today, the only supported initialisation function is **afbBindingV1Register**. This identifies
+version "one" of bindings.
-2. It allows plugins to initialise itself.
+2. It allows bindings to initialise itself.
3. It enables names declarations: descriptions, requirements and implementations of exposed API/VERB.
@@ -124,13 +124,13 @@ version "one" of plugins.
When an API/VERB is called, afb-daemon constructs a request object. Then it
passes this request object to the implementation function corresponding to requested method, this
-within attached API plugin.
+within attached API binding.
An implementation function receives a request object that
is used to: get arguments of the request, send
answer, store session data.
-A plugin MUST set an answer to every received requests.
+A binding MUST set an answer to every received requests.
Nevertheless it is not mandatory to set the answer
before returning from API/VERB implementing function.
@@ -145,12 +145,12 @@ request time and provide answer to the request only at completion of asynchronou
The Tic-Tac-Toe example
-----------------------
-This part explains how to write an afb-plugin.
+This part explains how to write an afb-binding.
For the sake of being practical it uses many
examples based on tic-tac-toe.
-This plugin example is in *plugins/samples/tic-tac-toe.c*.
+This binding example is in *bindings/samples/tic-tac-toe.c*.
-This plugin is named ***tictactoe***.
+This binding is named ***tictactoe***.
Dependencies when compiling
---------------------------
@@ -172,49 +172,49 @@ For linking, you should use
Afb-daemon automatically includes dependency to json-c.
This is activated through **Requires** keyword in pkg-config.
-While almost every plugin replies on **json-c** this is not a must have dependency.
+While almost every binding replies on **json-c** this is not a must have dependency.
Internally, afb-daemon relies on **libsystemd** for its event loop, as well
as for its binding to D-Bus.
-Plugins developers are encouraged to leverage **libsystemd** when possible.
+Bindings developers are encouraged to leverage **libsystemd** when possible.
Nevertheless there is no hard dependency to **libsystemd** if ever
you rather not use it, feel free to do so.
-> Afb-daemon plugin are fully self contain. They do not enforce dependency on any libraries from the application framework.
-> Afb-daemon dependencies requirer to run AGL plugins are given at runtime through pointers leveraging read-only
+> Afb-daemon binding are fully self contain. They do not enforce dependency on any libraries from the application framework.
+> Afb-daemon dependencies requirer to run AGL bindings are given at runtime through pointers leveraging read-only
> memory feature.
Header files to include
-----------------------
-Plugin *tictactoe* has following includes:
+Binding *tictactoe* has following includes:
```C
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <json-c/json.h>
-#include <afb/afb-plugin.h>
+#include <afb/afb-binding.h>
```
-Header *afb/afb-plugin.h* is the only hard dependency, it includes all features
-that a plugin MUST HAVE. Outside of includes used to support application logic,
-common external headers used within plugins are:
+Header *afb/afb-binding.h* is the only hard dependency, it includes all features
+that a binding MUST HAVE. Outside of includes used to support application logic,
+common external headers used within bindings are:
- *json-c/json.h*: should be include to handle json objects;
- *systemd/sd-event.h*: should be include to access event main loop;
- *systemd/sd-bus.h*: should be include for dbus connections.
-The *tictactoe* plugin does not leverage systemd features, also only json.h
-is used on top of mandatory afb/afb-plugin.h.
+The *tictactoe* binding does not leverage systemd features, also only json.h
+is used on top of mandatory afb/afb-binding.h.
-When including *afb/afb-plugin.h*, the macro **_GNU_SOURCE** MUST be
+When including *afb/afb-binding.h*, the macro **_GNU_SOURCE** MUST be
defined.
Choosing names
--------------
-Designers of plugins should define a unique name for every API plugin
+Designers of bindings should define a unique name for every API binding
as well as for methods VERBs. They should also define names for request
arguments passed as name/value pair in URI.
@@ -223,9 +223,9 @@ ensure that created names are valid and easy to use across platforms.
All names and strings are UTF-8 encoded.
-### Names for API (plugin)
+### Names for API (binding)
-Plugin API name are checked.
+Binding API name are checked.
All characters are authorised except:
- the control characters (\u0000 .. \u001f)
@@ -244,7 +244,7 @@ and upper case when searching for API/VERB.
The names of methods VERBs are totally free and not checked.
However, the validity rules for method's VERB name are the
-same as for Plugin API name except that the dot(.) character
+same as for Binding API name except that the dot(.) character
is forbidden.
Afb-daemon makes no case distinction when searching for an API by name.
@@ -307,7 +307,7 @@ This example shows many aspects of a synchronous
method implementation. Let summarise it:
1. The function **board_of_req** retrieves the context stored
-for the plugin: the board.
+for the binding: the board.
2. The macro **INFO** sends a message of kind *INFO*
to the logging system. The global variable named **afbitf**
@@ -330,7 +330,7 @@ The definition of **struct afb_req** is:
```C
/*
- * Describes the request by plugins from afb-daemon
+ * Describes the request by bindings from afb-daemon
*/
struct afb_req {
const struct afb_req_itf *itf; /* the interfacing functions */
@@ -359,31 +359,31 @@ The second time, to send the reply: an object that describes the current board.
### Associating a client context to a session
-When *tic-tac-toe* plugin receives a request, it musts get
+When *tic-tac-toe* binding receives a request, it musts get
the board describing the game associated to the session.
-For a plugin, having data associated to a session is common.
-This data is called "plugin context" for the session.
-Within *tic-tac-toe* plugin the context is the board.
+For a binding, having data associated to a session is common.
+This data is called "binding context" for the session.
+Within *tic-tac-toe* binding the context is the board.
Requests *afb_req* offer four functions for storing and retrieving session associated context.
These functions are:
- **afb_req_context_get**:
- retrieves context data stored for current plugin.
+ retrieves context data stored for current binding.
- **afb_req_context_set**:
- store context data of current plugin.
+ store context data of current binding.
- **afb_req_context**:
- if exist retrieves context data of current plugin.
+ if exist retrieves context data of current binding.
if context does not yet exist, creates a new context and store it.
- **afb_req_context_clear**:
reset the stored context data.
-The plugin *tictactoe* use a convenient function to retrieve
+The binding *tictactoe* use a convenient function to retrieve
its context: the board. This function is *board_of_req*:
```C
@@ -405,7 +405,7 @@ Here is the definition of the function **afb_req_context**
```C
/*
- * Gets the pointer stored by the plugin for the session of 'req'.
+ * Gets the pointer stored by the binding for the session of 'req'.
* If the stored pointer is NULL, indicating that no pointer was
* already stored, afb_req_context creates a new context by calling
* the function 'create_context' and stores it with the freeing function
@@ -423,12 +423,12 @@ static inline void *afb_req_context(struct afb_req req, void *(*create_context)(
```
The second argument if the function that creates the context.
-For plugin *tic-tac-toe* (function **get_new_board**).
+For binding *tic-tac-toe* (function **get_new_board**).
The function **get_new_board** creates a new board and set usage its count to 1.
The boards are checking usage count to free resources when not used.
The third argument is a function that frees context resources.
-For plugin *tic-tac-toe* (function **release_board**).
+For binding *tic-tac-toe* (function **release_board**).
The function **release_board** decrease usage count of the board passed in argument.
When usage count falls to zero, data board are freed.
@@ -436,20 +436,20 @@ Definition of other functions dealing with contexts:
```C
/*
- * Gets the pointer stored by the plugin for the session of 'req'.
- * When the plugin has not yet recorded a pointer, NULL is returned.
+ * Gets the pointer stored by the binding for the session of 'req'.
+ * When the binding has not yet recorded a pointer, NULL is returned.
*/
void *afb_req_context_get(struct afb_req req);
/*
- * Stores for the plugin the pointer 'context' to the session of 'req'.
+ * Stores for the binding the pointer 'context' to the session of 'req'.
* The function 'free_context' will be called when the session is closed
- * or if plugin stores an other pointer.
+ * or if binding stores an other pointer.
*/
void afb_req_context_set(struct afb_req req, void *context, void (*free_context)(void*));
/*
- * Frees the pointer stored by the plugin for the session of 'req'
+ * Frees the pointer stored by the binding for the session of 'req'
* and sets it to NULL.
*
* Shortcut for: afb_req_context_set(req, NULL, NULL)
@@ -529,13 +529,13 @@ void afb_req_fail_f(struct afb_req req, const char *status, const char *info, ..
Getting argument of invocation
------------------------------
-Many methods expect arguments. Afb-daemon's plugins
+Many methods expect arguments. Afb-daemon's bindings
retrieve arguments by name and not by position.
Arguments are passed by requests through either HTTP
or WebSockets.
-For example, the method **join** of plugin **tic-tac-toe**
+For example, the method **join** of binding **tic-tac-toe**
expects one argument: the *boardid* to join. Here is an extract:
```C
@@ -676,14 +676,14 @@ The path is the effective path of saved file on the temporary local storage
area of the application. This is a randomly generated and unique filename.
It is not linked with the original filename as used on client side.
-After success the plugin can use the uploaded file directly from local storage path with no restriction:
+After success the binding can use the uploaded file directly from local storage path with no restriction:
read, write, remove, copy, rename...
Nevertheless when request reply is set and query terminated, the uploaded temporary file at
path is destroyed.
### Arguments as a JSON object
-Plugins may also request every arguments of a given call as one single object.
+Bindings may also request every arguments of a given call as one single object.
This feature is provided by the function **afb_req_json** defined here after:
```C
@@ -705,54 +705,54 @@ Values are either string for common arguments or object ie: { "file": "...", "pa
> can be seen as a shortcut to
> ***json_object_get_string(json_object_object_get(afb_req_json(req), name))***
-Initialisation of the plugin and declaration of methods
+Initialisation of the binding and declaration of methods
-----------------------------------------------------
-To be active, plugin's methods should be declared to
-afb-daemon. Furthermore, the plugin itself must be recorded.
+To be active, binding's methods should be declared to
+afb-daemon. Furthermore, the binding itself must be recorded.
The registration mechanism is very basic: when afb-need starts,
-it loads all plugins listed in: command line or configuration file.
+it loads all bindings listed in: command line or configuration file.
-Loading a plugin follows the following steps:
+Loading a binding follows the following steps:
-1. Afb-daemon loads the plugin with *dlopen*.
+1. Afb-daemon loads the binding with *dlopen*.
-2. Afb-daemon searches for a symbol named **pluginAfbV1Register** using *dlsym*.
-This symbol is assumed to be the exported initialisation function of the plugin.
+2. Afb-daemon searches for a symbol named **afbBindingV1Register** using *dlsym*.
+This symbol is assumed to be the exported initialisation function of the binding.
-3. Afb-daemon builds an interface object for the plugin.
+3. Afb-daemon builds an interface object for the binding.
-4. Afb-daemon calls the found function **pluginAfbV1Register** with interface pointer
+4. Afb-daemon calls the found function **afbBindingV1Register** with interface pointer
as parameter.
-5. Function **pluginAfbV1Register** setups the plugin and initialises it.
+5. Function **afbBindingV1Register** setups the binding and initialises it.
-6. Function **pluginAfbV1Register** returns the pointer to a structure
-describing the plugin: version, name (prefix or API name), and list of methods.
+6. Function **afbBindingV1Register** returns the pointer to a structure
+describing the binding: version, name (prefix or API name), and list of methods.
7. Afb-daemon checks that the returned version and name can be managed.
-If so, plugin and its methods are register to become usable as soon as
+If so, binding and its methods are register to become usable as soon as
afb-daemon initialisation is finished.
-Here after the code used for **pluginAfbV1Register** from plugin *tic-tac-toe*:
+Here after the code used for **afbBindingV1Register** from binding *tic-tac-toe*:
```C
/*
- * activation function for registering the plugin called by afb-daemon
+ * activation function for registering the binding called by afb-daemon
*/
-const struct AFB_plugin *pluginAfbV1Register(const struct AFB_interface *itf)
+const struct afb_binding *afbBindingV1Register(const struct afb_binding_interface *itf)
{
afbitf = itf; // records the interface for accessing afb-daemon
- return &plugin_description; // returns the description of the plugin
+ return &binding_description; // returns the description of the binding
}
```
-It is a very minimal initialisation function because *tic-tac-toe* plugin doesn't
+It is a very minimal initialisation function because *tic-tac-toe* binding doesn't
have any application related initialisation step. It merely record daemon's interface
and returns its description.
-The variable **afbitf** is a plugin global variable. It keeps the
+The variable **afbitf** is a binding global variable. It keeps the
interface to afb-daemon that should be used for logging and pushing events.
Here is its declaration:
@@ -760,16 +760,16 @@ Here is its declaration:
/*
* the interface to afb-daemon
*/
-const struct AFB_interface *afbitf;
+const struct afb_binding_interface *afbitf;
```
-The description of the plugin is defined here after.
+The description of the binding is defined here after.
```C
/*
* array of the methods exported to afb-daemon
*/
-static const struct AFB_method_desc_v1 plugin_methods[] = {
+static const struct afb_verb_desc_v1 binding_methods[] = {
/* VERB'S NAME SESSION MANAGEMENT FUNCTION TO CALL SHORT DESCRIPTION */
{ .name= "new", .session= AFB_SESSION_NONE, .callback= new, .info= "Starts a new game" },
{ .name= "play", .session= AFB_SESSION_NONE, .callback= play, .info= "Asks the server to play" },
@@ -783,27 +783,27 @@ static const struct AFB_method_desc_v1 plugin_methods[] = {
};
/*
- * description of the plugin for afb-daemon
+ * description of the binding for afb-daemon
*/
-static const struct AFB_plugin plugin_description =
+static const struct afb_binding binding_description =
{
/* description conforms to VERSION 1 */
- .type= AFB_PLUGIN_VERSION_1,
- .v1= { /* fills the v1 field of the union when AFB_PLUGIN_VERSION_1 */
- .prefix= "tictactoe", /* the API name (or plugin name or prefix) */
- .info= "Sample tac-tac-toe game", /* short description of of the plugin */
- .methods = plugin_methods /* the array describing the methods of the API */
+ .type= AFB_BINDING_VERSION_1,
+ .v1= { /* fills the v1 field of the union when AFB_BINDING_VERSION_1 */
+ .prefix= "tictactoe", /* the API name (or binding name or prefix) */
+ .info= "Sample tac-tac-toe game", /* short description of of the binding */
+ .methods = binding_methods /* the array describing the methods of the API */
}
};
```
-The structure **plugin_description** describes the plugin.
-It declares the type and version of the plugin, its name, a short description
+The structure **binding_description** describes the binding.
+It declares the type and version of the binding, its name, a short description
and its methods list.
The list of methods is an array of structures describing the methods and terminated by a NULL marker.
-In version one of afb-damon plugin, a method description contains 4 fields:
+In version one of afb-damon binding, a method description contains 4 fields:
- the name of the method,
@@ -817,10 +817,10 @@ The structure describing methods is defined as follows:
```C
/*
- * Description of one method of the API provided by the plugin
- * This enumeration is valid for plugins of type 1
+ * Description of one method of the API provided by the binding
+ * This enumeration is valid for bindings of type 1
*/
-struct AFB_method_desc_v1
+struct afb_verb_desc_v1
{
const char *name; /* name of the method */
enum AFB_session_v1 session; /* authorisation and session requirements of the method */
@@ -867,7 +867,7 @@ Sending messages to the log system
Afb-daemon provides 4 levels of verbosity and 5 methods for logging messages.
The verbosity is managed. Options allow the change the verbosity of afb-daemon
-and the verbosity of the plugins can be set plugin by plugin.
+and the verbosity of the bindings can be set binding by binding.
The methods for logging messages are defined as macros that test the
verbosity level and that call the real logging function only if the
@@ -893,11 +893,11 @@ they are output with a different level on the logging system.
All of these methods have the same signature:
```C
-void ERROR(const struct AFB_interface *afbitf, const char *message, ...);
+void ERROR(const struct afb_binding_interface *afbitf, const char *message, ...);
```
The first argument **afbitf** is the interface to afb daemon that the
-plugin received at initialisation time when **pluginAfbV1Register** is called.
+binding received at initialisation time when **afbBindingV1Register** is called.
The second argument **message** is a formatting string compatible with printf/sprintf.
@@ -941,11 +941,11 @@ journal, syslog or kmsg. (See man sd-daemon).
Sending events
--------------
-Since version 0.5, plugins can broadcast events to any potential listener.
+Since version 0.5, bindings can broadcast events to any potential listener.
As today only unattended even are supported. Targeted events are expected for next
coming version.
-The plugin *tic-tac-toe* broadcasts events when the board changes.
+The binding *tic-tac-toe* broadcasts events when the board changes.
This is done in the function **changed**:
```C
@@ -968,7 +968,7 @@ static void changed(struct board *board, const char *reason)
The description of the changed board is pushed via the daemon interface.
-Within plugin *tic-tac-toe*, *reason* indicates the origin of
+Within binding *tic-tac-toe*, *reason* indicates the origin of
the change. In function **afb_daemon_broadcast_event** the second
parameter is the name of broadcasted event. The third argument is the
object that is transmitted with the event.
@@ -979,7 +979,7 @@ Function **afb_daemon_broadcast_event** is defined here after:
/*
* Broadcasts widely the event of 'name' with the data 'object'.
* 'object' can be NULL.
- * 'daemon' MUST be the daemon given in interface when activating the plugin.
+ * 'daemon' MUST be the daemon given in interface when activating the binding.
*
* For conveniency, the function calls 'json_object_put' for 'object'.
* Thus, in the case where 'object' should remain available after
@@ -993,12 +993,12 @@ void afb_daemon_broadcast_event(struct afb_daemon daemon, const char *name, stru
> calling **afb_daemon_broadcast_event** to keep **object** available
> after function returns.
-Event name received by listeners is prefixed with plugin name.
+Event name received by listeners is prefixed with binding name.
So when a change occurs after a move, the reason is **move** and every clients
receive an event **tictactoe/move**.
> Note that nothing is said about case sensitivity of event names.
-> However, the event is always prefixed with the name that the plugin
+> However, the event is always prefixed with the name that the binding
> declared, with the same case, followed with a slash /.
> Thus it is safe to compare event using a case sensitive comparison.
@@ -1031,7 +1031,7 @@ See the diagram below:
| | | .
|<-------------|------------------+ success of wait <
-Here, this is an invocation of the plugin by an other client that
+Here, this is an invocation of the binding by an other client that
unblock the suspended *wait* call.
Nevertheless in most case this should be a timer, a hardware event, a sync with
a concurrent process or thread, ...
@@ -1108,13 +1108,13 @@ is decremented using **afb_req_unref** to allow resources to be freed.
> This usage count decrement should happen **AFTER** setting reply or
> bad things may happen.
-How to build a plugin
+How to build a binding
---------------------
Afb-daemon provides a *pkg-config* configuration file that can be
queried by providing **afb-daemon** in command line arguments.
This configuration file provides data that should be used
-for plugins compilation. Examples:
+for bindings compilation. Examples:
```bash
$ pkg-config --cflags afb-daemon
@@ -1123,23 +1123,23 @@ $ pkg-config --libs afb-daemon
### Example for cmake meta build system
-This example is the extract for building the plugin *afm-main* using *CMAKE*.
+This example is the extract for building the binding *afm-main* using *CMAKE*.
```cmake
pkg_check_modules(afb afb-daemon)
if(afb_FOUND)
- message(STATUS "Creation afm-main-plugin for AFB-DAEMON")
- add_library(afm-main-plugin MODULE afm-main-plugin.c)
- target_compile_options(afm-main-plugin PRIVATE ${afb_CFLAGS})
- target_include_directories(afm-main-plugin PRIVATE ${afb_INCLUDE_DIRS})
- target_link_libraries(afm-main-plugin utils ${afb_LIBRARIES})
- set_target_properties(afm-main-plugin PROPERTIES
+ message(STATUS "Creation afm-main-binding for AFB-DAEMON")
+ add_library(afm-main-binding MODULE afm-main-binding.c)
+ target_compile_options(afm-main-binding PRIVATE ${afb_CFLAGS})
+ target_include_directories(afm-main-binding PRIVATE ${afb_INCLUDE_DIRS})
+ target_link_libraries(afm-main-binding utils ${afb_LIBRARIES})
+ set_target_properties(afm-main-binding PROPERTIES
PREFIX ""
- LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/afm-main-plugin.export-map"
+ LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/afm-main-binding.export-map"
)
- install(TARGETS afm-main-plugin LIBRARY DESTINATION ${plugin_dir})
+ install(TARGETS afm-main-binding LIBRARY DESTINATION ${binding_dir})
else()
- message(STATUS "Not creating the plugin for AFB-DAEMON")
+ message(STATUS "Not creating the binding for AFB-DAEMON")
endif()
```
@@ -1154,64 +1154,64 @@ This first lines searches to the *pkg-config* configuration file for
Variable | Meaning
------------------|------------------------------------------------
-afb_FOUND | Set to 1 if afb-daemon plugin development files exist
-afb_LIBRARIES | Only the libraries (w/o the '-l') for compiling afb-daemon plugins
-afb_LIBRARY_DIRS | The paths of the libraries (w/o the '-L') for compiling afb-daemon plugins
-afb_LDFLAGS | All required linker flags for compiling afb-daemon plugins
-afb_INCLUDE_DIRS | The '-I' preprocessor flags (w/o the '-I') for compiling afb-daemon plugins
-afb_CFLAGS | All required cflags for compiling afb-daemon plugins
-
-If development files are found, the plugin can be added to the set of
+afb_FOUND | Set to 1 if afb-daemon binding development files exist
+afb_LIBRARIES | Only the libraries (w/o the '-l') for compiling afb-daemon bindings
+afb_LIBRARY_DIRS | The paths of the libraries (w/o the '-L') for compiling afb-daemon bindings
+afb_LDFLAGS | All required linker flags for compiling afb-daemon bindings
+afb_INCLUDE_DIRS | The '-I' preprocessor flags (w/o the '-I') for compiling afb-daemon bindings
+afb_CFLAGS | All required cflags for compiling afb-daemon bindings
+
+If development files are found, the binding can be added to the set of
target to build.
```cmake
-add_library(afm-main-plugin MODULE afm-main-plugin.c)
+add_library(afm-main-binding MODULE afm-main-binding.c)
```
This line asks to create a shared library having a single
-source file named afm-main-plugin.c to be compiled.
+source file named afm-main-binding.c to be compiled.
The default name of the created shared object is
-**libafm-main-plugin.so**.
+**libafm-main-binding.so**.
```cmake
-set_target_properties(afm-main-plugin PROPERTIES
+set_target_properties(afm-main-binding PROPERTIES
PREFIX ""
- LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/afm-main-plugin.export-map"
+ LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/afm-main-binding.export-map"
)
```
This lines are doing two things:
-1. It renames the built library from **libafm-main-plugin.so** to **afm-main-plugin.so**
+1. It renames the built library from **libafm-main-binding.so** to **afm-main-binding.so**
by removing the implicitly added prefix *lib*. This step is not mandatory
because afb-daemon doesn't check names of files at load time.
The only filename convention used by afb-daemon relates to **.so** termination.
-*.so pattern is used when afb-daemon automatically discovers plugin from a directory hierarchy.
+*.so pattern is used when afb-daemon automatically discovers binding from a directory hierarchy.
2. It applies a version script at link time to only export the reserved name
-**pluginAfbV1Register** for registration entry point. By default, when building
+**afbBindingV1Register** for registration entry point. By default, when building
a shared library linker exports all the public symbols (C functions that are not **static**).
Next line are:
```cmake
-target_include_directories(afm-main-plugin PRIVATE ${afb_INCLUDE_DIRS})
-target_link_libraries(afm-main-plugin utils ${afb_LIBRARIES})
+target_include_directories(afm-main-binding PRIVATE ${afb_INCLUDE_DIRS})
+target_link_libraries(afm-main-binding utils ${afb_LIBRARIES})
```
As you can see it uses the variables computed by ***pkg_check_modules(afb afb-daemon)***
to configure the compiler and the linker.
-### Exporting the function pluginAfbV1Register
+### Exporting the function afbBindingV1Register
-The function **pluginAfbV1Register** MUST be exported. This can be achieved
+The function **afbBindingV1Register** MUST be exported. This can be achieved
using a version script at link time. Here after is a version script used for
-*tic-tac-toe* (plugins/samples/export.map).
+*tic-tac-toe* (bindings/samples/export.map).
- { global: pluginAfbV1Register; local: *; };
+ { global: afbBindingV1Register; local: *; };
This sample [version script](https://sourceware.org/binutils/docs-2.26/ld/VERSION.html#VERSION)
-exports as global the symbol *pluginAfbV1Register* and hides any
+exports as global the symbol *afbBindingV1Register* and hides any
other symbols.
This version script is added to the link options using the
diff --git a/doc/afb-daemon-vocabulary.html b/doc/afb-daemon-vocabulary.html
index d2d4f512..bffe91f6 100644
--- a/doc/afb-daemon-vocabulary.html
+++ b/doc/afb-daemon-vocabulary.html
@@ -16,11 +16,12 @@
<header>
<h1 class="title">Vocabulary for AFB-DAEMON</h1>
<h2 class="author">José Bollo</h2>
-<h3 class="date">27 mai 2016</h3>
+<h3 class="date">23 juin 2016</h3>
</header>
<nav id="TOC">
<ul>
<li><a href="#vocabulary-for-afb-daemon">Vocabulary for AFB-DAEMON</a><ul>
+<li><a href="#binding">Binding</a></li>
<li><a href="#event">Event</a></li>
<li><a href="#level-of-assurance-loa">Level of assurance (LOA)</a></li>
<li><a href="#plugin">Plugin</a></li>
@@ -40,6 +41,9 @@
<pre><code>version: 1
Date: 27 mai 2016
Author: José Bollo</code></pre>
+<h2 id="binding">Binding</h2>
+<p>A shared library object intended to be add a functionnality to an afb-daemon instance. It implements an API. It may provide a service.</p>
+<p>Binding made for services can have specific entry point called after initialisation and before serving.</p>
<h2 id="event">Event</h2>
<p>Message with data propagated from the services to the client and not expecting any reply.</p>
<p>The current implementation allows to widely broadcast events to all clients.</p>
@@ -47,14 +51,14 @@ Author: José Bollo</code></pre>
<p>This level that can be from 0 to 3 represent the level of assurance that the services can expect from the session.</p>
<p>The exact definition of the meaning of this levels and of how to use it remains to be achived.</p>
<h2 id="plugin">Plugin</h2>
-<p>A shared library object intended to be plug to an afb-daemon instance to implement an API.</p>
+<p>Old name for binding, see binding.</p>
<h2 id="request">Request</h2>
-<p>A request is an invocation by a client to a method of a plugin using a message transfered through some protocol: HTTP, WebSocket, DBUS... served by afb-daemon</p>
+<p>A request is an invocation by a client to a method of a binding using a message transfered through some protocol: HTTP, WebSocket, DBUS... served by afb-daemon</p>
<h2 id="replyresponse">Reply/Response</h2>
<p>This is a message sent to client as the result of the request.</p>
<h2 id="service">Service</h2>
-<p>Service are made of plugins runnning by their side on their binder. It can serve many client. Each one being attached to one session.</p>
-<p>The framework establishes the connection between the services and the clients. Using DBus currently.</p>
+<p>Service are made of binding runnning by their side on their binder. It can serve many client. Each one being attached to one session.</p>
+<p>The framework establishes the connection between the services and the clients. Using DBus currently but other protocols are considered.</p>
<h2 id="session">Session</h2>
<p>A session is meant to be the unic context of an instance of client, identifying that instance across requests.</p>
<p>Each session has an identifier. Session identifier generated by afb-daemon are UUIDs.</p>
diff --git a/doc/afb-daemon-vocabulary.md b/doc/afb-daemon-vocabulary.md
index 83472d51..0be4e3db 100644
--- a/doc/afb-daemon-vocabulary.md
+++ b/doc/afb-daemon-vocabulary.md
@@ -5,6 +5,13 @@ Vocabulary for AFB-DAEMON
Author: José Bollo
+## Binding
+
+A shared library object intended to be add a functionnality to an afb-daemon
+instance. It implements an API. It may provide a service.
+
+Binding made for services can have specific entry point called after
+initialisation and before serving.
## Event
@@ -23,12 +30,11 @@ how to use it remains to be achived.
## Plugin
-A shared library object intended to be plug to an afb-daemon instance
-to implement an API.
+Old name for binding, see binding.
## Request
-A request is an invocation by a client to a method of a plugin using a message
+A request is an invocation by a client to a method of a binding using a message
transfered through some protocol: HTTP, WebSocket, DBUS... served by afb-daemon
## Reply/Response
@@ -37,11 +43,11 @@ This is a message sent to client as the result of the request.
## Service
-Service are made of plugins runnning by their side on their binder.
+Service are made of binding runnning by their side on their binder.
It can serve many client. Each one being attached to one session.
The framework establishes the connection between the services and
-the clients. Using DBus currently.
+the clients. Using DBus currently but other protocols are considered.
## Session
diff --git a/doc/afb-overview.html b/doc/afb-overview.html
index e8050f9a..23ca6e9c 100644
--- a/doc/afb-overview.html
+++ b/doc/afb-overview.html
@@ -16,7 +16,7 @@
<header>
<h1 class="title">Overview of AFB-DAEMON</h1>
<h2 class="author">José Bollo</h2>
-<h3 class="date">30 mai 2016</h3>
+<h3 class="date">23 juin 2016</h3>
</header>
<nav id="TOC">
<ul>
@@ -27,7 +27,7 @@
<li><a href="#adding-native-features-to-html5qml-applications">Adding native features to HTML5/QML applications</a></li>
<li><a href="#offering-services-to-the-system">Offering services to the system</a></li>
</ul></li>
-<li><a href="#the-plugins-of-the-binder-afb-daemon">The plugins of the binder afb-daemon</a></li>
+<li><a href="#the-bindings-of-the-binder-afb-daemon">The bindings of the binder afb-daemon</a></li>
<li><a href="#launching-the-binder-afb-daemon">Launching the binder afb-daemon</a></li>
<li><a href="#future-development-of-afb-daemon">Future development of afb-daemon</a></li>
</ul></li>
@@ -59,7 +59,7 @@ Figure: binder afb-daemon, basis
. +-------------------+----------------------+ .
. | : | .
. | b i n d e r : | .
-. | A F B - D A E M O N : PLUGINS | .
+. | A F B - D A E M O N : BINDINGS | .
. | : | .
. +-------------------+----------------------+ .
. | .
@@ -106,7 +106,7 @@ Figure: binder afb-daemon and remotely running application
. | .
. +-------------------+----------------------+ .
. | : | .
-. | A F B - D A E M O N : PLUGINS | .
+. | A F B - D A E M O N : BINDINGS | .
. | : | .
. +-------------------+----------------------+ .
. | .
@@ -115,9 +115,9 @@ Figure: binder afb-daemon and remotely running application
v
AGL SYSTEM</code></pre>
<h3 id="adding-native-features-to-html5qml-applications">Adding native features to HTML5/QML applications</h3>
-<p>Applications can provide with their packaged delivery a plugin. That plugin will be instanciated for each application instance. The methods of the plugin will be accessible by applications and will be excuted within the security context.</p>
+<p>Applications can provide with their packaged delivery a binding. That binding will be instanciated for each application instance. The methods of the binding will be accessible by applications and will be excuted within the security context.</p>
<h3 id="offering-services-to-the-system">Offering services to the system</h3>
-<p>It is possible to run the binder afb-daemon as a daemon that provides the API of its plugins.</p>
+<p>It is possible to run the binder afb-daemon as a daemon that provides the API of its bindings.</p>
<p>This will be used for:</p>
<ol type="1">
<li><p>offering common APIs</p></li>
@@ -142,7 +142,7 @@ Figure: binder afb-daemon for services
. +-----------------+------------------+ . . +------------------------------------+ .
. | : | . . | : | .
. | b i n d e r : | . . | b i n d e r : service | .
-. | A F B - D A E M O N : PLUGINS | . . | A F B - D A E M O N : PLUGINS | .
+. | A F B - D A E M O N : BINDINGS | . . | A F B - D A E M O N : BINDINGS | .
. | : | . . | : A | .
. +-----------------+------------------+ . . +-----------------+------------------+ .
. | . . | .
@@ -159,22 +159,22 @@ Figure: binder afb-daemon for services
. +-----------------+------------------+ . . +-----------------+------------------+ .
. | : | . . | : | .
. | b i n d e r : service | . . | b i n d e r : service | .
-. | A F B - D A E M O N : PLUGINS | . . | A F B - D A E M O N : PLUGINS | .
+. | A F B - D A E M O N : BINDINGS | . . | A F B - D A E M O N : BINDINGS | .
. | : B | . . | : C | .
. +------------------------------------+ . . +------------------------------------+ .
. . . .
. Isolated security context B . . Isolated security context C .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .</code></pre>
-<p>For this case, the binder afb-daemon takes care to attribute one single session context to each client instance. It allows plugins to store and retrieve data associated to each of its client.</p>
-<h2 id="the-plugins-of-the-binder-afb-daemon">The plugins of the binder afb-daemon</h2>
-<p>The binder can instanciate plugins. The primary use of plugins is to add native methods that can be accessed by applications written with any language through web technologies ala JSON RPC.</p>
+<p>For this case, the binder afb-daemon takes care to attribute one single session context to each client instance. It allows bindings to store and retrieve data associated to each of its client.</p>
+<h2 id="the-bindings-of-the-binder-afb-daemon">The bindings of the binder afb-daemon</h2>
+<p>The binder can instanciate bindings. The primary use of bindings is to add native methods that can be accessed by applications written with any language through web technologies ala JSON RPC.</p>
<p>This simple idea is declined to serves multiple purposes:</p>
<ol type="1">
<li><p>add native feature to applications</p></li>
<li><p>add common API available by any applications</p></li>
<li><p>provide customers services</p></li>
</ol>
-<p>A specific document explains how to write an afb-daemon binder plugin: <a href="afb-plugin-writing.html">HOWTO WRITE a PLUGIN for AFB-DAEMON</a></p>
+<p>A specific document explains how to write an afb-daemon binder binding: <a href="afb-binding-writing.html">HOWTO WRITE a BINDING for AFB-DAEMON</a></p>
<h2 id="launching-the-binder-afb-daemon">Launching the binder afb-daemon</h2>
<p>The launch options for binder <strong>afb-daemon</strong> are:</p>
<pre><code> --help
@@ -209,7 +209,7 @@ Figure: binder afb-daemon for services
HTML Root API URL [default /api]
- The plugins are available within that url.
+ The bindings are available within that url.
--alias=xxxx
@@ -224,7 +224,7 @@ Figure: binder afb-daemon for services
--apitimeout=xxxx
- Plugin API timeout in seconds [default 20]
+ binding API timeout in seconds [default 20]
Defines how many seconds maximum a method is allowed to run.
0 means no limit.
@@ -247,19 +247,19 @@ Figure: binder afb-daemon for services
--ldpaths=xxxx
- Load Plugins from given paths separated by colons
- as for dir1:dir2:plugin1.so:... [default = $libdir/afb]
+ Load bindings from given paths separated by colons
+ as for dir1:dir2:binding1.so:... [default = $libdir/afb]
- You can mix path to directories and to plugins.
+ You can mix path to directories and to bindings.
The sub-directories of the given directories are searched
recursively.
- The plugins are the files terminated by &#39;.so&#39; (the extension
+ The bindings are the files terminated by &#39;.so&#39; (the extension
so denotes shared object) that contain the public entry symbol.
- --plugin=xxxx
+ --binding=xxxx
- Load the plugin of given path.
+ Load the binding of given path.
--token=xxxx
@@ -294,7 +294,7 @@ Figure: binder afb-daemon for services
Provides a binder afb-daemon service through dbus.
- The name xxxx must be the name of an API defined by a plugin.
+ The name xxxx must be the name of an API defined by a binding.
This API is exported through DBUS.
--foreground
diff --git a/doc/afb-overview.md b/doc/afb-overview.md
index 1bd83240..ab24606c 100644
--- a/doc/afb-overview.md
+++ b/doc/afb-overview.md
@@ -34,7 +34,7 @@ of afb-daemon:
. +-------------------+----------------------+ .
. | : | .
. | b i n d e r : | .
- . | A F B - D A E M O N : PLUGINS | .
+ . | A F B - D A E M O N : BINDINGS | .
. | : | .
. +-------------------+----------------------+ .
. | .
@@ -97,7 +97,7 @@ when the application is run remotely:
. | .
. +-------------------+----------------------+ .
. | : | .
- . | A F B - D A E M O N : PLUGINS | .
+ . | A F B - D A E M O N : BINDINGS | .
. | : | .
. +-------------------+----------------------+ .
. | .
@@ -108,15 +108,15 @@ when the application is run remotely:
### Adding native features to HTML5/QML applications
-Applications can provide with their packaged delivery a plugin.
-That plugin will be instanciated for each application instance.
-The methods of the plugin will be accessible by applications and
+Applications can provide with their packaged delivery a binding.
+That binding will be instanciated for each application instance.
+The methods of the binding will be accessible by applications and
will be excuted within the security context.
### Offering services to the system
It is possible to run the binder afb-daemon as a daemon that provides the
-API of its plugins.
+API of its bindings.
This will be used for:
@@ -141,7 +141,7 @@ In that case, the figure showing the whole aspects is
. +-----------------+------------------+ . . +------------------------------------+ .
. | : | . . | : | .
. | b i n d e r : | . . | b i n d e r : service | .
- . | A F B - D A E M O N : PLUGINS | . . | A F B - D A E M O N : PLUGINS | .
+ . | A F B - D A E M O N : BINDINGS | . . | A F B - D A E M O N : BINDINGS | .
. | : | . . | : A | .
. +-----------------+------------------+ . . +-----------------+------------------+ .
. | . . | .
@@ -158,7 +158,7 @@ In that case, the figure showing the whole aspects is
. +-----------------+------------------+ . . +-----------------+------------------+ .
. | : | . . | : | .
. | b i n d e r : service | . . | b i n d e r : service | .
- . | A F B - D A E M O N : PLUGINS | . . | A F B - D A E M O N : PLUGINS | .
+ . | A F B - D A E M O N : BINDINGS | . . | A F B - D A E M O N : BINDINGS | .
. | : B | . . | : C | .
. +------------------------------------+ . . +------------------------------------+ .
. . . .
@@ -167,13 +167,13 @@ In that case, the figure showing the whole aspects is
For this case, the binder afb-daemon takes care to attribute one single session
-context to each client instance. It allows plugins to store and retrieve data
+context to each client instance. It allows bindings to store and retrieve data
associated to each of its client.
-The plugins of the binder afb-daemon
+The bindings of the binder afb-daemon
------------------------------------
-The binder can instanciate plugins. The primary use of plugins
+The binder can instanciate bindings. The primary use of bindings
is to add native methods that can be accessed by applications
written with any language through web technologies ala JSON RPC.
@@ -185,8 +185,8 @@ This simple idea is declined to serves multiple purposes:
3. provide customers services
-A specific document explains how to write an afb-daemon binder plugin:
-[HOWTO WRITE a PLUGIN for AFB-DAEMON](afb-plugin-writing.html)
+A specific document explains how to write an afb-daemon binder binding:
+[HOWTO WRITE a BINDING for AFB-DAEMON](afb-binding-writing.html)
Launching the binder afb-daemon
@@ -226,7 +226,7 @@ The launch options for binder **afb-daemon** are:
HTML Root API URL [default /api]
- The plugins are available within that url.
+ The bindings are available within that url.
--alias=xxxx
@@ -241,7 +241,7 @@ The launch options for binder **afb-daemon** are:
--apitimeout=xxxx
- Plugin API timeout in seconds [default 20]
+ binding API timeout in seconds [default 20]
Defines how many seconds maximum a method is allowed to run.
0 means no limit.
@@ -264,19 +264,19 @@ The launch options for binder **afb-daemon** are:
--ldpaths=xxxx
- Load Plugins from given paths separated by colons
- as for dir1:dir2:plugin1.so:... [default = $libdir/afb]
+ Load bindings from given paths separated by colons
+ as for dir1:dir2:binding1.so:... [default = $libdir/afb]
- You can mix path to directories and to plugins.
+ You can mix path to directories and to bindings.
The sub-directories of the given directories are searched
recursively.
- The plugins are the files terminated by '.so' (the extension
+ The bindings are the files terminated by '.so' (the extension
so denotes shared object) that contain the public entry symbol.
- --plugin=xxxx
+ --binding=xxxx
- Load the plugin of given path.
+ Load the binding of given path.
--token=xxxx
@@ -311,7 +311,7 @@ The launch options for binder **afb-daemon** are:
Provides a binder afb-daemon service through dbus.
- The name xxxx must be the name of an API defined by a plugin.
+ The name xxxx must be the name of an API defined by a binding.
This API is exported through DBUS.
--foreground
diff --git a/doc/afb-tests-overview.html b/doc/afb-tests-overview.html
index e9711c4e..b29c1920 100644
--- a/doc/afb-tests-overview.html
+++ b/doc/afb-tests-overview.html
@@ -18,7 +18,7 @@
<h1 class="title">Overview of tests shipped with AFB-Daemon</h1>
<h2 class="author">Manuel Bachmann</h2>
<h2 class="author">José Bollo</h2>
-<h3 class="date">09 juin 2016</h3>
+<h3 class="date">23 juin 2016</h3>
</header>
<nav id="TOC">
<ul>
@@ -45,12 +45,12 @@ Author: Manuel Bachmann</code></pre>
</ul>
<h2 id="detail-of-tests">Detail of tests</h2>
<h3 id="afb-client-demo-command-line-websockets">afb-client-demo (command-line WebSockets)</h3>
-<p>This clients interactively calls plugins APIs from the command line, using the binder <a href="https://en.wikipedia.org/wiki/WebSocket">WebSockets</a> facility.</p>
+<p>This clients interactively calls bindings APIs from the command line, using the binder <a href="https://en.wikipedia.org/wiki/WebSocket">WebSockets</a> facility.</p>
<p>If <em>afb-daemon</em> has been launched with the following parameters:</p>
<pre><code>$ afb-daemon --port=1234 --token=123456 [...]</code></pre>
<p>Then run the client with :</p>
<pre><code>afb-client-demo ws://localhost:1234/api?token=123456 [&lt;api&gt; &lt;verb&gt; [&lt;json-data&gt;]]</code></pre>
-<p>For instance, to initialize the Audio plugin from the command line :</p>
+<p>For instance, to initialize the Audio binding from the command line :</p>
<pre><code>afb-client-demo ws://localhost:1234/api?token=123456</code></pre>
<p>The command doesn't return. You should type requests of type <api> <verb> [<json-data>]. So, try:</p>
<pre><code>auth connect
diff --git a/doc/afb-tests-overview.md b/doc/afb-tests-overview.md
index 6bb1b8a9..4fc0c9b2 100644
--- a/doc/afb-tests-overview.md
+++ b/doc/afb-tests-overview.md
@@ -22,7 +22,7 @@ Detail of tests
### afb-client-demo (command-line WebSockets)
-This clients interactively calls plugins APIs from the command line, using the binder
+This clients interactively calls bindings APIs from the command line, using the binder
[WebSockets](https://en.wikipedia.org/wiki/WebSocket) facility.
If _afb-daemon_ has been launched with the following parameters:
@@ -35,7 +35,7 @@ Then run the client with :
afb-client-demo ws://localhost:1234/api?token=123456 [<api> <verb> [<json-data>]]
-For instance, to initialize the Audio plugin from the command line :
+For instance, to initialize the Audio binding from the command line :
afb-client-demo ws://localhost:1234/api?token=123456