From 18575b582d77d1d9ba6755e53b212082992e06c1 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 2 Nov 2017 14:56:22 +0100 Subject: Load afb_binding macros and stuff to plugins Change-Id: I18a70e929530bb1cd5f7f68962edf975521b1c71 Signed-off-by: Romain Forlot --- ctl-lib/ctl-plugin.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'ctl-lib/ctl-plugin.c') diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c index 1304984..0df21ae 100644 --- a/ctl-lib/ctl-plugin.c +++ b/ctl-lib/ctl-plugin.c @@ -209,16 +209,31 @@ OnErrorExit: PUBLIC int PluginConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *pluginsJ) { int err=0; - if (json_object_get_type(pluginsJ) == json_type_array) { - int length = json_object_array_length(pluginsJ); - ctlPlugins = calloc (length+1, sizeof(CtlPluginT)); - for (int idx=0; idx < length; idx++) { - json_object *pluginJ = json_object_array_get_idx(pluginsJ, idx); - err += PluginLoadOne(apiHandle, &ctlPlugins[idx], pluginJ, section->handle); + if (ctlPlugins) + { + int idx = 0; + while(ctlPlugins[idx].uid != NULL) + { + // Jose hack to make verbosity visible from sharedlib and + // be able to call verb from others api inside the binder + struct afb_binding_data_v2 *afbHidenData = dlsym(ctlPlugins[idx++].dlHandle, "afbBindingV2data"); + if (afbHidenData) *afbHidenData = afbBindingV2data; + } + return 0; + } + else + { + if (json_object_get_type(pluginsJ) == json_type_array) { + int length = json_object_array_length(pluginsJ); + ctlPlugins = calloc (length+1, sizeof(CtlPluginT)); + for (int idx=0; idx < length; idx++) { + json_object *pluginJ = json_object_array_get_idx(pluginsJ, idx); + err += PluginLoadOne(apiHandle, &ctlPlugins[idx], pluginJ, section->handle); + } + } else { + ctlPlugins = calloc (2, sizeof(CtlPluginT)); + err += PluginLoadOne(apiHandle, &ctlPlugins[0], pluginsJ, section->handle); } - } else { - ctlPlugins = calloc (2, sizeof(CtlPluginT)); - err += PluginLoadOne(apiHandle, &ctlPlugins[0], pluginsJ, section->handle); } return err; -- cgit 1.2.3-korg