From 1131cbe80a0278dbfddca247162b6e51c86a3b8d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Mon, 13 Jun 2016 16:46:44 +0200 Subject: [PATCH] minor reordering of code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: I0768fa05de116f621dbb6e630dba3024e0886c6d Signed-off-by: José Bollo --- src/afb-api-so.c | 42 +++++++++++++++++++++++------------------- 1 file 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; -- 2.16.6