-
-/*
- * Description of a binding
- */
-struct api_so_desc {
- struct afb_binding *binding; /* descriptor */
- size_t apilength; /* length of the API name */
- void *handle; /* context of dlopen */
- struct afb_svc *service; /* handler for service started */
- struct afb_binding_interface interface; /* interface for the binding */
-};
-
-struct monitoring {
- struct afb_req req;
- void (*action)(struct afb_req);
-};
-
-static const char binding_register_function_v1[] = "afbBindingV1Register";
-static const char binding_service_init_function_v1[] = "afbBindingV1ServiceInit";
-static const char binding_service_event_function_v1[] = "afbBindingV1ServiceEvent";
-
-static int api_timeout = 15;
-
-static struct afb_event afb_api_so_event_make_cb(void *closure, const char *name);
-static int afb_api_so_event_broadcast_cb(void *closure, const char *name, struct json_object *object);
-static void afb_api_so_vverbose_cb(void *closure, int level, const char *file, int line, const char *fmt, va_list args);
-static int afb_api_so_rootdir_get_fd(void *closure);
-static int afb_api_so_rootdir_open_locale(void *closure, const char *filename, int flags, const char *locale);
-
-static const struct afb_daemon_itf daemon_itf = {
- .event_broadcast = afb_api_so_event_broadcast_cb,
- .get_event_loop = afb_common_get_event_loop,
- .get_user_bus = afb_common_get_user_bus,
- .get_system_bus = afb_common_get_system_bus,
- .vverbose = afb_api_so_vverbose_cb,
- .event_make = afb_api_so_event_make_cb,
- .rootdir_get_fd = afb_api_so_rootdir_get_fd,
- .rootdir_open_locale = afb_api_so_rootdir_open_locale
-};
-
-static struct afb_event afb_api_so_event_make_cb(void *closure, const char *name)
+#include "sig-monitor.h"
+
+#if WITH_LEGACY_BINDING_V1
+# include "afb-api-so-v1.h"
+#endif
+#if WITH_LEGACY_BINDING_VDYN
+# include "afb-api-so-vdyn.h"
+#endif
+#if WITH_LEGACY_BINDING_V2
+# include "afb-api-so-v2.h"
+#endif
+
+struct safe_dlopen