summaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-onload.c
diff options
context:
space:
mode:
authorfulup <fulup.arfoll@iot.bzh>2017-10-18 11:31:33 +0200
committerfulup <fulup.arfoll@iot.bzh>2017-10-18 11:31:33 +0200
commit17a6011775e8c6d1536994f8b9cd4fa2f99791f7 (patch)
tree262f653a0369d080e2368bddd840e3c0fa089b29 /ctl-lib/ctl-onload.c
parent29d0c8e83b1ac766395d2d5bee4d83cb0148a7ec (diff)
1st V2/pre-V3 version
Diffstat (limited to 'ctl-lib/ctl-onload.c')
-rw-r--r--ctl-lib/ctl-onload.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/ctl-lib/ctl-onload.c b/ctl-lib/ctl-onload.c
index 97bd109..1dec75a 100644
--- a/ctl-lib/ctl-onload.c
+++ b/ctl-lib/ctl-onload.c
@@ -23,29 +23,31 @@
#include "ctl-config.h"
// onload section receive one action or an array of actions
-PUBLIC int OnloadConfig(CtlSectionT *section, json_object *actionsJ) {
- CtlActionT *actions;
-
- // Load time parse actions in config file
+PUBLIC int OnloadConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *actionsJ) {
+
+ // Load time parse actions in control file
if (actionsJ != NULL) {
- actions= ActionLoad(actionsJ);
- section->handle=actions;
+ section->actions= ActionConfig(apiHandle, actionsJ, 0);
- if (!actions) {
- AFB_ERROR ("OnloadLoad config fail processing onload actions");
+ if (!section->actions) {
+ AFB_ApiError (apiHandle, "OnloadConfig control fail processing onload actions");
goto OnErrorExit;
}
} else {
// Exec time process onload action now
- actions=(CtlActionT*)section->handle;
- if (!actions) {
- AFB_ERROR ("OnloadLoad Cannot Exec Non Existing Onload Action");
+ if (!section->actions) {
+ AFB_ApiError (apiHandle, "OnloadConfig Cannot Exec Non Existing Onload Action");
goto OnErrorExit;
}
- for (int idx=0; actions[idx].source.label != NULL; idx ++) {
- ActionExecOne(&actions[idx], NULL);
+ for (int idx=0; section->actions[idx].label != NULL; idx ++) {
+ CtlSourceT source;
+ source.label = section->actions[idx].label;
+ source.api = section->actions[idx].api;
+ source.request = AFB_ReqNone;
+
+ ActionExecOne(&source, &section->actions[idx], NULL);
}
}