aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-06-29 19:37:03 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-06-29 19:38:23 +0200
commit80be8372affe146a6f98e6e0738ead86674cde49 (patch)
tree483ba1da7afea3179cf6e406dec12d12184ea9da
parent169992d18a1d0de4e290f1d5ac2887113e6cac65 (diff)
WIP Began the doxygen documentation works.sandbox/claneys/docs
Change-Id: I19df4c738249bfdb3986e5420e606b6c7824acad Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--ctl-lib/ctl-action.c14
-rw-r--r--ctl-lib/ctl-config.c9
-rw-r--r--ctl-lib/ctl-config.h59
-rw-r--r--ctl-lib/ctl-lua.c1
4 files changed, 60 insertions, 23 deletions
diff --git a/ctl-lib/ctl-action.c b/ctl-lib/ctl-action.c
index 043fa58..7edf5c2 100644
--- a/ctl-lib/ctl-action.c
+++ b/ctl-lib/ctl-action.c
@@ -161,7 +161,8 @@ void ParseURI(const char *uri, char **first, char **second)
*second = "";
}
-/*** This function will fill the CtlActionT pointer given in parameters for a
+/**
+ * This function will fill the CtlActionT pointer given in parameters for a
* given api using an 'uri' that specify the C plugin to use and the name of
* the function
*
@@ -197,7 +198,8 @@ static int BuildPluginAction(AFB_ApiT apiHandle, const char *uri, CtlActionT *ac
return 0;
}
-/*** This function will fill the CtlActionT pointer given in parameters for a
+/**
+ * This function will fill the CtlActionT pointer given in parameters for a
* given api using an 'uri' that specify the API to use and the name of the
* verb
*
@@ -227,16 +229,16 @@ static int BuildApiAction(AFB_ApiT apiHandle, const char *uri, CtlActionT *actio
return 0;
}
-/*** This function will fill the CtlActionT pointer given in parameters for a
- * given api using an 'uri' that specify the Lua plugin to use and the name of
+#ifdef CONTROL_SUPPORT_LUA
+/**
+ * This function will fill the CtlActionT pointer given in parameters for
+ * a given api using an 'uri' that specify the Lua plugin to use and the name of
* the function.
*
* Be aware that 'uri' and 'function' could be null but will result in
* unexpected result.
*
*/
-#ifdef CONTROL_SUPPORT_LUA
-
static int BuildLuaAction(AFB_ApiT apiHandle, const char *uri, CtlActionT *action) {
char *plugin = NULL, *function = NULL;
diff --git a/ctl-lib/ctl-config.c b/ctl-lib/ctl-config.c
index fcd0e02..4ab9ec9 100644
--- a/ctl-lib/ctl-config.c
+++ b/ctl-lib/ctl-config.c
@@ -114,15 +114,6 @@ static int DispatchRequireOneApi(AFB_ApiT apiHandle, json_object * bindindJ) {
return err;
}
-/**
- * @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 : a afb_daemon api handle, see AFB_ApiT in afb_definitions.h
- * @param requireJ : json_object array of api name required.
- */
void DispatchRequireApi(AFB_ApiT apiHandle, json_object * requireJ) {
static int init = 0, err = 0;
int idx;
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
diff --git a/ctl-lib/ctl-lua.c b/ctl-lib/ctl-lua.c
index 02487b5..59f13ff 100644
--- a/ctl-lib/ctl-lua.c
+++ b/ctl-lib/ctl-lua.c
@@ -1276,7 +1276,6 @@ int LuaConfigExec(AFB_ApiT apiHandle) {
int LuaConfigLoad(AFB_ApiT apiHandle) {
static int luaLoaded = 0;
int i;
- //int err = 0;
// Lua loads only once
if (luaLoaded) return 0;