summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2017-07-11debug: Create a file indicating the waiting pointJosé Bollo2-22/+50
When AFB_DEBUG_WAIT is used, the file /tmp/afb-debug-<PID> is created and contains the name of the awaiting point (without tailing new line) Signals other than SIGINT are ignored when waiting for SIGINT. This improves the cleaning up. Example: the signal SIGTERM is delayed until after removal of the debugging indication file. Change-Id: Iea163f87e160f9a99bc10f7365920893752bd308 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-05afb-debug: add features for debuggingJosé Bollo4-0/+130
When compiled with -DAGL_DEVEL or -DAFB_INSERT_DEBUG_FEATURES afb-daemon interprets the environment variables AFB_DEBUG_BREAK and AFB_DEBUG_WAIT. The environment variable AFB_DEBUG_BREAK make afb-daemon emit a break (SIGINT) that should be treated by the debugger. The environment variable AFB_DEBUG_WAIT make afb-daemon wait for a break (SIGINT) to continue. This can be used to attach a debugger. The content of the variables AFB_DEBUG_BREAK and AFB_DEBUG_WAIT is a list of key names of the point where the action should occur. The list is separated by spaces or commas ','. Example: AFB_DEBUG_WAIT=main-entry,start-load The defined points are: main-entry, main-args, main-start, start-entry, start-load, start-start, start-http, start-call, start-exec. Here some of their characteristic: - main-entry: at the beginning befaore any other instruction - main-args: after parsing arguments - main-start: after daemonisation before starting - start-entry: at start entry - start-load: before loading bindings after initialisation of afb-daemon - start-start: after loading bindings befaore starting it - start-call: after init before starting HTTP server - start-http: after http server, before calling startup calls - start-exec: before running the --exec command Change-Id: Id405e749c590fb95f32e30a7d37c30b6412cf0a5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-05main: improve startJosé Bollo1-4/+4
1: emits the correct PID even if daemonized 2: run the startup calls before executing the client (if any) Change-Id: I7e06961d4a88bc6083aa1bc48ccedf57b76ea268 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-05Make status commonJosé Bollo7-40/+41
Make all error status for bindings use a common convention: a negative value means an error. Change-Id: Id09610051295810f04f00477d7ec1d9771bf7975 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-05afb-ws-json1: expose addref/unref functionsJosé Bollo2-5/+7
Change-Id: Ie264540d20e3a7afbbf2cd16cd54508d07f35034
2017-07-05Bindings V2: reintroduce field 'info' for verbsJosé Bollo4-4/+12
CAUTION, this breaks binary compatibility Change-Id: I67acfffe1f04cdddee0ad1230b227b080da1ab06 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-29Fix bad error reportingdab_3.99.2dab/3.99.23.99.2José Bollo1-0/+3
The use of %m was buggy due to the implementation of 'vverbose': it always returned ENOTTY Inappropriate ioctl for device Change-Id: Idedeefa44ec3cf301d75cd542c54c35a208886a1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-28handle more exceptionnal signalsJosé Bollo1-2/+2
Change-Id: I956cda0a437c782b1b39689330429bcba06c1804 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-28Add backtrace on errorsJosé Bollo1-2/+25
Change-Id: Id2ce3a62d97fd4148d661b34f7507d7a4bec4fba Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-12Fix issue in using systemd socket activationJosé Bollo1-2/+2
When afb-daemon was launched without systemd it crashed in sd_fds_for. Change-Id: I481f5d1a24ec45f8cacae32792b2e47dfa62f611 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-07Fix concurrency issue in handling referencesJosé Bollo3-14/+15
Change-Id: Iaae331fbdadb88f26057a64193a026950dcb56e4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-02Add 'afb_daemon_require_api'José Bollo3-4/+56
This solution is at this time the best one to allow asynchronous calls within initialisation of bindings. Change-Id: I21ba3a74b4e93eec238a11dd51bc6b58c483308d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-02Provide efficient store/unstore for afb_reqJosé Bollo12-18/+106
Change-Id: I231e2506f58227fb8d192df042539b1551a765c5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-02Localize construction of afb_argJosé Bollo3-24/+16
Change-Id: I08f1bc228c419243044949aa3c4094873932d3f2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-02Improve start_api functionJosé Bollo1-11/+15
Change-Id: I8ef676eb501c80a77944f88100119e8ae8784259 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-02Fix error on initialisationJosé Bollo4-6/+8
Change-Id: If6a988359b4d2747cefdd683b6328f5b36e37548 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-02Fix issue when JSON value is NULL in xreqJosé Bollo1-1/+3
Change-Id: Ifb84a77abb0fee947fb05d80ac8276a8ede988af Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-01Fix bug in websocket on empty packetsJosé Bollo1-3/+3
Change-Id: I21d6e36df183b798539cf2a378976cc595a77029 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-01Enforce starting services on needJosé Bollo3-84/+90
Also remove default api verbs because it wasn't used actually and it wasn't compatible with this evolution. Change-Id: I863b99eddd418f771011bb35b4bcea763046224e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-01fix a warning on 32 bitsJosé Bollo1-1/+1
Change-Id: I03c50694470059f11e47b51a29e3df6929125752 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-01Improve log output formatJosé Bollo3-154/+72
Also rename of field 'prefix' to 'api' in afb_ditf Change-Id: Iaff49a3e829bca6e33023c888e95fb18fa0b85d8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-01Add hooking for eventsJosé Bollo7-27/+435
Change-Id: If5fe736e04c9f4298302c3cbba568f1d6346ee67 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-01Add backward compatibility and remarksJosé Bollo2-2/+3
Change-Id: Ia261e2d9efce399b210f834c1acb679215021edd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-31Return API description through websocketJosé Bollo1-3/+180
Change-Id: Iab10ed193bf6f6fc4240f6856c5835e35cd85dfa Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-31Add logging by requestJosé Bollo4-3/+75
Change-Id: I6dda714bcb8c36392c14a1981cfb8960f3db45b8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-31fix bad exit status reportJosé Bollo1-1/+0
Change-Id: Ieb3aac9610c3e60702fe709f283f5dc1805623d8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-30Make api descriptions uniqueJosé Bollo2-29/+77
Before this commit, the bindings version 1 were described differently from the bindings version 2. They now all describes themselves equally using openAPI 3. Change-Id: I73c2017d0bcbf3c3b01db0c58b03e328e4f44fda Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-30Adds hooks for service (svc)José Bollo9-31/+364
Change-Id: I42265fcee9eae8219ef0cf56d3c8446d2c0fc015 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-30fix commentsJosé Bollo2-4/+4
Change-Id: I6a3b2df272a1c88c530fd229ba612ee30160e3cc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-30fix bug in hooking verbose callsJosé Bollo1-1/+4
Change-Id: I879d05968521a25cab73f65dad02a52357e62dab Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-30Record API names in service descriptorsJosé Bollo4-8/+17
Change-Id: Ie437a6987df7f27a4a68b9c022d8cad8ab4f2cfe Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-30Bindings V1: allows to receive eventJosé Bollo2-5/+7
Don't enforce anymore to have the function 'afbBindingV1ServiceInit' defined when expecting events through 'afbBindingV1ServiceEvent'. This will allow to handle broadcasted events. Change-Id: Ib75904487ad99fdc50813deaf6013f4ba4c47421 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-29Moves library resolution on top (hack)José Bollo1-41/+1
Avoid to tune executable byu executable. Should be redefined later. Change-Id: I02e55e642c1797768b7dbcd8406f59199a56891d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-29Relax authorisation checlk for selfJosé Bollo4-5/+4
Change-Id: I115bbebb2f51be92578d1cc6b2fb5ae89813b630 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-29Add vfail and vsuccess interfacesJosé Bollo5-0/+40
This now factorizes code needed to asprintf the arguments in an allocated string. But the most interesting effect is the ability to handle va_list of arguments. It can be used for library of tools. Change-Id: I4ba74c9984786f07abe0c7e53d7ef79dca863735 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-29Cleanup legacy internal functionsJosé Bollo3-83/+18
The functions afb_req_raw and afb_req_send are internal. They are now no more visible from bindings. Change-Id: I1f250a1800168a9c3772375477bf37a501f134a0 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-29Add 'afb_service_call_sync' functionJosé Bollo6-43/+140
This new function allows to call features for the services synchronously. Also refactoring how are handled arguments to calls. The call to 'json_object_put' is now always done by the binder. Change-Id: I910517da75b179aeafc824da4ce29bc299711990 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-29afb-client-demo add options -H and -rJosé Bollo1-8/+58
The option -H (or --human) allows to output the emited JSON object as pretty formatted for being readable by human. The option -r (--raw) can be used in this case to still continue to print the raw output. Change-Id: I1da531794fb243413741f067cfea79f670c3a626 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-24fix concurrency for afb_msg_json_reply_errorJosé Bollo1-6/+1
Change-Id: I37ab68217c733456810e7e9ceb4e2e6c058f1b5b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-24Handles subcall sync within xreqJosé Bollo4-143/+138
Change-Id: Ieac7c589ddadfb67761332443a3fd92038b6d548 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-22Bindings V2: Remove explicit references to daemon/serviceJosé Bollo12-139/+215
Usage shown that managing daemon interface and service interface wasn't obvious. This evolution hides the complexity by setting up an internal hidden variable. Change-Id: I667b1ee4e3a7b5ad29d712ee20ad5dd1878b97f3 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-19Add json2c for including json in C filesJosé Bollo2-0/+182
Change-Id: I08d8f1c249d5612831fcbc66fe5d0caee4e3a73d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-19Bindings V2: rename init functionsJosé Bollo4-13/+17
The new naming is closer to the functionnal design and closer to V1 names. Change-Id: I8970338056a30564b84eaa1a7da6df3a9e6aa579 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-19bindings v2: Enforce to explicitely ask for concurrencyJosé Bollo1-1/+35
Change-Id: Ic20d1eb1c8515cd86444ad62b0daacbcd75e9b7e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-19Bindings V2: Refactor session flagsJosé Bollo3-18/+46
Change-Id: Idb104b3db69d785b11446fe9b66084839290362f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-19Fix cmake dependencydab_3.99.1dab/3.99.13.99.1Ronan Le Martret1-7/+8
* update documentation (get libmicrohttpd>=0.9.54 from upstream). Change-Id: I361708fecd3b670dba0f32230fa3bcbd86fa9c55 Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
2017-05-18Fix a bug in subscribers countingJosé Bollo1-3/+4
To avoid as much as possible allocation/deallocation when possible sequences of subscribe/unsubscribe are encountered, the watch strucutre of events is destroyed only when either the event or the client is destroyed. This commit fixes a bad handling in the count of active subscribers. Change-Id: I3f240e69c3b21356ff07f584fe9bfb578d46732b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-15Fix the timer signal numberJosé Bollo1-1/+1
Change-Id: I2dc7520f41472afefc31be7d3ac1a205611c1828 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-12free SIGALRM for boost timersJosé Bollo2-4/+6
Change-Id: Ib6825c21b6589db6c7e9b8c5a179c347bcc0a93d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-11generate skeleton from OpenAPI 3José Bollo4-353/+566
Change-Id: Ia2c9d42a12e9b425d34a3a70ae255d82a9320e8c Signed-off-by: José Bollo <jose.bollo@iot.bzh>