aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-plugin.c
AgeCommit message (Collapse)AuthorFilesLines
2018-12-13Fixed character counting that was shortening paths8000ff1-2/+2
Change-Id: I16e2f87980229b08426060ec062615d2fa3c1494 Signed-off-by: 8000ff <clementmallejac@gmail.com>
2018-12-13Use prefix variable to find controller's pluginsRomain Forlot1-19/+16
Prefix is the most reliable variable to find files or variables for a controller, so this lets you access it wherever it is needed without using global hardcoded variables. This helps to search for controller's plugins in several locations depending on environment variables and hardcoded variables (CONTROL_PLUGIN_PATH, CONTROL_CONFIG_PATH). This implies also a change a LUA interpreter loading step to correctly set the package.path variables with the environment variables, too. Correct the missing 'extern' in function declarations. Depends-On: Ic448ff017e6158bec05895d63688b8968b5c6434 Change-Id: I0ad19242612559d1f4b66b6f9af9e7032d4675a8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Fix: plugin api assignement orderRomain Forlot1-2/+1
There was an issue because the assignement happens after the onLoad call. Change-Id: I97dc65ad2a14a6e72bb2f59bc443d9fc5779abee Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Always set the api member even if NULL.Romain Forlot1-1/+2
This should fix case where plugin doesn't have an onload section but need to set the apihandle to be able to use it later. Change-Id: I07d4d38ce236732575d97a3c0a01cb03acad255a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Ability to add a plugin after the initial loadRomain Forlot1-13/+56
Plugins normally lie in a dedicated section and loaded once for all. With this function we are able to load a plugin after the initial load. Change-Id: Iebacdfce836767089f164ebe5cff72c7e45803be Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Don't load two times a plugin even for LUARomain Forlot1-12/+13
Also detect problems when loading the script and report it. Change-Id: Iba22dcd0bbc6d7c307b5b7f66a56688ef3147250 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Fixed spelling of AFB_ReqSuccessSebastien Douheret1-1/+1
Also change event message from notice to debug level. Change-Id: I8dc891343ee7f744ea0e3c07455806eaf34c1d7e Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2018-12-13Fixed build warnings with gcc >= 7.3Sebastien Douheret1-2/+2
Reduced the number of warnings in native host configuration (here Tumbleweed) in order to not hide true/real warnings that may appear in the future. Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2018-12-13Fixed compilation warnings with gcc-7.2.0Thierry Bultel1-2/+2
Replaced some 'size_t' by 'int' Change-Id: Iaf58b4b65f9aa2e82c0a87af45f21ca62fa4d84e Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-12-13Good usage of strncat and strncpyRomain Forlot1-8/+13
This change ensure that there are no write over the destination buffer size Change-Id: Ic213e70fab83dfae39a8ff030c823a6ce68aab64 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Change lua2c JSON syntax.Romain Forlot1-6/+16
Clearer JSON writing config. Schema provide informations about objects Change-Id: I55e7c9bef442abaa577c59ab2005da1f315f9312 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Fix: changes key name.Romain Forlot1-1/+1
We could have several file Change-Id: Ia612cb6989a05cc47505ec8975ae825be160af2a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Use new version of function GetBindingDirPathRomain Forlot1-11/+11
That follow the last update in afb-helpers submodule used. Change-Id: Ia6149ae96c1591f3d0791f4263e8beafbe6e764d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13FormatRomain Forlot1-33/+34
Change-Id: Ied901f39cd6814e5afd9811248b0a1fb401f3e76 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Loads l2c functions per plugin.Romain Forlot1-33/+39
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>
2018-12-13Upgrade config schemaRomain Forlot1-71/+163
Change the way to load LUA scripts. They are now considerate as Plugin and loads with them. This imply rework of how to search and find plugins as well as the way to load LUA. Also load an harcoded LUA scripts providing LUA helpers and managing global variables lock unlock mechanism Change-Id: I64e38aa27278d0cfdca787155db2d0c89953f905 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Fix conversion compilation warningRomain Forlot1-2/+2
Change-Id: I0d5350c1e454bc118e4470ae7ff0eafe253cd2bf Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Add binding rootdir to searched path for conf and pluginsRomain Forlot1-1/+13
Change-Id: I4526dd9afc76ac9c63ecb6e800157a0678485955 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Fix segfault when no l2c functions definedRomain Forlot1-1/+1
Mark "ldpath" parameter as optional like it is. Change-Id: If32e078f5a4349ab895b1fd4b8f0a8c542d247a1 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Get back on track l2c functions.Romain Forlot1-6/+27
Change-Id: I8425f0de60a35b4e287c8829fe72cbca80bc55df Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Fix warning compile about uninitialized variableRomain Forlot1-2/+2
Change-Id: I5b07409a7d7c9b5e038accb973b3232775e40c23 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Avoid compile warning, memory leaks, lintingRomain Forlot1-0/+3
Change-Id: Ida18aeab20d5b894609c1a9c2f6fc2a71a0b4a23 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13wrong json unpacking fails.Romain Forlot1-1/+1
Change-Id: Ie0246192b014c3550207fab1fb6512aeb6e5bce1 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Get back lua2c functions parsed at plugin loadRomain Forlot1-4/+11
Format JSON unpack operations Change-Id: Iaed0988d8536ad1df60a32a610e69e35485fc9f8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Fix: strncpy does't add null char at the endRomain Forlot1-2/+2
Fix: handle null response from CtlScanConfig() Change-Id: Icbe2a649886998078adda35b0d0dfd1c46e8fe31 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Load afb_binding macros and stuff to pluginsRomain Forlot1-9/+24
Change-Id: I18a70e929530bb1cd5f7f68962edf975521b1c71 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13fix: wrong usage of strncat and strncpy functionRomain Forlot1-5/+5
3rd arguments match strlen of 2nd arguments and should not match the maximum length of destination variable. Change-Id: Ifebf6097bb995d0cf2c5633eb94d52d4517ade7b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13FormatingRomain Forlot1-22/+22
Change-Id: I2b805a60b67db1a72b429093256999673e2c3964 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13First working version as submoduleFulup Ar Foll1-9/+9
2018-12-131st V2/pre-V3 versionfulup1-29/+35
2018-12-13Remove NetbeansFulup Ar Foll1-0/+219