aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-onload.c
diff options
context:
space:
mode:
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);
}
}