aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-config.c
diff options
context:
space:
mode:
Diffstat (limited to 'ctl-lib/ctl-config.c')
-rw-r--r--ctl-lib/ctl-config.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/ctl-lib/ctl-config.c b/ctl-lib/ctl-config.c
index 42391db..ef6038b 100644
--- a/ctl-lib/ctl-config.c
+++ b/ctl-lib/ctl-config.c
@@ -26,9 +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;
@@ -163,30 +167,26 @@ int CtlConfigExec(afb_api_t apiHandle, CtlConfigT *ctlConfig) {
CtlConfigT *CtlLoadMetaDataJson(afb_api_t apiHandle, json_object *ctlConfigJ, const char *prefix) {
json_object *metadataJ;
CtlConfigT *ctlHandle=NULL;
- int err;
int done = json_object_object_get_ex(ctlConfigJ, "metadata", &metadataJ);
if (done) {
ctlHandle = calloc(1, sizeof (CtlConfigT));
- err = wrap_json_unpack(metadataJ, "{ss,ss,ss,s?s,s?o,s?s,s?s !}",
- "uid", &ctlHandle->uid,
- "version", &ctlHandle->version,
- "api", &ctlHandle->api,
- "info", &ctlHandle->info,
- "require", &ctlHandle->requireJ,
- "author", &ctlHandle->author,
- "date", &ctlHandle->date);
- if (err) {
+ if (wrap_json_unpack(metadataJ, "{ss,ss,ss,s?s,s?o,s?s,s?s !}",
+ "uid", &ctlHandle->uid,
+ "version", &ctlHandle->version,
+ "api", &ctlHandle->api,
+ "info", &ctlHandle->info,
+ "require", &ctlHandle->requireJ,
+ "author", &ctlHandle->author,
+ "date", &ctlHandle->date)) {
AFB_API_ERROR(apiHandle, "CTL-LOAD-CONFIG:METADATA Missing something uid|api|version|[info]|[require]|[author]|[date] in:\n-- %s", json_object_get_string(metadataJ));
free(ctlHandle);
return NULL;
}
+ ctlHandle->configJ = ctlConfigJ;
+ ctlHandle->prefix = prefix;
}
- ctlHandle->configJ = ctlConfigJ;
- ctlHandle->prefix = prefix;
- ctlHandle->ctlPlugins = &ctlPlugins;
-
return ctlHandle;
}