summaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-config.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-12-17 16:03:20 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-17 16:05:04 +0100
commit444e62f0c4ecae594da71dbdd51305148c433fb5 (patch)
tree7ccd0acb383141af39bef6badf608510470bf147 /ctl-lib/ctl-config.c
parent30d2f58557ca954f1500b1d6a06ea966786f3a28 (diff)
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 <romain.forlot@iot.bzh>
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;
}