aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-config.c
AgeCommit message (Collapse)AuthorFilesLines
2018-10-23Added an option to color out the ouputLoïc Collignon1-4/+8
Enhance the readability using basic colorization to the logging system. As the '--call' option is almost unused, it doesn't require to have a shortname. So we use the '-c' and '--color' for the new colorization option, and keep only the longname for the 'call' option. Change-Id: I095fc9f38133fb742e0f0003540cd120feec8f5e Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2018-08-28Allow choice to trap or not program faultsJosé Bollo1-1/+58
The binder traps faults by default to recover as much as possible from unexpected errors. Developers may need to remove that behaviour to get core file. This introduces 2 ways to set or remove the trapping of faults: - the environment variable AFB_TRAP_FAULTS - the command line option --trap-faults Both take a boolean value set using on of the following words: 1 yes true on -- enable trapping of faults (the default) 0 no false off -- disable trapping of faults Bug-AGL: SPEC-1702 Change-Id: I6c6a3b933dbda9922a6079c390a601c533d49e55 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-08-28main-afb-daemon: Set AFB_ROOTDIR and AFB_WORKDIR in environmentJose Bollo1-2/+2
It may be difficult to retrieve the root directory from bindings and from process spawn by option --exec. In the same way, well identifying the workdir might interest programs or bindings. So, from now, the environment variables below are set: - AFB_ROOTDIR: identify the rootdir as set by --rootdir and in the context of AGL it will be the widget directory - AFB_WORKDIR: identify the workdir as set by --workdir To avoid any confusion, the function realpath is used to export absolute path names. Bug-AGL: SPEC-1694 Change-Id: Id272e009ca975e28aaab8b14fa2a98fbd2216e73 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh> Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-08-02Add ability to provide binding settingsJosé Bollo1-34/+116
Change-Id: Iab93a26340fa9743a58ca43cd903bbf31c783e5b Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-07-25Fix some more memory leaksJose Bollo1-27/+3
While making coverage test, few leaks appeared. This corrects the last discorvered ones. Change-Id: Id9e508bc9412072b628742971b02dd3d62799f3f Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-07-25afb-config: Rewrite the config as JSON objectJosé Bollo1-644/+491
Despite its poor performance, this changes is good at the end because: - it allows to put config in files - it removes dirty code to translate to JSON - it removes dirty code to dump the config - it unifies code for scanning hook's flag's names - it improves unity of naming between option's names and JSON's names Change-Id: I2487c8746d78a0cff80505a12b9fa60e40da9951 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-07-24json-c: Remove escaping of slashsJosé Bollo1-0/+3
By default json-c escapes the slashes. This is almost ugly and unuseful. But the resolution (with JSON_C_TO_STRING_NOSLASHESCAPE) was introduced lately by json-c. Integrate it as much as possible. Change-Id: Ia9c4bee78dc11df1ee9640cb04311991bd860e43 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-07-19afb-config: Simplify version printflounder_5.99.2flounder/5.99.25.99.2José Bollo1-52/+45
Change-Id: Ia9fc00fbb04a27a46dd66cb60e9b359645f9dc11 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-07-13afb-config: Fix wrong error message and more infoJosé Bollo1-3/+21
The wrong value of the log option wasn't displayed. The output of --version now prints more compile options. Change-Id: I09b8b66279a10cd4b2b6d460b3dbaeb370b3dadd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-06-22Improve documentation of api v3José Bollo1-102/+90
The documentation is improved to reflect the new version. Tune the options Change-Id: I894c3db3bc0c10e89db66a9a51a9ad049bb8c0c4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-06-15api-v3: First draftJosé Bollo1-52/+184
This commit introduces the bindings v3 API for bindings. The documentation has still to be improved and will come very soon. Change-Id: I8f9007370e29f671fdfd1da87fff7372a17db7af Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-06-13Make DBUS transparency optional (off by default)José Bollo1-17/+44
The implementation of API transparency through DBUS is not used at the moment. To improve independancy to systemd (it relies on systemd library) removing it should be possible. Change-Id: I5750a92527dc3e9cf7dcd27625dce6a020797a3d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-27Update date of copyright noticesJosé Bollo1-1/+1
Change-Id: If9d7e7728df086fbb7214f1de5cbec35cd2f1d9b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-26afb-config: Add traceses for tracing sessionsJosé Bollo1-1/+17
Change-Id: I9d36eb9eb4991066f94b1340262ad27467fc591e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-15afb-config: Fully exclude config monitoringJosé Bollo1-0/+4
Change-Id: I93b3d49f46d4dec607b08cc439b6cb06cf68ec32 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-15afb-config: Increase the default timeout of sessionsJosé Bollo1-2/+2
The management of sessions is not very well understood actually. People are using it without refreshing the token. This has the effect that the binder closes sessions after one hour. So no demo can run more than one hour! Increasing the timeout to more than one year will solve the demo problem but will not fully solve the overall problem. Bug-AGL: SPEC-1296 Bug-AGL: SPEC-1293 Change-Id: Icb9adb4939a138c19be36280bf1e6643d04489ae Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-13afb-config: export config to jsonJosé Bollo1-2/+91
Change-Id: I8918733753ec791e77eb8a71032ccdb35fa68d71 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-09afb-config: Improve doc of option --tokenJosé Bollo1-1/+1
Change-Id: I196c7f2b216e031f52b208e19c6c2df8593d27c5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-11-29afb-config: Check environment variablesJosé Bollo1-0/+35
The following environment variables allows several setting by the environment: * AFB_TRACEREQ, AFB_TRACEDITF, AFB_TRACESVC, AFB_TRACEEVT These variables allows setting of options --tracereq, --traceditf, --tracesvc, --traceevt * AFB_LDPATHS Set the option --ldpaths Change-Id: I22700c658ce3fa1ceb15eab8f67adaaf41627b8f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07Set Version 4.1José Bollo1-10/+13
Change-Id: I752ab6fa12de2d3a3b739c5d090d56222d0ac457 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07Improve handling of verbosity in bindingsJosé Bollo1-1/+0
The macro AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO is removed. The macro AFB_BINDING_PRAGMA_NO_VERBOSE_UNPREFIX is removed. The macro AFB_BINDING_PRAGMA_KEEP_VERBOSE_UNPREFIX is now used to activate the weakly named verbose macros DEBUG, INFO, NOTICE, WARNING, ERROR. The macros AFB_BINDING_PRAGMA_NO_VERBOSE_DATA and AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS can be used to tune what verbose parts are to be emitted: If AFB_BINDING_PRAGMA_NO_VERBOSE_DATA is defined then the macro will only report the file and the line that emitted the message. This mode is intended to reduce the count of static data plugin the binary. If AFB_BINDING_PRAGMA_NO_VERBOSE_DATA is not defined and AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS is defined, this is the opposite: the messages are emitted but not the file, line and function. When none of these 2 are difened, everything is emitted: the message and the details. Change-Id: Ibb83cd435797fadf90626cb06bbda77f0f8b3cde Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-29afb-config Copies the values of option --execJosé Bollo1-2/+27
Not copying is not possible if the name of the process is changed. Change-Id: I52122c84234ac275975dae47c23c9d7240b82df8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-29Add option --name for naming the processJosé Bollo1-1/+9
This option allows to set the command line and the thread name of the main process. The value can contain spaces that will be replaced by nulls. Change-Id: I895270a24663467b16fb3cd8fc3218b7b003b6bb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-29afb-config: update the output of the configJosé Bollo1-1/+9
Change-Id: I1dbc3c0b0c84cb34da1c8851044a6e72e4dfbd34 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-28fix typoStephane Desneux1-6/+6
Change-Id: Ifb2de3c13f814f16f23ead9357f4fec97b3e675c Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
2017-08-27monitoring: add default page index.htmlJosé Bollo1-1/+1
This allows to acces monitoring interface using url HOST/monitoring/ when option --monitoring is set. Change-Id: If7dfc89e4c4db0d87ec5c8e74f9243691a3ec0e8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-27afb-config: rework on option --random-tokenJosé Bollo1-22/+7
When set, this option will enforce a random token in any cases. Not using the option --token has the same effect asking for a random token. So the option now serves to enforce a random token. Change-Id: Iea2cee44b95d5479c36217d312ab6e8ce6726005 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-27monitoring: Add option --monitoringJosé Bollo1-0/+19
Installs basic interface for monitoring and add the option --monitoring / -M to activate the alias /monitoring. This makes the page /monitoring/monitor.html available. Change-Id: Iebe0959f0a5e7c396fe7ce6862d0f9c883733824 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-27afb-config: Add short -p option for --portJosé Bollo1-3/+5
Change-Id: Iae8475559ee2381ee7d687c6afc2e6ce7145ebf3 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-25afb-config: copy string valuesJosé Bollo1-5/+16
Change-Id: Ibbc5924adef104d9ec7399e7943baa1d799d2572 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-25afb-config: Improve naming (cosmetic)José Bollo1-8/+8
Change-Id: Ib3133cbcd458fbd1ca1ee5aac64700c9ebc83b60 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-25Add option --no-ldpaths to avoid default ldpathsJosé Bollo1-2/+9
Instead of writing --ldpaths=/dev/null simply use the option --no-ldpaths Change-Id: Ia278989b90a079d998ba0cbb7a6bb78c46d58090 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-25Add option --weak-ldpaths (for weak loading path)José Bollo1-2/+7
This option allows to specify a loading path where binding that fails on load are ignored. Change-Id: Ie0646f88ba9207dd117737a8b251a7a42f424f02 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-01Add hooking for eventsJosé Bollo1-1/+16
Change-Id: If5fe736e04c9f4298302c3cbba568f1d6346ee67 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-01Add backward compatibility and remarksJosé Bollo1-1/+1
Change-Id: Ia261e2d9efce399b210f834c1acb679215021edd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-30Adds hooks for service (svc)José Bollo1-0/+12
Change-Id: I42265fcee9eae8219ef0cf56d3c8446d2c0fc015 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-04Prepare bindings version 2José Bollo1-1/+1
Change-Id: Ic9e417d9a36f5da08883c3ded127d8350ff893cc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-11Add startup call in command lineJosé Bollo1-1/+8
The option -c (aka --call) allows to specify calls to api/verb at startup. The calls are made sequentially. Change-Id: I7f087dce71480fe288cca355c209a4c8ccf4f4b9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-10Refactor setting of directoriesJosé Bollo1-3/+3
When not specified, the default directories are now ".". The workdir is relative to the current directory and other directories are relative the the workdir. Change-Id: I52c013e3a3c93b3f984903562cf0c56d990900e6 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-07Add hooking of daemon interfaceJosé Bollo1-1/+16
Change-Id: I5840609f4300ade98412e8527ac5ce1f1e8c0c59 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-27Remove option readyfdJosé Bollo1-7/+0
This option is no more useful. Instead it is possible to use systemd notify feature. Change-Id: I8dd286242d3dc74238ca0908e83072367874d19e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-02-16Update documentation of --roothttp option.Sebastien Douheret1-5/+5
By default when roothttp option is not set, no files are served but note that apis are still available. Change-Id: I461b6c94d4d16cf873c0f8fb2543576595ed24c1 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2017-01-12Improves documentation and directory managementJosé Bollo1-24/+36
Change-Id: I21c102f7439343476765c65011664feece2d2c18 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-11Add option --random-tokenJosé Bollo1-49/+76
Also fix a bug in use of getopt_long. Change-Id: Iffc90104665664c8e5a61fbee70f03f3cdb660cb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-05Adds options --no-httpd and --execJosé Bollo1-6/+31
The option option --exec use the remaining arguments of the command line (at the right of --exec) as a command to launch with its arguments. Arguments can use @p (for port), @t (for token) or @@ for @. When the option --exec is given, the command is launched as soon as afb-daemon is ready. When the command die, afb-daemon exits and before exiting, afb-daemon kills the launched command and its childs. The option --no-http forbids the activation of the HTTP server. Change-Id: Icdd91d84c818796b5ac6ea5d33ff3549a2fe3c25 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-04adds short option for verbosityJosé Bollo1-11/+70
Change-Id: I2282057344b2b986520f1a76f5a3c0a827d63075 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-04allows to repeat option --ldpathsJosé Bollo1-70/+75
Change-Id: Id07b02eaef35732416de2fb1c6b24f3f75979ed6 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-04Refactor of file main.cJosé Bollo1-0/+527
File main.c is splitted in 2 files, one for scanning arguments and the other for setting up the process. Change-Id: I5f2d7fd354392d13cdeac6c2a8fceaaf551dea22 Signed-off-by: José Bollo <jose.bollo@iot.bzh>