summaryrefslogtreecommitdiffstats
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
parentef908d903929988ad01f9df94415fc9c3ddebcac (diff)
vocabulary: moving from 'plugin' to 'binding'
Change-Id: Ic9e118df2bede1fefbb591f8ae7887266b7324ca Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--CMakeLists.txt4
-rw-r--r--afb-daemon.pc.in2
-rw-r--r--bindings/CMakeLists.txt (renamed from plugins/CMakeLists.txt)0
-rw-r--r--bindings/audio/CMakeLists.txt (renamed from plugins/audio/CMakeLists.txt)6
-rw-r--r--bindings/audio/audio-alsa.c (renamed from plugins/audio/audio-alsa.c)0
-rw-r--r--bindings/audio/audio-alsa.h (renamed from plugins/audio/audio-alsa.h)0
-rw-r--r--bindings/audio/audio-api.c (renamed from plugins/audio/audio-api.c)0
-rw-r--r--bindings/audio/audio-api.h (renamed from plugins/audio/audio-api.h)0
-rw-r--r--bindings/audio/audio-pulse.c (renamed from plugins/audio/audio-pulse.c)0
-rw-r--r--bindings/audio/audio-pulse.h (renamed from plugins/audio/audio-pulse.h)0
-rw-r--r--bindings/audio/export.map1
-rw-r--r--bindings/intrinsics/CMakeLists.txt (renamed from plugins/intrinsics/CMakeLists.txt)2
-rw-r--r--bindings/intrinsics/afb-dbus-binding.c (renamed from plugins/intrinsics/afb-dbus-binding.c)28
-rw-r--r--bindings/intrinsics/export.map1
-rw-r--r--bindings/media/CMakeLists.txt (renamed from plugins/media/CMakeLists.txt)4
-rw-r--r--bindings/media/export.map1
-rw-r--r--bindings/media/media-api.c (renamed from plugins/media/media-api.c)0
-rw-r--r--bindings/media/media-api.h (renamed from plugins/media/media-api.h)0
-rw-r--r--bindings/media/media-rygel.c (renamed from plugins/media/media-rygel.c)0
-rw-r--r--bindings/media/media-rygel.h (renamed from plugins/media/media-rygel.h)0
-rw-r--r--bindings/radio/CMakeLists.txt (renamed from plugins/radio/CMakeLists.txt)4
-rw-r--r--bindings/radio/export.map1
-rw-r--r--bindings/radio/radio-api.c (renamed from plugins/radio/radio-api.c)0
-rw-r--r--bindings/radio/radio-api.h (renamed from plugins/radio/radio-api.h)0
-rw-r--r--bindings/radio/radio-rtlsdr.c (renamed from plugins/radio/radio-rtlsdr.c)0
-rw-r--r--bindings/radio/radio-rtlsdr.h (renamed from plugins/radio/radio-rtlsdr.h)0
-rw-r--r--bindings/samples/AuthLogin.c (renamed from plugins/samples/AuthLogin.c)0
-rw-r--r--bindings/samples/CMakeLists.txt (renamed from plugins/samples/CMakeLists.txt)10
-rw-r--r--bindings/samples/DemoContext.c (renamed from plugins/samples/DemoContext.c)0
-rw-r--r--bindings/samples/DemoPost.c (renamed from plugins/samples/DemoPost.c)0
-rw-r--r--bindings/samples/HelloWorld.c (renamed from plugins/samples/HelloWorld.c)0
-rw-r--r--bindings/samples/export.map1
-rw-r--r--bindings/samples/tic-tac-toe.c (renamed from plugins/samples/tic-tac-toe.c)26
-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
-rw-r--r--include/afb/afb-binding.h261
-rw-r--r--include/afb/afb-event-itf.h2
-rw-r--r--include/afb/afb-plugin.h253
-rw-r--r--include/afb/afb-req-itf.h14
-rw-r--r--include/afb/afb-service-itf.h4
-rw-r--r--plugins/audio/export.map1
-rw-r--r--plugins/intrinsics/export.map1
-rw-r--r--plugins/media/export.map1
-rw-r--r--plugins/radio/export.map1
-rw-r--r--plugins/samples/export.map1
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/afb-api-dbus.c1
-rw-r--r--src/afb-api-so.c114
-rw-r--r--src/afb-api-so.h2
-rw-r--r--src/main.c32
60 files changed, 857 insertions, 814 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 955eb20a..3ec58293 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,11 +63,11 @@ SET(link_libraries
${json-c_LIBRARIES}
)
-SET(plugin_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/afb)
+SET(binding_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/afb)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(include)
-ADD_SUBDIRECTORY(plugins)
+ADD_SUBDIRECTORY(bindings)
############################################################
# installs the pkgconfig files
diff --git a/afb-daemon.pc.in b/afb-daemon.pc.in
index 23075eb9..34a470a3 100644
--- a/afb-daemon.pc.in
+++ b/afb-daemon.pc.in
@@ -18,7 +18,7 @@
##
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
-plugin_install_dir=@plugin_install_dir@
+binding_install_dir=@binding_install_dir@
Name: @PROJECT_PRETTY_NAME@
Description: @PROJECT_DESCRIPTION@
diff --git a/plugins/CMakeLists.txt b/bindings/CMakeLists.txt
index 2aacf1a1..2aacf1a1 100644
--- a/plugins/CMakeLists.txt
+++ b/bindings/CMakeLists.txt
diff --git a/plugins/audio/CMakeLists.txt b/bindings/audio/CMakeLists.txt
index 2d74fd62..11da28e1 100644
--- a/plugins/audio/CMakeLists.txt
+++ b/bindings/audio/CMakeLists.txt
@@ -6,10 +6,10 @@ FIND_PACKAGE(Threads)
IF(alsa_FOUND)
- MESSAGE(STATUS "ALSA found ; will compile Audio plugin... (PLUGIN)")
+ MESSAGE(STATUS "ALSA found ; will compile Audio binding... (BINDING)")
IF(pulseaudio_FOUND)
- MESSAGE(STATUS "PulseAudio found ; Audio plugin will have PulseAudio support")
+ MESSAGE(STATUS "PulseAudio found ; Audio binding will have PulseAudio support")
ADD_DEFINITIONS(-DHAVE_PULSE=1)
SET(pulse_sources audio-pulse.c)
ENDIF(pulseaudio_FOUND)
@@ -22,6 +22,6 @@ IF(alsa_FOUND)
)
TARGET_LINK_LIBRARIES(audio-api ${link_libraries} ${alsa_LIBRARIES} ${pulseaudio_LIBRARIES})
INSTALL(TARGETS audio-api
- LIBRARY DESTINATION ${plugin_install_dir})
+ LIBRARY DESTINATION ${binding_install_dir})
ENDIF(alsa_FOUND)
diff --git a/plugins/audio/audio-alsa.c b/bindings/audio/audio-alsa.c
index 45ff2edb..45ff2edb 100644
--- a/plugins/audio/audio-alsa.c
+++ b/bindings/audio/audio-alsa.c
diff --git a/plugins/audio/audio-alsa.h b/bindings/audio/audio-alsa.h
index 679d4eee..679d4eee 100644
--- a/plugins/audio/audio-alsa.h
+++ b/bindings/audio/audio-alsa.h
diff --git a/plugins/audio/audio-api.c b/bindings/audio/audio-api.c
index 1ba9126c..1ba9126c 100644
--- a/plugins/audio/audio-api.c
+++ b/bindings/audio/audio-api.c
diff --git a/plugins/audio/audio-api.h b/bindings/audio/audio-api.h
index f5c77c2e..f5c77c2e 100644
--- a/plugins/audio/audio-api.h
+++ b/bindings/audio/audio-api.h
diff --git a/plugins/audio/audio-pulse.c b/bindings/audio/audio-pulse.c
index 34643603..34643603 100644
--- a/plugins/audio/audio-pulse.c
+++ b/bindings/audio/audio-pulse.c
diff --git a/plugins/audio/audio-pulse.h b/bindings/audio/audio-pulse.h
index ad8ff490..ad8ff490 100644
--- a/plugins/audio/audio-pulse.h
+++ b/bindings/audio/audio-pulse.h
diff --git a/bindings/audio/export.map b/bindings/audio/export.map
new file mode 100644
index 00000000..0ef1ac79
--- /dev/null
+++ b/bindings/audio/export.map
@@ -0,0 +1 @@
+{ global: afbBindingV1Register; local: *; };
diff --git a/plugins/intrinsics/CMakeLists.txt b/bindings/intrinsics/CMakeLists.txt
index b9bd638a..c6ff8ef4 100644
--- a/plugins/intrinsics/CMakeLists.txt
+++ b/bindings/intrinsics/CMakeLists.txt
@@ -11,5 +11,5 @@ SET_TARGET_PROPERTIES(afb-dbus-binding PROPERTIES
)
TARGET_LINK_LIBRARIES(afb-dbus-binding ${link_libraries})
INSTALL(TARGETS afb-dbus-binding
- LIBRARY DESTINATION ${plugin_install_dir})
+ LIBRARY DESTINATION ${binding_install_dir})
diff --git a/plugins/intrinsics/afb-dbus-binding.c b/bindings/intrinsics/afb-dbus-binding.c
index 37988559..59fe78d6 100644
--- a/plugins/intrinsics/afb-dbus-binding.c
+++ b/bindings/intrinsics/afb-dbus-binding.c
@@ -23,14 +23,12 @@
#include <systemd/sd-bus.h>
#include <systemd/sd-bus-protocol.h>
-#include <afb/afb-plugin.h>
-#include <afb/afb-plugin.h>
-#include <afb/afb-plugin.h>
+#include <afb/afb-binding.h>
/*
* the interface to afb-daemon
*/
-const struct AFB_interface *afbitf;
+const struct afb_binding_interface *afbitf;
/*
* union of possible dbus values
@@ -602,32 +600,32 @@ cleanup:
/*
* array of the verbs exported to afb-daemon
*/
-static const struct AFB_verb_desc_v1 plugin_verbs[] = {
+static const struct afb_verb_desc_v1 binding_verbs[] = {
/* VERB'S NAME SESSION MANAGEMENT FUNCTION TO CALL SHORT DESCRIPTION */
{ .name= "rawcall", .session= AFB_SESSION_NONE, .callback= rawcall, .info= "raw call to dbus method" },
{ .name= NULL } /* marker for end of the array */
};
/*
- * 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= "dbus", /* the API name (or plugin name or prefix) */
- .info= "raw dbus binding", /* short description of of the plugin */
- .verbs = plugin_verbs /* the array describing the verbs of the API */
+ .type= AFB_BINDING_VERSION_1,
+ .v1= { /* fills the v1 field of the union when AFB_BINDING_VERSION_1 */
+ .prefix= "dbus", /* the API name (or binding name or prefix) */
+ .info= "raw dbus binding", /* short description of of the binding */
+ .verbs = binding_verbs /* the array describing the verbs of the API */
}
};
/*
- * 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 */
}
diff --git a/bindings/intrinsics/export.map b/bindings/intrinsics/export.map
new file mode 100644
index 00000000..0ef1ac79
--- /dev/null
+++ b/bindings/intrinsics/export.map
@@ -0,0 +1 @@
+{ global: afbBindingV1Register; local: *; };
diff --git a/plugins/media/CMakeLists.txt b/bindings/media/CMakeLists.txt
index 5febc02d..2866dfbc 100644
--- a/plugins/media/CMakeLists.txt
+++ b/bindings/media/CMakeLists.txt
@@ -3,7 +3,7 @@ PKG_CHECK_MODULES(gupnp gupnp-1.0 gupnp-av-1.0 gssdp-1.0 gobject-2.0 gio-2.0)
IF(gupnp_FOUND)
- MESSAGE(STATUS "gupnp found ; will compile Media plugin... (PLUGIN)")
+ MESSAGE(STATUS "gupnp found ; will compile Media binding... (binding)")
INCLUDE_DIRECTORIES( ${include_dirs} ${gupnp_INCLUDE_DIRS})
ADD_LIBRARY(media-api MODULE media-api.c media-rygel.c)
@@ -13,6 +13,6 @@ IF(gupnp_FOUND)
)
TARGET_LINK_LIBRARIES(media-api ${link_libraries} ${gupnp_LIBRARIES})
INSTALL(TARGETS media-api
- LIBRARY DESTINATION ${plugin_install_dir})
+ LIBRARY DESTINATION ${binding_install_dir})
ENDIF(gupnp_FOUND)
diff --git a/bindings/media/export.map b/bindings/media/export.map
new file mode 100644
index 00000000..0ef1ac79
--- /dev/null
+++ b/bindings/media/export.map
@@ -0,0 +1 @@
+{ global: afbBindingV1Register; local: *; };
diff --git a/plugins/media/media-api.c b/bindings/media/media-api.c
index 578d0066..578d0066 100644
--- a/plugins/media/media-api.c
+++ b/bindings/media/media-api.c
diff --git a/plugins/media/media-api.h b/bindings/media/media-api.h
index c1d764c2..c1d764c2 100644
--- a/plugins/media/media-api.h
+++ b/bindings/media/media-api.h
diff --git a/plugins/media/media-rygel.c b/bindings/media/media-rygel.c
index 00327795..00327795 100644
--- a/plugins/media/media-rygel.c
+++ b/bindings/media/media-rygel.c
diff --git a/plugins/media/media-rygel.h b/bindings/media/media-rygel.h
index 951c6b89..951c6b89 100644
--- a/plugins/media/media-rygel.h
+++ b/bindings/media/media-rygel.h
diff --git a/plugins/radio/CMakeLists.txt b/bindings/radio/CMakeLists.txt
index 2aa765da..4df7adb2 100644
--- a/plugins/radio/CMakeLists.txt
+++ b/bindings/radio/CMakeLists.txt
@@ -3,7 +3,7 @@ PKG_CHECK_MODULES(librtlsdr librtlsdr>=0.5.0)
IF(librtlsdr_FOUND)
- MESSAGE(STATUS "librtlsdr found ; will compile Radio plugin... (PLUGIN)")
+ MESSAGE(STATUS "librtlsdr found ; will compile Radio binding... (binding)")
INCLUDE_DIRECTORIES(${include_dirs} ${librtlsdr_INCLUDE_DIRS})
ADD_LIBRARY(radio-api MODULE radio-api.c radio-rtlsdr.c)
SET_TARGET_PROPERTIES(radio-api PROPERTIES
@@ -12,6 +12,6 @@ IF(librtlsdr_FOUND)
)
TARGET_LINK_LIBRARIES(radio-api ${link_libraries} ${librtlsdr_LIBRARIES} -lm)
INSTALL(TARGETS radio-api
- LIBRARY DESTINATION ${plugin_install_dir})
+ LIBRARY DESTINATION ${binding_install_dir})
ENDIF(librtlsdr_FOUND)
diff --git a/bindings/radio/export.map b/bindings/radio/export.map
new file mode 100644
index 00000000..0ef1ac79
--- /dev/null
+++ b/bindings/radio/export.map
@@ -0,0 +1 @@
+{ global: afbBindingV1Register; local: *; };
diff --git a/plugins/radio/radio-api.c b/bindings/radio/radio-api.c
index 0ed60e1c..0ed60e1c 100644
--- a/plugins/radio/radio-api.c
+++ b/bindings/radio/radio-api.c
diff --git a/plugins/radio/radio-api.h b/bindings/radio/radio-api.h
index 9b91ec69..9b91ec69 100644
--- a/plugins/radio/radio-api.h
+++ b/bindings/radio/radio-api.h
diff --git a/plugins/radio/radio-rtlsdr.c b/bindings/radio/radio-rtlsdr.c
index 7f76306e..7f76306e 100644
--- a/plugins/radio/radio-rtlsdr.c
+++ b/bindings/radio/radio-rtlsdr.c
diff --git a/plugins/radio/radio-rtlsdr.h b/bindings/radio/radio-rtlsdr.h
index 2308f27e..2308f27e 100644
--- a/plugins/radio/radio-rtlsdr.h
+++ b/bindings/radio/radio-rtlsdr.h
diff --git a/plugins/samples/AuthLogin.c b/bindings/samples/AuthLogin.c
index efecf240..efecf240 100644
--- a/plugins/samples/AuthLogin.c
+++ b/bindings/samples/AuthLogin.c
diff --git a/plugins/samples/CMakeLists.txt b/bindings/samples/CMakeLists.txt
index eb6e0112..59a9a449 100644
--- a/plugins/samples/CMakeLists.txt
+++ b/bindings/samples/CMakeLists.txt
@@ -11,7 +11,7 @@ SET_TARGET_PROPERTIES(authLogin PROPERTIES
)
TARGET_LINK_LIBRARIES(authLogin ${link_libraries})
INSTALL(TARGETS authLogin
- LIBRARY DESTINATION ${plugin_install_dir})
+ LIBRARY DESTINATION ${binding_install_dir})
##################################################
# DemoContext
@@ -23,7 +23,7 @@ SET_TARGET_PROPERTIES(demoContext PROPERTIES
)
TARGET_LINK_LIBRARIES(demoContext ${link_libraries})
INSTALL(TARGETS demoContext
- LIBRARY DESTINATION ${plugin_install_dir})
+ LIBRARY DESTINATION ${binding_install_dir})
##################################################
# DemoPost
@@ -35,7 +35,7 @@ SET_TARGET_PROPERTIES(demoPost PROPERTIES
)
TARGET_LINK_LIBRARIES(demoPost ${link_libraries})
INSTALL(TARGETS demoPost
- LIBRARY DESTINATION ${plugin_install_dir})
+ LIBRARY DESTINATION ${binding_install_dir})
##################################################
# HelloWorld
@@ -47,7 +47,7 @@ SET_TARGET_PROPERTIES(helloWorld PROPERTIES
)
TARGET_LINK_LIBRARIES(helloWorld ${link_libraries})
INSTALL(TARGETS helloWorld
- LIBRARY DESTINATION ${plugin_install_dir})
+ LIBRARY DESTINATION ${binding_install_dir})
##################################################
# tic-tac-toe
@@ -59,5 +59,5 @@ SET_TARGET_PROPERTIES(tic-tac-toe PROPERTIES
)
TARGET_LINK_LIBRARIES(tic-tac-toe ${link_libraries})
INSTALL(TARGETS tic-tac-toe
- LIBRARY DESTINATION ${plugin_install_dir})
+ LIBRARY DESTINATION ${binding_install_dir})
diff --git a/plugins/samples/DemoContext.c b/bindings/samples/DemoContext.c
index ef703759..ef703759 100644
--- a/plugins/samples/DemoContext.c
+++ b/bindings/samples/DemoContext.c
diff --git a/plugins/samples/DemoPost.c b/bindings/samples/DemoPost.c
index b61b91c4..b61b91c4 100644
--- a/plugins/samples/DemoPost.c
+++ b/bindings/samples/DemoPost.c
diff --git a/plugins/samples/HelloWorld.c b/bindings/samples/HelloWorld.c
index b6f49b78..b6f49b78 100644
--- a/plugins/samples/HelloWorld.c
+++ b/bindings/samples/HelloWorld.c
diff --git a/bindings/samples/export.map b/bindings/samples/export.map
new file mode 100644
index 00000000..0ef1ac79
--- /dev/null
+++ b/bindings/samples/export.map
@@ -0,0 +1 @@
+{ global: afbBindingV1Register; local: *; };
diff --git a/plugins/samples/tic-tac-toe.c b/bindings/samples/tic-tac-toe.c
index 31682d94..0100fc05 100644
--- a/plugins/samples/tic-tac-toe.c
+++ b/bindings/samples/tic-tac-toe.c
@@ -20,12 +20,12 @@
#include <string.h>
#include <json-c/json.h>
-#include <afb/afb-plugin.h>
+#include <afb/afb-binding.h>
/*
* the interface to afb-daemon
*/
-const struct AFB_interface *afbitf;
+const struct afb_binding_interface *afbitf;
/*
* definition of waiters
@@ -567,7 +567,7 @@ static void wait(struct afb_req req)
/*
* array of the verbs exported to afb-daemon
*/
-static const struct AFB_verb_desc_v1 plugin_verbs[] = {
+static const struct afb_verb_desc_v1 binding_verbs[] = {
/* 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" },
@@ -581,25 +581,25 @@ static const struct AFB_verb_desc_v1 plugin_verbs[] = {
};
/*
- * 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 */
- .verbs = plugin_verbs /* the array describing the verbs 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 */
+ .verbs = binding_verbs /* the array describing the verbs of the API */
}
};
/*
- * 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
}
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
diff --git a/include/afb/afb-binding.h b/include/afb/afb-binding.h
new file mode 100644
index 00000000..ac63d36b
--- /dev/null
+++ b/include/afb/afb-binding.h
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2016 "IoT.bzh"
+ * Author: José Bollo <jose.bollo@iot.bzh>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <stdarg.h>
+
+/*****************************************************************************
+ * This files is the main file to include for writing bindings dedicated to
+ *
+ * AFB-DAEMON
+ *
+ * Functions of bindings of afb-daemon are accessible by authorized clients
+ * through the apis module of afb-daemon.
+ *
+ * A binding is a shared library. This shared library must have at least one
+ * exported symbol for being registered in afb-daemon.
+ * For the current version of afb-daemon, the function exported MUST be named
+ *
+ * afbBindingV1Register
+ */
+
+/*
+ * Some function of the library are exported to afb-daemon.
+ */
+
+#include <afb/afb-event-itf.h>
+#include <afb/afb-req-itf.h>
+
+/*
+ * Definition of the type+versions of the binding.
+ * The definition uses hashes.
+ */
+enum afb_binding_type
+{
+ AFB_BINDING_VERSION_1 = 123456789 /* version 1 */
+};
+
+/*
+ * Enum for Session/Token/Assurance middleware.
+ * This enumeration is valid for bindings of type 1
+ */
+enum afb_session_v1
+{
+ AFB_SESSION_NONE = 0, /* nothing required */
+ AFB_SESSION_CREATE = 1, /* Obsolete */
+ AFB_SESSION_CLOSE = 2, /* After token authentification, closes the session at end */
+ AFB_SESSION_RENEW = 4, /* After token authentification, refreshes the token at end */
+ AFB_SESSION_CHECK = 8, /* Requires token authentification */
+
+ AFB_SESSION_LOA_GE = 16, /* check that the LOA is greater or equal to the given value */
+ AFB_SESSION_LOA_LE = 32, /* check that the LOA is lesser or equal to the given value */
+ AFB_SESSION_LOA_EQ = 48, /* check that the LOA is equal to the given value */
+
+ AFB_SESSION_LOA_SHIFT = 6, /* shift for LOA */
+ AFB_SESSION_LOA_MASK = 7, /* mask for LOA */
+
+ AFB_SESSION_LOA_0 = 0, /* value for LOA of 0 */
+ AFB_SESSION_LOA_1 = 64, /* value for LOA of 1 */
+ AFB_SESSION_LOA_2 = 128, /* value for LOA of 2 */
+ AFB_SESSION_LOA_3 = 192, /* value for LOA of 3 */
+ AFB_SESSION_LOA_4 = 256, /* value for LOA of 4 */
+
+ AFB_SESSION_LOA_LE_0 = AFB_SESSION_LOA_LE | AFB_SESSION_LOA_0, /* check LOA <= 0 */
+ AFB_SESSION_LOA_LE_1 = AFB_SESSION_LOA_LE | AFB_SESSION_LOA_1, /* check LOA <= 1 */
+ AFB_SESSION_LOA_LE_2 = AFB_SESSION_LOA_LE | AFB_SESSION_LOA_2, /* check LOA <= 2 */
+ AFB_SESSION_LOA_LE_3 = AFB_SESSION_LOA_LE | AFB_SESSION_LOA_3, /* check LOA <= 3 */
+
+ AFB_SESSION_LOA_GE_0 = AFB_SESSION_LOA_GE | AFB_SESSION_LOA_0, /* check LOA >= 0 */
+ AFB_SESSION_LOA_GE_1 = AFB_SESSION_LOA_GE | AFB_SESSION_LOA_1, /* check LOA >= 1 */
+ AFB_SESSION_LOA_GE_2 = AFB_SESSION_LOA_GE | AFB_SESSION_LOA_2, /* check LOA >= 2 */
+ AFB_SESSION_LOA_GE_3 = AFB_SESSION_LOA_GE | AFB_SESSION_LOA_3, /* check LOA >= 3 */
+
+ AFB_SESSION_LOA_EQ_0 = AFB_SESSION_LOA_EQ | AFB_SESSION_LOA_0, /* check LOA == 0 */
+ AFB_SESSION_LOA_EQ_1 = AFB_SESSION_LOA_EQ | AFB_SESSION_LOA_1, /* check LOA == 1 */
+ AFB_SESSION_LOA_EQ_2 = AFB_SESSION_LOA_EQ | AFB_SESSION_LOA_2, /* check LOA == 2 */
+ AFB_SESSION_LOA_EQ_3 = AFB_SESSION_LOA_EQ | AFB_SESSION_LOA_3 /* check LOA == 3 */
+};
+
+/*
+ * Description of one verb of the API provided by the binding
+ * This enumeration is valid for bindings of type 1
+ */
+struct afb_verb_desc_v1
+{
+ const char *name; /* name of the verb */
+ enum afb_session_v1 session; /* authorisation and session requirements of the verb */
+ void (*callback)(struct afb_req req); /* callback function implementing the verb */
+ const char *info; /* textual description of the verb */
+};
+
+/*
+ * Description of the bindings of type 1
+ */
+struct afb_binding_desc_v1
+{
+ const char *info; /* textual information about the binding */
+ const char *prefix; /* required prefix name for the binding */
+ const struct afb_verb_desc_v1 *verbs; /* array of descriptions of verbs terminated by a NULL name */
+};
+
+/*
+ * Description of a binding
+ */
+struct afb_binding
+{
+ enum afb_binding_type type; /* type of the binding */
+ union {
+ struct afb_binding_desc_v1 v1; /* description of the binding of type 1 */
+ };
+};
+
+/*
+ * config mode
+ */
+enum afb_mode {
+ AFB_MODE_LOCAL = 0, /* run locally */
+ AFB_MODE_REMOTE, /* run remotely */
+ AFB_MODE_GLOBAL /* run either remotely or locally (DONT USE! reserved for future) */
+};
+
+/* declaration of features of libsystemd */
+struct sd_event;
+struct sd_bus;
+
+/*
+ * Definition of the facilities provided by the daemon.
+ */
+struct afb_daemon_itf {
+ int (*event_broadcast)(void *closure, const char *name, struct json_object *object); /* broadcasts evant 'name' with 'object' */
+ struct sd_event *(*get_event_loop)(void *closure); /* gets the common systemd's event loop */
+ struct sd_bus *(*get_user_bus)(void *closure); /* gets the common systemd's user d-bus */
+ struct sd_bus *(*get_system_bus)(void *closure); /* gets the common systemd's system d-bus */
+ void (*vverbose)(void*closure, int level, const char *file, int line, const char *fmt, va_list args);
+ struct afb_event (*event_make)(void *closure, const char *name); /* creates an event of 'name' */
+};
+
+/*
+ * Structure for accessing daemon.
+ * See also: afb_daemon_get_event_sender, afb_daemon_get_event_loop, afb_daemon_get_user_bus, afb_daemon_get_system_bus
+ */
+struct afb_daemon {
+ const struct afb_daemon_itf *itf; /* the interfacing functions */
+ void *closure; /* the closure when calling these functions */
+};
+
+/*
+ * Interface between the daemon and the binding.
+ */
+struct afb_binding_interface
+{
+ struct afb_daemon daemon; /* access to the daemon facilies */
+ int verbosity; /* level of verbosity */
+ enum afb_mode mode; /* run mode (local or remote) */
+};
+
+/*
+ * Function for registering the binding
+ */
+extern const struct afb_binding *afbBindingV1Register (const struct afb_binding_interface *interface);
+
+/*
+ * Retrieves the common systemd's event loop of AFB
+ * 'daemon' MUST be the daemon given in interface when activating the binding.
+ */
+static inline struct sd_event *afb_daemon_get_event_loop(struct afb_daemon daemon)
+{
+ return daemon.itf->get_event_loop(daemon.closure);
+}
+
+/*
+ * Retrieves the common systemd's user/session d-bus of AFB
+ * 'daemon' MUST be the daemon given in interface when activating the binding.
+ */
+static inline struct sd_bus *afb_daemon_get_user_bus(struct afb_daemon daemon)
+{
+ return daemon.itf->get_user_bus(daemon.closure);
+}
+
+/*
+ * Retrieves the common systemd's system d-bus of AFB
+ * 'daemon' MUST be the daemon given in interface when activating the binding.
+ */
+static inline struct sd_bus *afb_daemon_get_system_bus(struct afb_daemon daemon)
+{
+ return daemon.itf->get_system_bus(daemon.closure);
+}
+
+/*
+ * 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 binding.
+ *
+ * For conveniency, the function calls 'json_object_put' for 'object'.
+ * Thus, in the case where 'object' should remain available after
+ * the function returns, the function 'json_object_get' shall be used.
+ *
+ * Returns the count of clients that received the event.
+ */
+static inline int afb_daemon_broadcast_event(struct afb_daemon daemon, const char *name, struct json_object *object)
+{
+ return daemon.itf->event_broadcast(daemon.closure, name, object);
+}
+
+/*
+ * Creates an event of 'name' and returns it.
+ * 'daemon' MUST be the daemon given in interface when activating the binding.
+ */
+static inline struct afb_event afb_daemon_make_event(struct afb_daemon daemon, const char *name)
+{
+ return daemon.itf->event_make(daemon.closure, name);
+}
+
+/*
+ * Send a message described by 'fmt' and following parameters
+ * to the journal for the verbosity 'level'.
+ * 'file' and 'line' are indicators of position of the code in source files.
+ * 'daemon' MUST be the daemon given in interface when activating the binding.
+ */
+static inline void afb_daemon_verbose(struct afb_daemon daemon, int level, const char *file, int line, const char *fmt, ...) __attribute__((format(printf, 5, 6)));
+static inline void afb_daemon_verbose(struct afb_daemon daemon, int level, const char *file, int line, const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ return daemon.itf->vverbose(daemon.closure, level, file, line, fmt, args);
+ va_end(args);
+}
+
+/*
+ * Macros for logging messages
+ */
+#if !defined(NO_BINDING_VERBOSE_MACRO)
+# if !defined(NO_BINDING_FILE_LINE_INDICATION)
+# define ERROR(itf,...) do{if(itf->verbosity>=0)afb_daemon_verbose(itf->daemon,3,__FILE__,__LINE__,__VA_ARGS__);}while(0)
+# define WARNING(itf,...) do{if(itf->verbosity>=1)afb_daemon_verbose(itf->daemon,4,__FILE__,__LINE__,__VA_ARGS__);}while(0)
+# define NOTICE(itf,...) do{if(itf->verbosity>=1)afb_daemon_verbose(itf->daemon,5,__FILE__,__LINE__,__VA_ARGS__);}while(0)
+# define INFO(itf,...) do{if(itf->verbosity>=2)afb_daemon_verbose(itf->daemon,6,__FILE__,__LINE__,__VA_ARGS__);}while(0)
+# define DEBUG(itf,...) do{if(itf->verbosity>=3)afb_daemon_verbose(itf->daemon,7,__FILE__,__LINE__,__VA_ARGS__);}while(0)
+# else
+# define ERROR(itf,...) do{if(itf->verbosity>=0)afb_daemon_verbose(itf->daemon,3,NULL,0,__VA_ARGS__);}while(0)
+# define WARNING(itf,...) do{if(itf->verbosity>=1)afb_daemon_verbose(itf->daemon,4,NULL,0,__VA_ARGS__);}while(0)
+# define NOTICE(itf,...) do{if(itf->verbosity>=1)afb_daemon_verbose(itf->daemon,5,NULL,0,__VA_ARGS__);}while(0)
+# define INFO(itf,...) do{if(itf->verbosity>=2)afb_daemon_verbose(itf->daemon,6,NULL,0,__VA_ARGS__);}while(0)
+# define DEBUG(itf,...) do{if(itf->verbosity>=3)afb_daemon_verbose(itf->daemon,7,NULL,0,__VA_ARGS__);}while(0)
+# endif
+#endif
+
diff --git a/include/afb/afb-event-itf.h b/include/afb/afb-event-itf.h
index 47ffa387..b89b9415 100644
--- a/include/afb/afb-event-itf.h
+++ b/include/afb/afb-event-itf.h
@@ -35,7 +35,7 @@ struct afb_event_itf {
};
/*
- * Describes the request by plugins from afb-daemon
+ * Describes the request of afb-daemon for bindings
*/
struct afb_event {
const struct afb_event_itf *itf; /* the interface to use */
diff --git a/include/afb/afb-plugin.h b/include/afb/afb-plugin.h
index 85e8de7e..3a8a8f4f 100644
--- a/include/afb/afb-plugin.h
+++ b/include/afb/afb-plugin.h
@@ -17,245 +17,24 @@
#pragma once
-#include <stdarg.h>
-
-/*****************************************************************************
- * This files is the main file to include for writing plugins dedicated to
- *
- * AFB-DAEMON
- *
- * Functions of plugins of afb-daemon are accessible by authorized clients
- * through the apis module of afb-daemon.
- *
- * A plugin is a shared library. This shared library must have at least one
- * exported symbol for being registered in afb-daemon.
- * For the current version of afb-daemon, the function exported MUST be named
- *
- * pluginAfbV1Register
- */
-
-/*
- * Some function of the library are exported to afb-daemon.
- */
-
-#include <afb/afb-event-itf.h>
-#include <afb/afb-req-itf.h>
-
-/*
- * Definition of the versions of the plugin.
- * The definition uses hashes.
- */
-enum AFB_plugin_version
-{
- AFB_PLUGIN_VERSION_1 = 123456789 /* version 1 */
-};
-
-/*
- * Enum for Session/Token/Assurance middleware.
- * This enumeration is valid for plugins of type 1
- */
-enum AFB_session_v1
-{
- AFB_SESSION_NONE = 0, /* nothing required */
- AFB_SESSION_CREATE = 1, /* Obsolete */
- AFB_SESSION_CLOSE = 2, /* After token authentification, closes the session at end */
- AFB_SESSION_RENEW = 4, /* After token authentification, refreshes the token at end */
- AFB_SESSION_CHECK = 8, /* Requires token authentification */
-
- AFB_SESSION_LOA_GE = 16, /* check that the LOA is greater or equal to the given value */
- AFB_SESSION_LOA_LE = 32, /* check that the LOA is lesser or equal to the given value */
- AFB_SESSION_LOA_EQ = 48, /* check that the LOA is equal to the given value */
-
- AFB_SESSION_LOA_SHIFT = 6, /* shift for LOA */
- AFB_SESSION_LOA_MASK = 7, /* mask for LOA */
-
- AFB_SESSION_LOA_0 = 0, /* value for LOA of 0 */
- AFB_SESSION_LOA_1 = 64, /* value for LOA of 1 */
- AFB_SESSION_LOA_2 = 128, /* value for LOA of 2 */
- AFB_SESSION_LOA_3 = 192, /* value for LOA of 3 */
- AFB_SESSION_LOA_4 = 256, /* value for LOA of 4 */
-
- AFB_SESSION_LOA_LE_0 = AFB_SESSION_LOA_LE | AFB_SESSION_LOA_0, /* check LOA <= 0 */
- AFB_SESSION_LOA_LE_1 = AFB_SESSION_LOA_LE | AFB_SESSION_LOA_1, /* check LOA <= 1 */
- AFB_SESSION_LOA_LE_2 = AFB_SESSION_LOA_LE | AFB_SESSION_LOA_2, /* check LOA <= 2 */
- AFB_SESSION_LOA_LE_3 = AFB_SESSION_LOA_LE | AFB_SESSION_LOA_3, /* check LOA <= 3 */
-
- AFB_SESSION_LOA_GE_0 = AFB_SESSION_LOA_GE | AFB_SESSION_LOA_0, /* check LOA >= 0 */
- AFB_SESSION_LOA_GE_1 = AFB_SESSION_LOA_GE | AFB_SESSION_LOA_1, /* check LOA >= 1 */
- AFB_SESSION_LOA_GE_2 = AFB_SESSION_LOA_GE | AFB_SESSION_LOA_2, /* check LOA >= 2 */
- AFB_SESSION_LOA_GE_3 = AFB_SESSION_LOA_GE | AFB_SESSION_LOA_3, /* check LOA >= 3 */
-
- AFB_SESSION_LOA_EQ_0 = AFB_SESSION_LOA_EQ | AFB_SESSION_LOA_0, /* check LOA == 0 */
- AFB_SESSION_LOA_EQ_1 = AFB_SESSION_LOA_EQ | AFB_SESSION_LOA_1, /* check LOA == 1 */
- AFB_SESSION_LOA_EQ_2 = AFB_SESSION_LOA_EQ | AFB_SESSION_LOA_2, /* check LOA == 2 */
- AFB_SESSION_LOA_EQ_3 = AFB_SESSION_LOA_EQ | AFB_SESSION_LOA_3 /* check LOA == 3 */
-};
-
-/*
- * Description of one verb of the API provided by the plugin
- * This enumeration is valid for plugins of type 1
- */
-struct AFB_verb_desc_v1
-{
- const char *name; /* name of the verb */
- enum AFB_session_v1 session; /* authorisation and session requirements of the verb */
- void (*callback)(struct afb_req req); /* callback function implementing the verb */
- const char *info; /* textual description of the verb */
-};
-
-/*
- * Description of the plugins of type 1
- */
-struct AFB_plugin_desc_v1
-{
- const char *info; /* textual information about the plugin */
- const char *prefix; /* required prefix name for the plugin */
- const struct AFB_verb_desc_v1 *verbs; /* array of descriptions of verbs terminated by a NULL name */
-};
-
-/*
- * Description of a plugin
- */
-struct AFB_plugin
-{
- enum AFB_plugin_version type; /* type of the plugin */
- union {
- struct AFB_plugin_desc_v1 v1; /* description of the plugin of type 1 */
- };
-};
-
-/*
- * config mode
- */
-enum AFB_Mode {
- AFB_MODE_LOCAL = 0, /* run locally */
- AFB_MODE_REMOTE, /* run remotely */
- AFB_MODE_GLOBAL /* run either remotely or locally (DONT USE! reserved for future) */
-};
-
-/* declaration of features of libsystemd */
-struct sd_event;
-struct sd_bus;
-
-/*
- * Definition of the facilities provided by the daemon.
- */
-struct afb_daemon_itf {
- int (*event_broadcast)(void *closure, const char *name, struct json_object *object); /* broadcasts evant 'name' with 'object' */
- struct sd_event *(*get_event_loop)(void *closure); /* gets the common systemd's event loop */
- struct sd_bus *(*get_user_bus)(void *closure); /* gets the common systemd's user d-bus */
- struct sd_bus *(*get_system_bus)(void *closure); /* gets the common systemd's system d-bus */
- void (*vverbose)(void*closure, int level, const char *file, int line, const char *fmt, va_list args);
- struct afb_event (*event_make)(void *closure, const char *name); /* creates an event of 'name' */
-};
-
-/*
- * Structure for accessing daemon.
- * See also: afb_daemon_get_event_sender, afb_daemon_get_event_loop, afb_daemon_get_user_bus, afb_daemon_get_system_bus
- */
-struct afb_daemon {
- const struct afb_daemon_itf *itf; /* the interfacing functions */
- void *closure; /* the closure when calling these functions */
-};
-
-/*
- * Interface between the daemon and the plugin.
- */
-struct AFB_interface
-{
- struct afb_daemon daemon; /* access to the daemon facilies */
- int verbosity; /* level of verbosity */
- enum AFB_Mode mode; /* run mode (local or remote) */
-};
-
-/*
- * Function for registering the plugin
- */
-extern const struct AFB_plugin *pluginAfbV1Register (const struct AFB_interface *interface);
-
-/*
- * Retrieves the common systemd's event loop of AFB
- * 'daemon' MUST be the daemon given in interface when activating the plugin.
- */
-static inline struct sd_event *afb_daemon_get_event_loop(struct afb_daemon daemon)
-{
- return daemon.itf->get_event_loop(daemon.closure);
-}
-
-/*
- * Retrieves the common systemd's user/session d-bus of AFB
- * 'daemon' MUST be the daemon given in interface when activating the plugin.
- */
-static inline struct sd_bus *afb_daemon_get_user_bus(struct afb_daemon daemon)
-{
- return daemon.itf->get_user_bus(daemon.closure);
-}
-
-/*
- * Retrieves the common systemd's system d-bus of AFB
- * 'daemon' MUST be the daemon given in interface when activating the plugin.
- */
-static inline struct sd_bus *afb_daemon_get_system_bus(struct afb_daemon daemon)
-{
- return daemon.itf->get_system_bus(daemon.closure);
-}
+#if defined(NO_PLUGIN_VERBOSE_MACRO)
+# define NO_BINDING_VERBOSE_MACRO
+#endif
-/*
- * 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.
- *
- * For conveniency, the function calls 'json_object_put' for 'object'.
- * Thus, in the case where 'object' should remain available after
- * the function returns, the function 'json_object_get' shall be used.
- *
- * Returns the count of clients that received the event.
- */
-static inline int afb_daemon_broadcast_event(struct afb_daemon daemon, const char *name, struct json_object *object)
-{
- return daemon.itf->event_broadcast(daemon.closure, name, object);
-}
+#if defined(NO_PLUGIN_FILE_LINE_INDICATION)
+# define NO_BINDING_FILE_LINE_INDICATION
+#endif
-/*
- * Creates an event of 'name' and returns it.
- * 'daemon' MUST be the daemon given in interface when activating the plugin.
- */
-static inline struct afb_event afb_daemon_make_event(struct afb_daemon daemon, const char *name)
-{
- return daemon.itf->event_make(daemon.closure, name);
-}
+#include "afb-binding.h"
-/*
- * Send a message described by 'fmt' and following parameters
- * to the journal for the verbosity 'level'.
- * 'file' and 'line' are indicators of position of the code in source files.
- * 'daemon' MUST be the daemon given in interface when activating the plugin.
- */
-static inline void afb_daemon_verbose(struct afb_daemon daemon, int level, const char *file, int line, const char *fmt, ...) __attribute__((format(printf, 5, 6)));
-static inline void afb_daemon_verbose(struct afb_daemon daemon, int level, const char *file, int line, const char *fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- return daemon.itf->vverbose(daemon.closure, level, file, line, fmt, args);
- va_end(args);
-}
+#define AFB_plugin_version afb_binding_type
+#define AFB_PLUGIN_VERSION_1 AFB_BINDING_VERSION_1
+#define AFB_plugin_desc_v1 afb_binding_desc_v1
+#define AFB_plugin afb_binding
+#define AFB_interface afb_binding_interface
+#define pluginAfbV1Register afbBindingV1Register
-/*
- * Macros for logging messages
- */
-#if !defined(NO_PLUGIN_VERBOSE_MACRO)
-# if !defined(NO_PLUGIN_FILE_LINE_INDICATION)
-# define ERROR(itf,...) do{if(itf->verbosity>=0)afb_daemon_verbose(itf->daemon,3,__FILE__,__LINE__,__VA_ARGS__);}while(0)
-# define WARNING(itf,...) do{if(itf->verbosity>=1)afb_daemon_verbose(itf->daemon,4,__FILE__,__LINE__,__VA_ARGS__);}while(0)
-# define NOTICE(itf,...) do{if(itf->verbosity>=1)afb_daemon_verbose(itf->daemon,5,__FILE__,__LINE__,__VA_ARGS__);}while(0)
-# define INFO(itf,...) do{if(itf->verbosity>=2)afb_daemon_verbose(itf->daemon,6,__FILE__,__LINE__,__VA_ARGS__);}while(0)
-# define DEBUG(itf,...) do{if(itf->verbosity>=3)afb_daemon_verbose(itf->daemon,7,__FILE__,__LINE__,__VA_ARGS__);}while(0)
-# else
-# define ERROR(itf,...) do{if(itf->verbosity>=0)afb_daemon_verbose(itf->daemon,3,NULL,0,__VA_ARGS__);}while(0)
-# define WARNING(itf,...) do{if(itf->verbosity>=1)afb_daemon_verbose(itf->daemon,4,NULL,0,__VA_ARGS__);}while(0)
-# define NOTICE(itf,...) do{if(itf->verbosity>=1)afb_daemon_verbose(itf->daemon,5,NULL,0,__VA_ARGS__);}while(0)
-# define INFO(itf,...) do{if(itf->verbosity>=2)afb_daemon_verbose(itf->daemon,6,NULL,0,__VA_ARGS__);}while(0)
-# define DEBUG(itf,...) do{if(itf->verbosity>=3)afb_daemon_verbose(itf->daemon,7,NULL,0,__VA_ARGS__);}while(0)
-# endif
-#endif
+#define AFB_Mode afb_mode
+#define AFB_session_v1 afb_session_v1
+#define AFB_verb_desc_v1 afb_verb_desc_v1
diff --git a/include/afb/afb-req-itf.h b/include/afb/afb-req-itf.h
index 3efb089d..af452faf 100644
--- a/include/afb/afb-req-itf.h
+++ b/include/afb/afb-req-itf.h
@@ -75,7 +75,7 @@ struct afb_req_itf {
};
/*
- * 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 interface to use */
@@ -206,8 +206,8 @@ static inline void afb_req_fail_f(struct afb_req req, const char *status, const
}
/*
- * 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.
*/
static inline void *afb_req_context_get(struct afb_req req)
{
@@ -215,9 +215,9 @@ static inline 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.
*/
static inline void afb_req_context_set(struct afb_req req, void *context, void (*free_context)(void*))
{
@@ -225,7 +225,7 @@ static inline void afb_req_context_set(struct afb_req req, void *context, void (
}
/*
- * 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
@@ -242,7 +242,7 @@ static inline void *afb_req_context(struct afb_req req, void *(*create_context)(
}
/*
- * 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)
diff --git a/include/afb/afb-service-itf.h b/include/afb/afb-service-itf.h
index ac40cf79..1218cd5b 100644
--- a/include/afb/afb-service-itf.h
+++ b/include/afb/afb-service-itf.h
@@ -31,9 +31,9 @@ struct afb_service
void *closure;
};
-extern int pluginAfbV1ServiceInit(struct afb_service service);
+extern int afbBindingV1ServiceInit(struct afb_service service);
-extern void pluginAfbV1ServiceEvent(const char *event, struct json_object *object);
+extern void afbBindingV1ServiceEvent(const char *event, struct json_object *object);
static inline void afb_service_call(struct afb_service service, const char *api, const char *verb, struct json_object *args, void (*callback)(void*, int, struct json_object*), void *callback_closure)
{
diff --git a/plugins/audio/export.map b/plugins/audio/export.map
deleted file mode 100644
index e2da85ca..00000000
--- a/plugins/audio/export.map
+++ /dev/null
@@ -1 +0,0 @@
-{ global: pluginAfbV1Register; local: *; };
diff --git a/plugins/intrinsics/export.map b/plugins/intrinsics/export.map
deleted file mode 100644
index e2da85ca..00000000
--- a/plugins/intrinsics/export.map
+++ /dev/null
@@ -1 +0,0 @@
-{ global: pluginAfbV1Register; local: *; };
diff --git a/plugins/media/export.map b/plugins/media/export.map
deleted file mode 100644
index e2da85ca..00000000
--- a/plugins/media/export.map
+++ /dev/null
@@ -1 +0,0 @@
-{ global: pluginAfbV1Register; local: *; };
diff --git a/plugins/radio/export.map b/plugins/radio/export.map
deleted file mode 100644
index e2da85ca..00000000
--- a/plugins/radio/export.map
+++ /dev/null
@@ -1 +0,0 @@
-{ global: pluginAfbV1Register; local: *; };
diff --git a/plugins/samples/export.map b/plugins/samples/export.map
deleted file mode 100644
index e2da85ca..00000000
--- a/plugins/samples/export.map
+++ /dev/null
@@ -1 +0,0 @@
-{ global: pluginAfbV1Register; local: *; };
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6abc8736..915da89d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,7 @@
INCLUDE(FindPkgConfig)
-ADD_DEFINITIONS(-DPLUGIN_INSTALL_DIR="${plugin_install_dir}")
+ADD_DEFINITIONS(-DBINDING_INSTALL_DIR="${binding_install_dir}")
CHECK_INCLUDE_FILES(magic.h HAVE_MAGIC_H)
CHECK_LIBRARY_EXISTS(magic magic_load "" HAVE_LIBMAGIC_SO)
diff --git a/src/afb-api-dbus.c b/src/afb-api-dbus.c
index 4c5d9083..b781f54f 100644
--- a/src/afb-api-dbus.c
+++ b/src/afb-api-dbus.c
@@ -26,7 +26,6 @@
#include <systemd/sd-bus.h>
#include <json-c/json.h>
-#include <afb/afb-plugin.h>
#include <afb/afb-req-itf.h>
#include "afb-common.h"
diff --git a/src/afb-api-so.c b/src/afb-api-so.c
index 168d9a6d..39a6e9b1 100644
--- a/src/afb-api-so.c
+++ b/src/afb-api-so.c
@@ -16,7 +16,7 @@
*/
#define _GNU_SOURCE
-#define NO_PLUGIN_VERBOSE_MACRO
+#define NO_BINDING_VERBOSE_MACRO
#include <stdio.h>
#include <assert.h>
@@ -28,7 +28,7 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <afb/afb-plugin.h>
+#include <afb/afb-binding.h>
#include <afb/afb-req-itf.h>
#include <afb/afb-event-itf.h>
@@ -43,14 +43,14 @@
#include "verbose.h"
/*
- * Description of a plugin
+ * Description of a binding
*/
struct api_so_desc {
- struct AFB_plugin *plugin; /* descriptor */
+ struct afb_binding *binding; /* descriptor */
size_t apilength; /* length of the API name */
void *handle; /* context of dlopen */
struct afb_svc *service; /* handler for service started */
- struct AFB_interface interface; /* interface for the plugin */
+ struct afb_binding_interface interface; /* interface for the binding */
};
struct monitoring {
@@ -58,9 +58,9 @@ struct monitoring {
void (*action)(struct afb_req);
};
-static const char plugin_register_function_v1[] = "pluginAfbV1Register";
-static const char plugin_service_init_function_v1[] = "pluginAfbV1ServiceInit";
-static const char plugin_service_event_function_v1[] = "pluginAfbV1ServiceEvent";
+static const char binding_register_function_v1[] = "afbBindingV1Register";
+static const char binding_service_init_function_v1[] = "afbBindingV1ServiceInit";
+static const char binding_service_event_function_v1[] = "afbBindingV1ServiceEvent";
static int api_timeout = 15;
@@ -83,10 +83,10 @@ static struct afb_event afb_api_so_event_make(struct api_so_desc *desc, const ch
char *event;
/* makes the event name */
- assert(desc->plugin != NULL);
+ assert(desc->binding != NULL);
length = strlen(name);
event = alloca(length + 2 + desc->apilength);
- memcpy(event, desc->plugin->v1.prefix, desc->apilength);
+ memcpy(event, desc->binding->v1.prefix, desc->apilength);
event[desc->apilength] = '/';
memcpy(event + desc->apilength + 1, name, length + 1);
@@ -100,10 +100,10 @@ static int afb_api_so_event_broadcast(struct api_so_desc *desc, const char *name
char *event;
/* makes the event name */
- assert(desc->plugin != NULL);
+ assert(desc->binding != NULL);
length = strlen(name);
event = alloca(length + 2 + desc->apilength);
- memcpy(event, desc->plugin->v1.prefix, desc->apilength);
+ memcpy(event, desc->binding->v1.prefix, desc->apilength);
event[desc->apilength] = '/';
memcpy(event + desc->apilength + 1, name, length + 1);
@@ -117,7 +117,7 @@ static void afb_api_so_vverbose(struct api_so_desc *desc, int level, const char
if (vasprintf(&p, fmt, args) < 0)
vverbose(level, file, line, fmt, args);
else {
- verbose(level, file, line, "%s {plugin %s}", p, desc->plugin->v1.prefix);
+ verbose(level, file, line, "%s {binding %s}", p, desc->binding->v1.prefix);
free(p);
}
}
@@ -130,7 +130,7 @@ static void monitored_call(int signum, struct monitoring *data)
data->action(data->req);
}
-static void call_check(struct afb_req req, struct afb_context *context, const struct AFB_verb_desc_v1 *verb)
+static void call_check(struct afb_req req, struct afb_context *context, const struct afb_verb_desc_v1 *verb)
{
struct monitoring data;
@@ -184,15 +184,15 @@ static void call_check(struct afb_req req, struct afb_context *context, const st
static void call(struct api_so_desc *desc, struct afb_req req, struct afb_context *context, const char *verb, size_t lenverb)
{
- const struct AFB_verb_desc_v1 *v;
+ const struct afb_verb_desc_v1 *v;
- v = desc->plugin->v1.verbs;
+ v = desc->binding->v1.verbs;
while (v->name && (strncasecmp(v->name, verb, lenverb) || v->name[lenverb]))
v++;
if (v->name)
call_check(req, context, v);
else
- afb_req_fail_f(req, "unknown-verb", "verb %.*s unknown within api %s", (int)lenverb, verb, desc->plugin->v1.prefix);
+ afb_req_fail_f(req, "unknown-verb", "verb %.*s unknown within api %s", (int)lenverb, verb, desc->binding->v1.prefix);
}
static int service_start(struct api_so_desc *desc, int share_session, int onneed)
@@ -207,28 +207,28 @@ static int service_start(struct api_so_desc *desc, int share_session, int onneed
return 0;
/* already started: it is an error */
- ERROR("Service %s already started", desc->plugin->v1.prefix);
+ ERROR("Service %s already started", desc->binding->v1.prefix);
return -1;
}
/* get the initialisation */
- init = dlsym(desc->handle, plugin_service_init_function_v1);
+ init = dlsym(desc->handle, binding_service_init_function_v1);
if (init == NULL) {
/* not an error when onneed */
if (onneed != 0)
return 0;
/* no initialisation method */
- ERROR("Binding %s is not a service", desc->plugin->v1.prefix);
+ ERROR("Binding %s is not a service", desc->binding->v1.prefix);
return -1;
}
/* get the event handler if any */
- onevent = dlsym(desc->handle, plugin_service_event_function_v1);
+ onevent = dlsym(desc->handle, binding_service_event_function_v1);
desc->service = afb_svc_create(share_session, init, onevent);
if (desc->service == NULL) {
/* starting error */
- ERROR("Starting service %s failed", desc->plugin->v1.prefix);
+ ERROR("Starting service %s failed", desc->binding->v1.prefix);
return -1;
}
@@ -240,28 +240,28 @@ void afb_api_so_set_timeout(int to)
api_timeout = to;
}
-int afb_api_so_add_plugin(const char *path)
+int afb_api_so_add_binding(const char *path)
{
int rc;
void *handle;
struct api_so_desc *desc;
- struct AFB_plugin *(*pluginAfbV1RegisterFct) (const struct AFB_interface *interface);
+ struct afb_binding *(*register_function) (const struct afb_binding_interface *interface);
- // This is a loadable library let's check if it's a plugin
+ // This is a loadable library let's check if it's a binding
rc = 0;
handle = dlopen(path, RTLD_NOW | RTLD_LOCAL);
if (handle == NULL) {
- ERROR("plugin [%s] not loadable", path);
+ ERROR("binding [%s] not loadable", path);
goto error;
}
/* retrieves the register function */
- pluginAfbV1RegisterFct = dlsym(handle, plugin_register_function_v1);
- if (!pluginAfbV1RegisterFct) {
- ERROR("plugin [%s] is not an AFB plugin", path);
+ register_function = dlsym(handle, binding_register_function_v1);
+ if (!register_function) {
+ ERROR("binding [%s] is not an AFB binding", path);
goto error2;
}
- INFO("plugin [%s] is a valid AFB plugin", path);
+ INFO("binding [%s] is a valid AFB binding", path);
rc = -1;
/* allocates the description */
@@ -278,46 +278,46 @@ int afb_api_so_add_plugin(const char *path)
desc->interface.daemon.itf = &daemon_itf;
desc->interface.daemon.closure = desc;
- /* init the plugin */
- NOTICE("plugin [%s] calling registering function %s", path, plugin_register_function_v1);
- desc->plugin = pluginAfbV1RegisterFct(&desc->interface);
- if (desc->plugin == NULL) {
- ERROR("plugin [%s] register function failed. continuing...", path);
+ /* init the binding */
+ NOTICE("binding [%s] calling registering function %s", path, binding_register_function_v1);
+ desc->binding = register_function(&desc->interface);
+ if (desc->binding == NULL) {
+ ERROR("binding [%s] register function failed. continuing...", path);
goto error3;
}
/* check the returned structure */
- if (desc->plugin->type != AFB_PLUGIN_VERSION_1) {
- ERROR("plugin [%s] invalid type %d...", path, desc->plugin->type);
+ if (desc->binding->type != AFB_BINDING_VERSION_1) {
+ ERROR("binding [%s] invalid type %d...", path, desc->binding->type);
goto error3;
}
- if (desc->plugin->v1.prefix == NULL || *desc->plugin->v1.prefix == 0) {
- ERROR("plugin [%s] bad prefix...", path);
+ if (desc->binding->v1.prefix == NULL || *desc->binding->v1.prefix == 0) {
+ ERROR("binding [%s] bad prefix...", path);
goto error3;
}
- if (!afb_apis_is_valid_api_name(desc->plugin->v1.prefix)) {
- ERROR("plugin [%s] invalid prefix...", path);
+ if (!afb_apis_is_valid_api_name(desc->binding->v1.prefix)) {
+ ERROR("binding [%s] invalid prefix...", path);
goto error3;
}
- if (desc->plugin->v1.info == NULL || *desc->plugin->v1.info == 0) {
- ERROR("plugin [%s] bad description...", path);
+ if (desc->binding->v1.info == NULL || *desc->binding->v1.info == 0) {
+ ERROR("binding [%s] bad description...", path);
goto error3;
}
- if (desc->plugin->v1.verbs == NULL) {
- ERROR("plugin [%s] no APIs...", path);
+ if (desc->binding->v1.verbs == NULL) {
+ ERROR("binding [%s] no APIs...", path);
goto error3;
}
- /* records the plugin */
- desc->apilength = strlen(desc->plugin->v1.prefix);
- if (afb_apis_add(desc->plugin->v1.prefix, (struct afb_api){
+ /* records the binding */
+ desc->apilength = strlen(desc->binding->v1.prefix);
+ if (afb_apis_add(desc->binding->v1.prefix, (struct afb_api){
.closure = desc,
.call = (void*)call,
.service_start = (void*)service_start }) < 0) {
- ERROR("plugin [%s] can't be registered...", path);
+ ERROR("binding [%s] can't be registered...", path);
goto error3;
}
- NOTICE("plugin %s loaded with API prefix %s", path, desc->plugin->v1.prefix);
+ NOTICE("binding %s loaded with API prefix %s", path, desc->binding->v1.prefix);
return 0;
error3:
@@ -337,10 +337,10 @@ static int adddirs(char path[PATH_MAX], size_t end)
/* open the DIR now */
dir = opendir(path);
if (dir == NULL) {
- ERROR("can't scan plugin directory %s, %m", path);
+ ERROR("can't scan binding directory %s, %m", path);
return -1;
}
- INFO("Scanning dir=[%s] for plugins", path);
+ INFO("Scanning dir=[%s] for bindings", path);
/* scan each entry */
if (end)
@@ -352,7 +352,7 @@ static int adddirs(char path[PATH_MAX], size_t end)
len = strlen(ent.d_name);
if (len + end >= PATH_MAX) {
- ERROR("path too long while scanning plugins for %s", ent.d_name);
+ ERROR("path too long while scanning bindings for %s", ent.d_name);
continue;
}
memcpy(&path[end], ent.d_name, len+1);
@@ -369,7 +369,7 @@ static int adddirs(char path[PATH_MAX], size_t end)
/* case of files */
if (!strstr(ent.d_name, ".so"))
continue;
- if (afb_api_so_add_plugin(path) < 0)
+ if (afb_api_so_add_binding(path) < 0)
return -1;
}
}
@@ -399,13 +399,13 @@ int afb_api_so_add_path(const char *path)
rc = stat(path, &st);
if (rc < 0)
- ERROR("Invalid plugin path [%s]: %m", path);
+ ERROR("Invalid binding path [%s]: %m", path);
else if (S_ISDIR(st.st_mode))
rc = afb_api_so_add_directory(path);
else if (strstr(path, ".so"))
- rc = afb_api_so_add_plugin(path);
+ rc = afb_api_so_add_binding(path);
else
- INFO("not a plugin [%s], skipped", path);
+ INFO("not a binding [%s], skipped", path);
return rc;
}
diff --git a/src/afb-api-so.h b/src/afb-api-so.h
index 143b7a05..d2ffbc8f 100644
--- a/src/afb-api-so.h
+++ b/src/afb-api-so.h
@@ -20,7 +20,7 @@
extern void afb_api_so_set_timeout(int to);
-extern int afb_api_so_add_plugin(const char *path);
+extern int afb_api_so_add_binding(const char *path);
extern int afb_api_so_add_directory(const char *path);
diff --git a/src/main.c b/src/main.c
index ce957352..7c457217 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,7 +17,7 @@
*/
#define _GNU_SOURCE
-#define NO_PLUGIN_VERBOSE_MACRO
+#define NO_BINDING_VERBOSE_MACRO
#include <stdlib.h>
#include <stdio.h>
@@ -42,10 +42,10 @@
#include "verbose.h"
#include "afb-common.h"
-#include <afb/afb-plugin.h>
+#include <afb/afb-binding.h>
-#if !defined(PLUGIN_INSTALL_DIR)
-#error "you should define PLUGIN_INSTALL_DIR"
+#if !defined(BINDING_INSTALL_DIR)
+#error "you should define BINDING_INSTALL_DIR"
#endif
#define AFB_VERSION "0.5"
@@ -77,7 +77,7 @@
#define DBUS_CLIENT 20
#define DBUS_SERVICE 21
-#define SO_PLUGIN 22
+#define SO_BINDING 22
#define SET_SESSIONMAX 23
@@ -103,13 +103,13 @@ static AFB_options cliOptions [] = {
{SET_ROOT_API ,1,"rootapi" , "HTML Root API URL [default /api]"},
{SET_ALIAS ,1,"alias" , "Muliple url map outside of rootdir [eg: --alias=/icons:/usr/share/icons]"},
- {SET_APITIMEOUT ,1,"apitimeout" , "Plugin API timeout in seconds [default 10]"},
+ {SET_APITIMEOUT ,1,"apitimeout" , "Binding API timeout in seconds [default 10]"},
{SET_CNTXTIMEOUT ,1,"cntxtimeout" , "Client Session Context Timeout [default 900]"},
{SET_CACHE_TIMEOUT,1,"cache-eol" , "Client cache end of live [default 3600]"},
{SET_SESSION_DIR ,1,"sessiondir" , "Sessions file path [default rootdir/sessions]"},
- {SET_LDPATH ,1,"ldpaths" , "Load Plugins from dir1:dir2:... [default = PLUGIN_INSTALL_DIR"},
+ {SET_LDPATH ,1,"ldpaths" , "Load bindingss from dir1:dir2:... [default = "BINDING_INSTALL_DIR"]"},
{SET_AUTH_TOKEN ,1,"token" , "Initial Secret [default=no-session, --token="" for session without authentication]"},
{DISPLAY_VERSION ,0,"version" , "Display version and copyright"},
@@ -120,7 +120,7 @@ static AFB_options cliOptions [] = {
{DBUS_CLIENT ,1,"dbus-client" , "bind to an afb service through dbus"},
{DBUS_SERVICE ,1,"dbus-server" , "provides an afb service through dbus"},
- {SO_PLUGIN ,1,"plugin" , "load the plugin of path"},
+ {SO_BINDING ,1,"binding" , "load the binding of path"},
{SET_SESSIONMAX ,1,"session-max" , "max count of session simultaneously [default 10]"},
@@ -164,7 +164,7 @@ static void printHelp(FILE *file, const char *name)
fprintf (file, " --%-15s %s\n", command, cliOptions[ind].help);
}
}
- fprintf (file, "Example:\n %s\\\n --verbose --port=1234 --token='azerty' --ldpaths=build/plugins:/usr/lib64/agl/plugins\n", name);
+ fprintf (file, "Example:\n %s\\\n --verbose --port=1234 --token='azerty' --ldpaths=build/bindings:/usr/lib64/agl/bindings\n", name);
}
// load config from disk and merge with CLI option
@@ -174,7 +174,7 @@ static void config_set_default (struct afb_config * config)
if (config->httpdPort == 0)
config->httpdPort = 1234;
- // default Plugin API timeout
+ // default binding API timeout
if (config->apiTimeout == 0)
config->apiTimeout = DEFLT_API_TIMEOUT;
@@ -213,7 +213,7 @@ static void config_set_default (struct afb_config * config)
config->rootapi = "/api";
if (config->ldpaths == NULL)
- config->ldpaths = PLUGIN_INSTALL_DIR;
+ config->ldpaths = BINDING_INSTALL_DIR;
// if no session dir create a default path from rootdir
if (config->sessiondir == NULL) {
@@ -384,7 +384,7 @@ static void parse_arguments(int argc, char *argv[], struct afb_config *config)
case DBUS_CLIENT:
case DBUS_SERVICE:
- case SO_PLUGIN:
+ case SO_BINDING:
if (optarg == 0) goto needValueForOption;
add_item(config, optc, optarg);
break;
@@ -559,9 +559,9 @@ static void start_items(struct afb_config_item *item)
exit(1);
}
break;
- case SO_PLUGIN:
- if (afb_api_so_add_plugin(item->value) < 0) {
- ERROR("can't start the plugin of path %s",item->value);
+ case SO_BINDING:
+ if (afb_api_so_add_binding(item->value) < 0) {
+ ERROR("can't start the binding of path %s",item->value);
exit(1);
}
break;
@@ -601,7 +601,7 @@ int main(int argc, char *argv[]) {
afb_api_so_set_timeout(config->apiTimeout);
if (config->ldpaths) {
if (afb_api_so_add_pathset(config->ldpaths) < 0) {
- ERROR("initialisation of plugins within %s failed", config->ldpaths);
+ ERROR("initialisation of bindings within %s failed", config->ldpaths);
exit(1);
}
}