aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-plugin.h
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-05-07 17:05:00 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 15:02:54 +0100
commit777f6909df08215bf58d5901cdc155a3b56174c2 (patch)
tree02dcb2b41742d4b00961d64a4552926bb51e2735 /ctl-lib/ctl-plugin.h
parentd6b30258e3e794ecddd6cc2664cca90461a08286 (diff)
Loads l2c functions per plugin.
L2C functions are prefixed with either the chosen prefix or plugin uid by default. Change-Id: Id296ec629c803ab06cd05f5278fed3c48cbcf10e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-plugin.h')
-rw-r--r--ctl-lib/ctl-plugin.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/ctl-lib/ctl-plugin.h b/ctl-lib/ctl-plugin.h
index 5d505ac..85d9788 100644
--- a/ctl-lib/ctl-plugin.h
+++ b/ctl-lib/ctl-plugin.h
@@ -30,9 +30,6 @@ extern "C" {
#include <json-c/json.h>
-#define CONTROL_PLUGIN_EXT ".ctlso"
-#define CONTROL_SCRIPT_EXT ".lua"
-
// Waiting for a clean AppFW-V3 API
#ifdef USE_API_DYN
#define AFB_BINDING_VERSION dyn
@@ -165,6 +162,15 @@ extern "C" {
#define UNUSED_FUNCTION(x) __attribute__((__unused__)) UNUSED_ ## x
#endif
+#ifdef CONTROL_SUPPORT_LUA
+ typedef struct luaL_Reg luaL_Reg;
+
+ typedef struct CtlLua2cFuncT {
+ luaL_Reg *l2cFunc;
+ const char *prefix;
+ int l2cCount;
+} CtlLua2cFuncT;
+#endif
typedef struct {
const char *uid;
@@ -177,6 +183,9 @@ typedef struct {
AFB_ApiT api;
void *dlHandle;
void *context;
+#ifdef CONTROL_SUPPORT_LUA
+ CtlLua2cFuncT *ctlL2cFunc;
+#endif
} CtlPluginT;
typedef enum {
@@ -227,8 +236,9 @@ typedef struct {
} exec;
} CtlActionT;
+extern CtlPluginT *ctlPlugins;
-typedef void*(*DispatchPluginInstallCbT)(CtlPluginT *plugin, void* handle);
+typedef int(*DispatchPluginInstallCbT)(CtlPluginT *plugin, void* handle);
#define MACRO_STR_VALUE(arg) #arg
#define CTLP_CAPI_REGISTER(pluglabel) CtlPluginMagicT CtlPluginMagic={.uid=pluglabel,.magic=CTL_PLUGIN_MAGIC}; struct afb_binding_data_v2;