diff options
m--------- | app-controller-submodule | 0 | ||||
m--------- | conf.d/app-templates | 0 | ||||
-rw-r--r-- | conf.d/cmake/config.cmake | 2 | ||||
-rw-r--r-- | src/aft.c | 28 | ||||
-rw-r--r-- | src/mapis.c | 6 |
5 files changed, 18 insertions, 18 deletions
diff --git a/app-controller-submodule b/app-controller-submodule -Subproject e3f2c45eb9c65560f269be9d2a1f4385142c457 +Subproject 4386ec54f811f19a14d0f60688321d4a1a69b78 diff --git a/conf.d/app-templates b/conf.d/app-templates -Subproject 9c1a0fb10dda08bebffb490152b5cdde6420e18 +Subproject f0b24b0809e1677665760d4341a4169d519079b diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake index 02c1ac7..ea9227b 100644 --- a/conf.d/cmake/config.cmake +++ b/conf.d/cmake/config.cmake @@ -129,7 +129,7 @@ add_definitions(-DLUA_GLOB_PATTERN="/var/?.lua\\\;") add_definitions(-DCONTROL_PLUGIN_PATH="./var:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/lib/plugins:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/var:${INSTALL_PREFIX}/${PROJECT_NAME}/lib/plugins:${INSTALL_PREFIX}/${PROJECT_NAME}/var:${CMAKE_BINARY_DIR}/package/lib/plugins:${CMAKE_BINARY_DIR}/package/var") add_definitions(-DCONTROL_CONFIG_PATH="./etc:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/etc:${INSTALL_PREFIX}/${PROJECT_NAME}/etc:${CMAKE_BINARY_DIR}/package/etc") add_definitions(-DCTL_PLUGIN_MAGIC=1286576532) -add_definitions(-DUSE_API_DYN=1 -DAFB_BINDING_VERSION=3 -DAFB_BINDING_WANT_DYNAPI) +add_definitions(-DAFB_BINDING_VERSION=3) # Optional location for config.xml.in # ----------------------------------- @@ -26,7 +26,7 @@ #define CONTROL_PREFIX "aft" // default api to print log when apihandle not avaliable -afb_api_t AFB_default; +AFB_ApiT AFB_default; static CtlConfigT *CtrlLoadConfigJson(AFB_ApiT apiHandle, json_object *configJ); static CtlConfigT *CtrlLoadConfigFile(AFB_ApiT apiHandle, const char *configPath); @@ -51,8 +51,8 @@ static void ctrlapi_ping(AFB_ReqT request) { static void ctrlapi_load(AFB_ReqT request) { const char *configPath = NULL; - json_object *reqArgs = afb_req_json(request), *configuration = NULL ; - afb_api_t apiHandle = afb_req_get_api(request); + json_object *reqArgs = AFB_ReqJson(request), *configuration = NULL ; + AFB_ApiT apiHandle = AFB_ReqGetApi(request); if(!json_object_object_get_ex(reqArgs, "configuration", &configuration)) { AFB_ReqFailF(request, "Error", "No 'configuration' key found in request arguments: %s", json_object_get_string(reqArgs)); @@ -93,11 +93,11 @@ static AFB_ApiVerbs CtrlApiVerbs[] = { {.verb = NULL} /* marker for end of the array */ }; -static int CtrlLoadStaticVerbs(afb_api_t apiHandle, AFB_ApiVerbs *verbs) { +static int CtrlLoadStaticVerbs(AFB_ApiT apiHandle, AFB_ApiVerbs *verbs) { int errcount = 0; for(int idx = 0; verbs[idx].verb; idx++) { - errcount += afb_api_add_verb( + errcount += AFB_ApiAddVerb( apiHandle, CtrlApiVerbs[idx].verb, NULL, CtrlApiVerbs[idx].callback, (void *)&CtrlApiVerbs[idx], CtrlApiVerbs[idx].auth, 0, 0); } @@ -109,7 +109,7 @@ static int CtrlInitOneApi(AFB_ApiT apiHandle) { // Hugely hack to make all V2 AFB_DEBUG to work in fileutils AFB_default = apiHandle; - CtlConfigT *ctrlConfig = afb_api_get_userdata(apiHandle); + CtlConfigT *ctrlConfig = AFB_ApiGetUserData(apiHandle); return CtlConfigExec(apiHandle, ctrlConfig); } @@ -118,7 +118,7 @@ static int CtrlLoadOneApi(void *cbdata, AFB_ApiT apiHandle) { CtlConfigT *ctrlConfig = (CtlConfigT *)cbdata; // save closure as api's data context - afb_api_set_userdata(apiHandle, ctrlConfig); + AFB_ApiSetUserData(apiHandle, ctrlConfig); // add static controls verbs int err = CtrlLoadStaticVerbs(apiHandle, CtrlApiVerbs); @@ -131,12 +131,12 @@ static int CtrlLoadOneApi(void *cbdata, AFB_ApiT apiHandle) { err = CtlLoadSections(apiHandle, ctrlConfig, ctrlSections); // declare an event event manager for this API; - afb_api_on_event(apiHandle, CtrlDispatchApiEvent); + AFB_ApiOnEvent(apiHandle, CtrlDispatchApiEvent); // init API function (does not receive user closure ??? - afb_api_on_init(apiHandle, CtrlInitOneApi); + AFB_ApiOnInit(apiHandle, CtrlInitOneApi); - afb_api_seal(apiHandle); + AFB_ApiSeal(apiHandle); return err; } @@ -183,17 +183,17 @@ static int CtrlCreateApi(AFB_ApiT apiHandle, CtlConfigT *ctrlConfig) { wrap_json_object_add(ctrlConfig->configJ, resourcesJ); wrap_json_object_add(ctrlConfig->configJ, eventsJ); - if(! afb_api_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, CtrlLoadOneApi, ctrlConfig)) + if(! AFB_NewApi(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, CtrlLoadOneApi, ctrlConfig)) return ERROR; return 0; } -int afbBindingEntry(afb_api_t apiHandle) { +int afbBindingEntry(AFB_ApiT apiHandle) { size_t len = 0, bindingRootDirLen = 0; char *dirList, *afTestRootDir, *path; const char *envDirList = NULL, *configPath = NULL, *bindingRootDir = NULL; - json_object *settings = afb_api_settings(apiHandle), *bpath = NULL; + json_object *settings = AFB_GetApiSettings(apiHandle), *bpath = NULL; AFB_default = apiHandle; AFB_ApiDebug(apiHandle, "Controller in afbBindingEntry"); @@ -214,7 +214,7 @@ int afbBindingEntry(afb_api_t apiHandle) { envDirList = getEnvDirList(CONTROL_PREFIX, "CONFIG_PATH"); - bindingRootDir = GetBindingDirPath(); + bindingRootDir = GetBindingDirPath(apiHandle); bindingRootDirLen = strlen(bindingRootDir); if(envDirList) { diff --git a/src/mapis.c b/src/mapis.c index ba524a0..ba72857 100644 --- a/src/mapis.c +++ b/src/mapis.c @@ -32,7 +32,7 @@ static int LoadOneMapi(void *data, AFB_ApiT apiHandle) { int savedCount = 0, count = 0, idx = 0; CtlActionT *savedActions = NULL, *newActions = NULL; struct mapisHandleT *mapisHandle = (struct mapisHandleT*)data; - CtlConfigT *ctrlConfig = afb_api_get_userdata(mapisHandle->mainApiHandle); + CtlConfigT *ctrlConfig = AFB_ApiGetUserData(mapisHandle->mainApiHandle); if(PluginConfig(apiHandle, mapisHandle->section, mapisHandle->mapiJ)) { AFB_ApiError(apiHandle, "Problem loading the plugin as an API for %s, see log message above", json_object_get_string(mapisHandle->mapiJ)); @@ -85,7 +85,7 @@ static int LoadOneMapi(void *data, AFB_ApiT apiHandle) { } // declare an event event manager for this API; - afb_api_on_event(apiHandle, CtrlDispatchApiEvent); + AFB_ApiOnEvent(apiHandle, CtrlDispatchApiEvent); return 0; } @@ -114,7 +114,7 @@ static void OneMapiConfig(void *data, json_object *mapiJ) { json_object_object_del(mapiJ, "events"); mapisHandle->mapiJ = mapiJ; - if (!afb_api_new_api(mapisHandle->mainApiHandle, uid, info, 1, LoadOneMapi, (void*)mapisHandle)) + if (!AFB_NewApi(mapisHandle->mainApiHandle, uid, info, 1, LoadOneMapi, (void*)mapisHandle)) AFB_ApiError(mapisHandle->mainApiHandle, "Error creating new api: %s", uid); } } |