aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib
diff options
context:
space:
mode:
Diffstat (limited to 'ctl-lib')
-rw-r--r--ctl-lib/ctl-action.c5
-rw-r--r--ctl-lib/ctl-config.c7
-rw-r--r--ctl-lib/ctl-config.h3
-rw-r--r--ctl-lib/ctl-plugin.c5
-rw-r--r--ctl-lib/ctl-plugin.h2
5 files changed, 9 insertions, 13 deletions
diff --git a/ctl-lib/ctl-action.c b/ctl-lib/ctl-action.c
index c1b7123..0bd9c7b 100644
--- a/ctl-lib/ctl-action.c
+++ b/ctl-lib/ctl-action.c
@@ -408,8 +408,3 @@ int AddActionsToSection(AFB_ApiT apiHandle, CtlSectionT *section, json_object *a
}
return 0;
}
-
-int AddActionsToSectionFromPlugin(AFB_ApiT apiHandle, CtlPluginT *externalCtlPlugins, CtlSectionT *section, json_object *actionsJ, int exportApi) {
- ctlPlugins = externalCtlPlugins;
- return AddActionsToSection(apiHandle, section, actionsJ, exportApi);
-}
diff --git a/ctl-lib/ctl-config.c b/ctl-lib/ctl-config.c
index accc608..532a2e8 100644
--- a/ctl-lib/ctl-config.c
+++ b/ctl-lib/ctl-config.c
@@ -187,11 +187,10 @@ CtlConfigT *CtlLoadMetaDataJson(AFB_ApiT apiHandle, json_object *ctlConfigJ, con
free(ctlHandle);
return NULL;
}
- }
- ctlHandle->configJ = ctlConfigJ;
- ctlHandle->prefix = prefix;
- ctlHandle->ctlPlugins = &ctlPlugins;
+ ctlHandle->configJ = ctlConfigJ;
+ ctlHandle->prefix = prefix;
+ }
return ctlHandle;
}
diff --git a/ctl-lib/ctl-config.h b/ctl-lib/ctl-config.h
index 4bf82f9..1facf39 100644
--- a/ctl-lib/ctl-config.h
+++ b/ctl-lib/ctl-config.h
@@ -75,7 +75,7 @@ typedef struct {
json_object *configJ;
json_object *requireJ;
CtlSectionT *sections;
- CtlPluginT **ctlPlugins;
+ CtlPluginT *ctlPlugins;
void *external;
} CtlConfigT;
@@ -92,7 +92,6 @@ typedef enum {
// ctl-action.c
extern int AddActionsToSection(AFB_ApiT apiHandle, CtlSectionT *section, json_object *actionsJ, int exportApi);
-extern int AddActionsToSectionFromPlugin(AFB_ApiT apiHandle, CtlPluginT *externalCtlPlugins, CtlSectionT *section, json_object *actionsJ, int exportApi);
extern CtlActionT *ActionConfig(AFB_ApiT apiHandle, json_object *actionsJ, int exportApi);
extern void ActionExecUID(AFB_ReqT request, CtlConfigT *ctlConfig, const char *uid, json_object *queryJ);
extern int ActionExecOne( CtlSourceT *source, CtlActionT* action, json_object *queryJ);
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c
index a632450..8eea0e0 100644
--- a/ctl-lib/ctl-plugin.c
+++ b/ctl-lib/ctl-plugin.c
@@ -37,6 +37,9 @@ int PluginGetCB (AFB_ApiT apiHandle, CtlActionT *action , json_object *callbackJ
json_object *argsJ;
int idx;
+ CtlConfigT *ctlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle);
+ CtlPluginT *ctlPlugins = ctlConfig->ctlPlugins;
+
if (!ctlPlugins) {
AFB_ApiError(apiHandle, "PluginGetCB plugin section missing cannot call '%s'", json_object_get_string(callbackJ));
return 1;
@@ -415,6 +418,8 @@ int PluginConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *pluginsJ
int idx = 0, jdx = 0;
int pluginNb = 0, newPluginsNb = 0, totalPluginNb = 0;
+ CtlConfigT *ctlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle);
+ CtlPluginT *ctlPlugins = ctlConfig->ctlPlugins;
if (ctlPlugins)
{
// There is something to add let that happens
diff --git a/ctl-lib/ctl-plugin.h b/ctl-lib/ctl-plugin.h
index d7ede8e..0ae6fbf 100644
--- a/ctl-lib/ctl-plugin.h
+++ b/ctl-lib/ctl-plugin.h
@@ -117,8 +117,6 @@ typedef struct {
} exec;
} CtlActionT;
-extern CtlPluginT *ctlPlugins;
-
typedef int(*DispatchPluginInstallCbT)(CtlPluginT *plugin, void* handle);
#define MACRO_STR_VALUE(arg) #arg