-/*
- * Description of a plugin
- */
-struct api_so_desc {
- struct AFB_plugin *plugin; /* 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 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";
-
-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)
-{
- size_t length;
- char *event;
-
- /* makes the event name */
- assert(desc->plugin != NULL);
- length = strlen(name);
- event = alloca(length + 2 + desc->apilength);
- memcpy(event, desc->plugin->v1.prefix, desc->apilength);
- event[desc->apilength] = '/';
- memcpy(event + desc->apilength + 1, name, length + 1);
-
- /* crate the event */
- return afb_evt_create_event(event);
-}
-
-static int afb_api_so_event_broadcast(struct api_so_desc *desc, const char *name, struct json_object *object)