From 444e62f0c4ecae594da71dbdd51305148c433fb5 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 17 Dec 2018 16:03:20 +0100 Subject: Update since the conversion to library Use the latest submodule git master branch revision. Some modifications has been lost since like the getter/setter functions and the plugin loading process. Change-Id: Ic0079f73bac46fba71f3de523a0f28371f85c1e6 Signed-off-by: Romain Forlot --- ctl-lib/ctl-config.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'ctl-lib/ctl-config.c') 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; } -- cgit 1.2.3-korg