From 9777a02c7540fdec145feb948b4bbf1cd44c3352 Mon Sep 17 00:00:00 2001 From: fulup Date: Sun, 13 Aug 2017 16:50:34 +0200 Subject: Fix AFB_MESSAGE with null arguments --- Controler-afb/ctl-binding.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'Controler-afb/ctl-binding.h') diff --git a/Controler-afb/ctl-binding.h b/Controler-afb/ctl-binding.h index deef93c..01840b8 100644 --- a/Controler-afb/ctl-binding.h +++ b/Controler-afb/ctl-binding.h @@ -28,6 +28,11 @@ #endif #define STATIC static +#ifndef UNUSED_ARG +#define UNUSED_ARG(x) UNUSED_ ## x __attribute__((__unused__)) +#define UNUSED_FUNCTION(x) __attribute__((__unused__)) UNUSED_ ## x +#endif + // sharelib ctl-plugin* typedef struct { long magic; @@ -36,6 +41,9 @@ typedef struct { #define CTL_PLUGIN_REGISTER(pluglabel) CtlPluginMagicT CtlPluginMagic={.magic=CTL_PLUGIN_MAGIC,.label=pluglabel}; struct afb_binding_data_v2; +// ctl-misc.c + + // polctl-binding.c PUBLIC int CtlBindingInit (); @@ -49,12 +57,14 @@ PUBLIC void ctlapi_event_test (afb_req request); // ctl-policy // ----------- - typedef enum { CTL_SCAN_FLAT=0, CTL_SCAN_RECURSIVE=1, } CtlScanDirModeT; +PUBLIC json_object* ScanForConfig (char* searchPath, CtlScanDirModeT mode, char *pre, char *ext); +PUBLIC const char *GetBinderName(); + typedef enum { CTL_MODE_NONE=0, CTL_MODE_API, @@ -70,10 +80,12 @@ typedef struct DispatchActionS{ const char* call; json_object *argsJ; int timeout; - int (*actionCB)(afb_req request, struct DispatchActionS *action, void *context); + int (*actionCB)(struct DispatchActionS *action, json_object *queryJ, void *context); } DispatchActionT; PUBLIC int DispatchInit(void); +PUBLIC int DispatchOneOnLoad(const char *onLoadLabel); +PUBLIC void DispatchOneEvent(const char *evtLabel, json_object *eventJ); PUBLIC void ctlapi_dispatch (char* control, afb_req request); // ctl-lua.c @@ -85,8 +97,7 @@ typedef enum { } LuaDoActionT; PUBLIC int LuaLibInit (); -PUBLIC json_object* ScanForConfig (char* searchPath, CtlScanDirModeT mode, char *pre, char *ext); -PUBLIC int LuaCallFunc (afb_req request, DispatchActionT *action); +PUBLIC int LuaCallFunc (DispatchActionT *action, json_object *queryJ); PUBLIC void ctlapi_lua_docall (afb_req request); PUBLIC void ctlapi_lua_dostring (afb_req request); PUBLIC void ctlapi_lua_doscript (afb_req request); -- cgit 1.2.3-korg