aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-plugin.c
AgeCommit message (Collapse)AuthorFilesLines
2018-12-17Update since the conversion to libraryRomain Forlot1-54/+51
Use the latest submodule git master branch revision. Some modifications has been lost since like the getter/setter functions and the plugin loading process. Change-Id: Ic0079f73bac46fba71f3de523a0f28371f85c1e6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-17Shared library: update to a v3 shared libraryRomain Forlot1-87/+83
- AFB_BINDING_VERSION = 3 - remove preprocessor variables - mandatory lua - name of library is ctl-utilities - does not work with v2 versions - remove afb-definitions.h - use of the GNUinstalldirs module to set the destination directories. Change-Id: Ifdf12885ffad5003ecbbcf3639af63060f0ebc7e Signed-off-by: Clément Bénier <clement.benier@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Fix: compiling a controller without LUA supportRomain Forlot1-0/+5
Bug-AGL: SPEC-1979 Change-Id: I92c22136a7e6bca6557a306824f7dc8c0ae2bf47 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Fix Parse pluginFrederic Marec1-1/+2
Fix PluginParse in ctlplugin to handle json_object case Change-Id: Iaeacaaef3dc09ca28229e16aed992003aa3b02cf Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
2018-12-13Reworked pluginConfig functionRomain Forlot1-55/+38
Reorganize the code to factorize some parts in pluginParse instead of pluginConfig. Also check the validity of the ctlConfig retrieved variable from the api Change-Id: I640adb7021c262b00f8f4284df9c07dd663fd9f3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Retrieve plugin list from api rather than a globalRomain Forlot1-0/+5
Change-Id: Iba7c564eea48495c76de8ca919725a2e4b332fd6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Add setter/getter for user free defined pointerRomain Forlot1-0/+8
Change-Id: I617f758890c3508f55d568b0e5c57c8c5d4d5dd1 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Correct an error when no plugins are definedJonathan Aillet1-1/+1
Correct an error when 'PluginConfig' function is called while no plugins are defined in passed json. Change-Id: I281a18f601f8ca1b7dfedfe48d1de37f4e9eded4 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-12-13Add a 'params' fields for controller pluginsJonathan Aillet1-3/+4
Add a 'params' fields for controller plugins. Can be used to send specific parameters to plugins functions (onload, init, ...). Change-Id: Ifb16f06a20453ef2bd1bc8a72bc2841dc12e323c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-12-13Add an Init step to the plugins loadRomain Forlot1-1/+10
The onload step could be considered as a preinit step. Init stage happens once all plugins are loaded and so you can refer to them to add new actions or configuration elements. Change-Id: I7986265bb1227208d0648bb2c56a1172b164faf1 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Migration to v3Romain Forlot1-1/+1
This makes controller fully compatible with binding v3 and also keeps the compatibility with the Pre-V3 + DYNAPI bindings. Change-Id: Iaa47e51b9cb964bbe2f050784fca355c780673f8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Adds v3 function to get binding settingsRomain Forlot1-1/+1
Adds v3 function to get binding settings waiting the real migration of the controller to v3 Change-Id: Iece3fcbcb81de807927765097c964e3272165947 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13Add path to the installed widget path.Romain Forlot1-8/+24
This resolves the link to the binding library then set the directory path to the widget installation location. Change-Id: Iaad0d8aad6e3b8bfdcdedde19fb7906adf5f9610 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-13More precise log message when loading a Lua fileRomain Forlot1-3/+1
This will indicates what is the error at the LUA file loading Change-Id: I258bf43a2200577998e05cf7b2253bdd510a468e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
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