summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctl-lib/ctl-config.c7
-rw-r--r--ctl-lib/ctl-config.h5
-rw-r--r--ctl-lib/ctl-plugin.c8
3 files changed, 18 insertions, 2 deletions
diff --git a/ctl-lib/ctl-config.c b/ctl-lib/ctl-config.c
index e7bdc14..accc608 100644
--- a/ctl-lib/ctl-config.c
+++ b/ctl-lib/ctl-config.c
@@ -26,8 +26,13 @@
#include "filescan-utils.h"
#include "ctl-config.h"
+extern void* getExternalData(CtlConfigT *ctlConfig) {
+ return ctlConfig->external;
+}
-// Load control config file
+extern void setExternalData(CtlConfigT *ctlConfig, void *data) {
+ ctlConfig->external = data;
+}
int CtlConfigMagicNew() {
static int InitRandomDone=0;
diff --git a/ctl-lib/ctl-config.h b/ctl-lib/ctl-config.h
index 4216aa8..4bf82f9 100644
--- a/ctl-lib/ctl-config.h
+++ b/ctl-lib/ctl-config.h
@@ -101,6 +101,8 @@ extern int ActionLabelToIndex(CtlActionT* actions, const char* actionLabel);
// ctl-config.c
extern int CtlConfigMagicNew();
+extern void* getExternalData(CtlConfigT *ctlConfig);
+extern void setExternalData(CtlConfigT *ctlConfig, void *data);
extern json_object* CtlConfigScan(const char *dirList, const char *prefix) ;
extern char* ConfigSearch(AFB_ApiT apiHandle, json_object *responseJ);
extern char* CtlConfigSearch(AFB_ApiT apiHandle, const char *dirList, const char *prefix) ;
@@ -125,7 +127,8 @@ extern int OnloadConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *a
// ctl-plugin.c
extern int PluginConfig(AFB_ApiT UNUSED_ARG(apiHandle), CtlSectionT *section, json_object *pluginsJ);
extern int PluginGetCB (AFB_ApiT apiHandle, CtlActionT *action , json_object *callbackJ);
-
+extern void* getPluginContext(CtlPluginT *plugin);
+extern void setPluginContext(CtlPluginT *plugin, void *context);
#ifdef __cplusplus
}
#endif
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c
index 5d3ae1f..a632450 100644
--- a/ctl-lib/ctl-plugin.c
+++ b/ctl-lib/ctl-plugin.c
@@ -24,6 +24,14 @@
#include "ctl-config.h"
+void* getPluginContext(CtlPluginT *plugin) {
+ return plugin->context;
+}
+
+void setPluginContext(CtlPluginT *plugin, void *context) {
+ plugin->context = context;
+}
+
int PluginGetCB (AFB_ApiT apiHandle, CtlActionT *action , json_object *callbackJ) {
const char *plugin=NULL, *function=NULL;
json_object *argsJ;