aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/afm-main-plugin/afm-main-plugin.c32
-rw-r--r--plugins/audio/audio-api.c14
-rw-r--r--plugins/media/media-api.c14
-rw-r--r--plugins/radio/radio-api.c14
-rw-r--r--plugins/samples/ClientCtx.c14
-rw-r--r--plugins/samples/HelloWorld.c14
-rw-r--r--plugins/samples/SamplePost.c14
-rw-r--r--plugins/session/token-api.c14
8 files changed, 73 insertions, 57 deletions
diff --git a/plugins/afm-main-plugin/afm-main-plugin.c b/plugins/afm-main-plugin/afm-main-plugin.c
index 705efcb0..41e55404 100644
--- a/plugins/afm-main-plugin/afm-main-plugin.c
+++ b/plugins/afm-main-plugin/afm-main-plugin.c
@@ -45,7 +45,7 @@ static const char _terminate_[] = "terminate";
static const char _uninstall_[] = "uninstall";
static const char _uri_[] = "uri";
-static const struct AFB_interface *interface;
+static const struct AFB_interface *afb_interface;
static struct afb_evmgr evmgr;
static struct jbus *jbus;
@@ -96,7 +96,7 @@ static struct json_object *embed(const char *tag, struct json_object *obj)
static void embed_call_void_callback(int status, struct json_object *obj, struct memo *memo)
{
- if (interface->verbosity)
+ if (afb_interface->verbosity)
fprintf(stderr, "(afm-main-plugin) %s(true) -> %s\n", memo->method,
obj ? json_object_to_json_string(obj) : "NULL");
if (obj == NULL) {
@@ -127,7 +127,7 @@ static void embed_call_void(struct afb_req request, const char *method)
static void call_appid_callback(int status, struct json_object *obj, struct memo *memo)
{
- if (interface->verbosity)
+ if (afb_interface->verbosity)
fprintf(stderr, "(afm-main-plugin) %s -> %s\n", memo->method,
obj ? json_object_to_json_string(obj) : "NULL");
if (obj == NULL) {
@@ -171,7 +171,7 @@ static void call_runid(struct afb_req request, const char *method)
return;
}
obj = jbus_call_sj_sync(jbus, method, id);
- if (interface->verbosity)
+ if (afb_interface->verbosity)
fprintf(stderr, "(afm-main-plugin) %s(%s) -> %s\n", method, id,
obj ? json_object_to_json_string(obj) : "NULL");
if (obj == NULL) {
@@ -210,7 +210,7 @@ static void start(struct afb_req request)
/* get the mode */
mode = afb_req_value(request, _mode_);
if (mode == NULL || !strcmp(mode, _auto_)) {
- mode = interface->mode == AFB_MODE_REMOTE ? _remote_ : _local_;
+ mode = afb_interface->mode == AFB_MODE_REMOTE ? _remote_ : _local_;
}
/* create the query */
@@ -222,7 +222,7 @@ static void start(struct afb_req request)
/* calls the service */
obj = jbus_call_sj_sync(jbus, _start_, query);
- if (interface->verbosity)
+ if (afb_interface->verbosity)
fprintf(stderr, "(afm-main-plugin) start(%s) -> %s\n", query,
obj ? json_object_to_json_string(obj) : "NULL");
free(query);
@@ -287,7 +287,7 @@ static void install(struct afb_req request)
}
obj = jbus_call_sj_sync(jbus, _install_, query);
- if (interface->verbosity)
+ if (afb_interface->verbosity)
fprintf(stderr, "(afm-main-plugin) install(%s) -> %s\n", query,
obj ? json_object_to_json_string(obj) : "NULL");
free(query);
@@ -311,7 +311,7 @@ static void uninstall(struct afb_req request)
call_appid(request, _uninstall_);
}
-static const struct AFB_restapi plug_apis[] =
+static const struct AFB_verb_desc_v1 verbs[] =
{
{_runnables_, AFB_SESSION_CHECK, runnables, "Get list of runnable applications"},
{_detail_ , AFB_SESSION_CHECK, detail, "Get the details for one application"},
@@ -327,20 +327,22 @@ static const struct AFB_restapi plug_apis[] =
};
static const struct AFB_plugin plug_desc = {
- .type = AFB_PLUGIN_JSON,
- .info = "Application Framework Master Service",
- .prefix = "afm-main",
- .apis = plug_apis
+ .type = AFB_PLUGIN_VERSION_1,
+ .v1 = {
+ .info = "Application Framework Master Service",
+ .prefix = "afm-main",
+ .verbs = verbs
+ }
};
-const struct AFB_plugin *pluginRegister(const struct AFB_interface *itf)
+const struct AFB_plugin *pluginAfbV1Register(const struct AFB_interface *itf)
{
int rc;
struct sd_bus *sbus;
/* records the interface */
- assert (interface == NULL);
- interface = itf;
+ assert (afb_interface == NULL);
+ afb_interface = itf;
evmgr = afb_daemon_get_evmgr(itf->daemon);
/* creates the jbus for accessing afm-user-daemon */
diff --git a/plugins/audio/audio-api.c b/plugins/audio/audio-api.c
index c486d1c1..4eeed92d 100644
--- a/plugins/audio/audio-api.c
+++ b/plugins/audio/audio-api.c
@@ -330,7 +330,7 @@ static void ping (struct afb_req request) { /* AFB_SESSION_NONE */
afb_req_success (request, NULL, "Audio - Ping success");
}
-static const struct AFB_restapi pluginApis[]= {
+static const struct AFB_verb_desc_v1 verbs[]= {
{"init" , AFB_SESSION_CHECK, init , "Audio API - init"},
{"volume" , AFB_SESSION_CHECK, volume , "Audio API - volume"},
{"channels", AFB_SESSION_CHECK, channels , "Audio API - channels"},
@@ -341,13 +341,15 @@ static const struct AFB_restapi pluginApis[]= {
};
static const struct AFB_plugin pluginDesc = {
- .type = AFB_PLUGIN_JSON,
- .info = "Application Framework Binder - Audio plugin",
- .prefix = "audio",
- .apis = pluginApis
+ .type = AFB_PLUGIN_VERSION_1,
+ .v1 = {
+ .info = "Application Framework Binder - Audio plugin",
+ .prefix = "audio",
+ .verbs = verbs
+ }
};
-const struct AFB_plugin *pluginRegister (const struct AFB_interface *itf)
+const struct AFB_plugin *pluginAfbV1Entry (const struct AFB_interface *itf)
{
return &pluginDesc;
}
diff --git a/plugins/media/media-api.c b/plugins/media/media-api.c
index 91676d4c..dace151f 100644
--- a/plugins/media/media-api.c
+++ b/plugins/media/media-api.c
@@ -301,7 +301,7 @@ static void ping (struct afb_req request) { /* AFB_SESSION_NONE */
}
-static const struct AFB_restapi pluginApis[]= {
+static const struct AFB_verb_desc_v1 verbs[]= {
{"init" , AFB_SESSION_CHECK, init , "Media API - init" },
{"list" , AFB_SESSION_CHECK, list , "Media API - list" },
{"select" , AFB_SESSION_CHECK, selecting , "Media API - select" },
@@ -315,13 +315,15 @@ static const struct AFB_restapi pluginApis[]= {
};
static const struct AFB_plugin pluginDesc = {
- .type = AFB_PLUGIN_JSON,
- .info = "Application Framework Binder - Media plugin",
- .prefix = "media",
- .apis = pluginApis
+ .type = AFB_PLUGIN_VERSION_1,
+ .v1 = {
+ .info = "Application Framework Binder - Media plugin",
+ .prefix = "media",
+ .verbs = verbs
+ }
};
-const struct AFB_plugin *pluginRegister (const struct AFB_interface *itf)
+const struct AFB_plugin *pluginAfbV1Entry (const struct AFB_interface *itf)
{
return &pluginDesc;
}
diff --git a/plugins/radio/radio-api.c b/plugins/radio/radio-api.c
index e4a89ba6..3ef098a9 100644
--- a/plugins/radio/radio-api.c
+++ b/plugins/radio/radio-api.c
@@ -316,7 +316,7 @@ static void ping (struct afb_req request) { /* AFB_SESSION_NONE */
}
-static const struct AFB_restapi pluginApis[]= {
+static const struct AFB_verb_desc_v1 verbs[]= {
{"init" , AFB_SESSION_CHECK, init , "Radio API - init"},
{"power" , AFB_SESSION_CHECK, power , "Radio API - power"},
{"mode" , AFB_SESSION_CHECK, mode , "Radio API - mode"},
@@ -328,13 +328,15 @@ static const struct AFB_restapi pluginApis[]= {
};
static const struct AFB_plugin pluginDesc = {
- .type = AFB_PLUGIN_JSON,
- .info = "Application Framework Binder - Radio plugin",
- .prefix = "radio",
- .apis = pluginApis
+ .type = AFB_PLUGIN_VERSION_1,
+ .v1 = {
+ .info = "Application Framework Binder - Radio plugin",
+ .prefix = "radio",
+ .verbs = verbs
+ }
};
-const struct AFB_plugin *pluginRegister (const struct AFB_interface *itf)
+const struct AFB_plugin *pluginAfbV1Entry (const struct AFB_interface *itf)
{
initRadioPlugin();
return &pluginDesc;
diff --git a/plugins/samples/ClientCtx.c b/plugins/samples/ClientCtx.c
index bf26937f..6b7eb631 100644
--- a/plugins/samples/ClientCtx.c
+++ b/plugins/samples/ClientCtx.c
@@ -87,7 +87,7 @@ static void myClose (struct afb_req request)
// NOTE: this sample does not use session to keep test a basic as possible
// in real application most APIs should be protected with AFB_SESSION_CHECK
-static const struct AFB_restapi pluginApis[]= {
+static const struct AFB_verb_desc_v1 verbs[]= {
{"create", AFB_SESSION_CREATE, myCreate , "Create a new session"},
{"action", AFB_SESSION_CHECK , myAction , "Use Session Context"},
{"close" , AFB_SESSION_CLOSE , myClose , "Free Context"},
@@ -95,13 +95,15 @@ static const struct AFB_restapi pluginApis[]= {
};
static const struct AFB_plugin plugin_desc = {
- .type = AFB_PLUGIN_JSON,
- .info = "Sample of Client Context Usage",
- .prefix = "context",
- .apis = pluginApis,
+ .type = AFB_PLUGIN_VERSION_1,
+ .v1 = {
+ .info = "Sample of Client Context Usage",
+ .prefix = "context",
+ .verbs = verbs,
+ }
};
-const struct AFB_plugin *pluginRegister (const struct AFB_interface *itf)
+const struct AFB_plugin *pluginAfbV1Register (const struct AFB_interface *itf)
{
return &plugin_desc;
}
diff --git a/plugins/samples/HelloWorld.c b/plugins/samples/HelloWorld.c
index 4795dd36..35b95cab 100644
--- a/plugins/samples/HelloWorld.c
+++ b/plugins/samples/HelloWorld.c
@@ -78,7 +78,7 @@ static void pingJson (struct afb_req request) {
// NOTE: this sample does not use session to keep test a basic as possible
// in real application most APIs should be protected with AFB_SESSION_CHECK
-static const struct AFB_restapi pluginApis[]= {
+static const struct AFB_verb_desc_v1 verbs[]= {
{"ping" , AFB_SESSION_NONE, pingSample , "Ping Application Framework"},
{"pingfail" , AFB_SESSION_NONE, pingFail , "Fails"},
{"pingnull" , AFB_SESSION_NONE, pingNull , "Return NULL"},
@@ -89,13 +89,15 @@ static const struct AFB_restapi pluginApis[]= {
};
static const struct AFB_plugin plugin_desc = {
- .type = AFB_PLUGIN_JSON,
- .info = "Minimal Hello World Sample",
- .prefix = "hello",
- .apis = pluginApis
+ .type = AFB_PLUGIN_VERSION_1,
+ .v1 = {
+ .info = "Minimal Hello World Sample",
+ .prefix = "hello",
+ .verbs = verbs
+ }
};
-const struct AFB_plugin *pluginRegister (const struct AFB_interface *itf)
+const struct AFB_plugin *pluginAfbV1Register (const struct AFB_interface *itf)
{
interface = itf;
return &plugin_desc;
diff --git a/plugins/samples/SamplePost.c b/plugins/samples/SamplePost.c
index 1d3069e8..b61b91c4 100644
--- a/plugins/samples/SamplePost.c
+++ b/plugins/samples/SamplePost.c
@@ -76,7 +76,7 @@ static void UploadImage (struct afb_req request)
// NOTE: this sample does not use session to keep test a basic as possible
// in real application upload-xxx should be protected with AFB_SESSION_CHECK
-static const struct AFB_restapi pluginApis[]= {
+static const struct AFB_verb_desc_v1 verbs[]= {
{"ping" , AFB_SESSION_NONE , getPingTest ,"Ping Rest Test Service"},
{"upload-json" , AFB_SESSION_NONE , GetJsonByPost ,"Demo for Json Buffer on Post"},
{"upload-image" , AFB_SESSION_NONE , UploadImage ,"Demo for file upload"},
@@ -86,13 +86,15 @@ static const struct AFB_restapi pluginApis[]= {
};
static const struct AFB_plugin plugin_desc = {
- .type = AFB_PLUGIN_JSON,
- .info = "Sample with Post Upload Files",
- .prefix = "post",
- .apis = pluginApis
+ .type = AFB_PLUGIN_VERSION_1,
+ .v1 = {
+ .info = "Sample with Post Upload Files",
+ .prefix = "post",
+ .verbs = verbs
+ }
};
-const struct AFB_plugin *pluginRegister (const struct AFB_interface *itf)
+const struct AFB_plugin *pluginAfbV1Register (const struct AFB_interface *itf)
{
return &plugin_desc;
};
diff --git a/plugins/session/token-api.c b/plugins/session/token-api.c
index fd312608..a8167c42 100644
--- a/plugins/session/token-api.c
+++ b/plugins/session/token-api.c
@@ -99,7 +99,7 @@ static void clientGetPing (struct afb_req request) {
}
-static const struct AFB_restapi pluginApis[]= {
+static const struct AFB_verb_desc_v1 verbs[]= {
{"ping" , AFB_SESSION_NONE , clientGetPing ,"Ping Rest Test Service"},
{"create" , AFB_SESSION_CREATE, clientContextCreate ,"Request Client Context Creation"},
{"refresh" , AFB_SESSION_RENEW , clientContextRefresh,"Refresh Client Context Token"},
@@ -109,13 +109,15 @@ static const struct AFB_restapi pluginApis[]= {
};
static const struct AFB_plugin plugin_desc = {
- .type = AFB_PLUGIN_JSON,
- .info = "Application Framework Binder Service",
- .prefix = "token",
- .apis = pluginApis
+ .type = AFB_PLUGIN_VERSION_1,
+ .v1 = {
+ .info = "Application Framework Binder Service",
+ .prefix = "token",
+ .verbs = verbs
+ }
};
-const struct AFB_plugin *pluginRegister (const struct AFB_interface *itf)
+const struct AFB_plugin *pluginAfbV1Register (const struct AFB_interface *itf)
{
return &plugin_desc;
}