-/*
- * 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 */
-};
-
-static int api_timeout = 15;
-
-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 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)
-{
- 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);