aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-config.h
diff options
context:
space:
mode:
Diffstat (limited to 'ctl-lib/ctl-config.h')
-rw-r--r--ctl-lib/ctl-config.h59
1 files changed, 52 insertions, 7 deletions
diff --git a/ctl-lib/ctl-config.h b/ctl-lib/ctl-config.h
index f86a96f..68016e2 100644
--- a/ctl-lib/ctl-config.h
+++ b/ctl-lib/ctl-config.h
@@ -94,7 +94,10 @@ int ActionExecOne( CtlSourceT *source, CtlActionT* action, json_object *queryJ);
int ActionLoadOne(AFB_ApiT apiHandle, CtlActionT *action, json_object *, int exportApi);
int ActionLabelToIndex(CtlActionT* actions, const char* actionLabel);
-// ctl-config.c
+/*******************************************************************************
+ * ctl-config.h *
+ ******************************************************************************/
+
int CtlConfigMagicNew();
json_object* CtlConfigScan(const char *dirList, const char *prefix) ;
@@ -110,13 +113,28 @@ json_object* CtlConfigScan(const char *dirList, const char *prefix) ;
* @return char* absolute path to a file
*/
char* ConfigSearch(AFB_ApiT apiHandle, json_object *responseJ);
-char* CtlConfigSearch(AFB_ApiT apiHandle, const char *dirList, const char *prefix) ;
+char* CtlConfigSearch(AFB_ApiT apiHandle, const char *dirList, const char *prefix);
+
+/**
+ * @brief Best effort to initialise everything before starting
+ * Call afb_require_api at the first call or if there was an error because
+ * the CtlConfigExec could be called anywhere and not in binding init.
+ * So you could call this function at init time.
+ *
+ * @param apiHandle : an afb_daemon api handle, see AFB_ApiT in afb_definitions.h
+ * @param requireJ : json_object array of api name required.
+ */
void DispatchRequiredApi(AFB_ApiT apiHandle, json_object * requireJ);
+
+
int CtlConfigExec(AFB_ApiT apiHandle, CtlConfigT *ctlConfig) ;
CtlConfigT *CtlLoadMetaData(AFB_ApiT apiHandle,const char* filepath) ;
int CtlLoadSections(AFB_ApiT apiHandle, CtlConfigT *ctlHandle, CtlSectionT *sections);
-// ctl-event.c
+/*******************************************************************************
+ * ctl-event.h *
+ ******************************************************************************/
+
int EventConfig(AFB_ApiT apihandle, CtlSectionT *section, json_object *actionsJ);
#ifdef AFB_BINDING_PREV3
void CtrlDispatchApiEvent (AFB_ApiT apiHandle, const char *evtLabel, struct json_object *eventJ);
@@ -124,15 +142,42 @@ void CtrlDispatchApiEvent (AFB_ApiT apiHandle, const char *evtLabel, struct json
void CtrlDispatchV2Event(const char *evtLabel, json_object *eventJ);
#endif
-// ctl-control.c
+/*******************************************************************************
+ * ctl-control.h *
+ ******************************************************************************/
int ControlConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *actionsJ);
-// ctl-onload.c
+/*******************************************************************************
+ * ctl-onload.h *
+ ******************************************************************************/
int OnloadConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *actionsJ);
-// ctl-plugin.c
-int PluginAdd(AFB_ApiT apiHandle, CtlSectionT *section, json_object *newPluginsJ);
+/*******************************************************************************
+ * ctl-plugin.h *
+ ******************************************************************************/
+
+/**
+ * @brief Plugins definition loads. You have to call it at least twice, one for
+ * the configuration at binding preinit and the last one at init step to
+ * initilize a API interface for binding with version 2. The last call should
+ * not include any plugin definition to add.
+ *
+ * @param apiHandle an afb_daemon api handle, see AFB_ApiT in afb_definitions.h
+ * @param section The plugin section to process
+ * @param pluginsJ Json_object holding the plugins definitions to load.
+ * @return int 0 if success, other on failure
+ */
int PluginConfig(AFB_ApiT UNUSED_ARG(apiHandle), CtlSectionT *section, json_object *pluginsJ);
+
+/**
+ * @brief Permit to find a C callback stored in a plugin to attach it to an
+ * action as well as the plugin.
+ *
+ * @param apiHandle an afb_daemon api handle, see AFB_ApiT in afb_definitions.h
+ * @param action Action structure to use to store the callback if found
+ * @param callbackJ the callback definition to search
+ * @return int 0 if success, other on failure
+ */
int PluginGetCB (AFB_ApiT apiHandle, CtlActionT *action , json_object *callbackJ);
#ifdef __cplusplus