aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-api-so.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-06-13 16:46:44 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-06-13 16:46:44 +0200
commit1131cbe80a0278dbfddca247162b6e51c86a3b8d (patch)
treea3de387597338dacd0bd635e7daeddfd430ea185 /src/afb-api-so.c
parent5b5a2e4412eea806451c016da9fb285bc09c17ab (diff)
minor reordering of code
Change-Id: I0768fa05de116f621dbb6e630dba3024e0886c6d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-api-so.c')
-rw-r--r--src/afb-api-so.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/afb-api-so.c b/src/afb-api-so.c
index 3730ccd6..168d9a6d 100644
--- a/src/afb-api-so.c
+++ b/src/afb-api-so.c
@@ -53,16 +53,29 @@ struct api_so_desc {
struct AFB_interface interface; /* interface for the plugin */
};
-static int api_timeout = 15;
+struct monitoring {
+ struct afb_req req;
+ 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";
-void afb_api_so_set_timeout(int to)
-{
- api_timeout = to;
-}
+static int api_timeout = 15;
+
+static struct afb_event afb_api_so_event_make(struct api_so_desc *desc, const char *name);
+static int afb_api_so_event_broadcast(struct api_so_desc *desc, const char *name, struct json_object *object);
+static void afb_api_so_vverbose(struct api_so_desc *desc, int level, const char *file, int line, const char *fmt, va_list args);
+
+static const struct afb_daemon_itf daemon_itf = {
+ .event_broadcast = (void*)afb_api_so_event_broadcast,
+ .get_event_loop = (void*)afb_common_get_event_loop,
+ .get_user_bus = (void*)afb_common_get_user_bus,
+ .get_system_bus = (void*)afb_common_get_system_bus,
+ .vverbose = (void*)afb_api_so_vverbose,
+ .event_make = (void*)afb_api_so_event_make
+};
static struct afb_event afb_api_so_event_make(struct api_so_desc *desc, const char *name)
{
@@ -109,20 +122,6 @@ static void afb_api_so_vverbose(struct api_so_desc *desc, int level, const char
}
}
-static const struct afb_daemon_itf daemon_itf = {
- .event_broadcast = (void*)afb_api_so_event_broadcast,
- .get_event_loop = (void*)afb_common_get_event_loop,
- .get_user_bus = (void*)afb_common_get_user_bus,
- .get_system_bus = (void*)afb_common_get_system_bus,
- .vverbose = (void*)afb_api_so_vverbose,
- .event_make = (void*)afb_api_so_event_make
-};
-
-struct monitoring {
- struct afb_req req;
- void (*action)(struct afb_req);
-};
-
static void monitored_call(int signum, struct monitoring *data)
{
if (signum != 0)
@@ -236,6 +235,11 @@ static int service_start(struct api_so_desc *desc, int share_session, int onneed
return 0;
}
+void afb_api_so_set_timeout(int to)
+{
+ api_timeout = to;
+}
+
int afb_api_so_add_plugin(const char *path)
{
int rc;