aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2017-10-23websocket: Tune maximum received lengthdab_4.0.3dab/4.0.34.0.3dabJosé Bollo2-1/+18
This commit increase the count of data that is accepted by default from 65,000 to 1,048,500. It also offers new functions to tune that value. Change-Id: Iecf0b8c308e8287582819a8769859c39e46919c2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07afb-api-so: take care of SIGSEGV in dlopendab_4.0.2dab_4.0.1dab/4.0.2dab/4.0.14.0.24.0.1José Bollo1-3/+32
In some case, dlopen raise a segmentation fault. This commit takes care of this. Change-Id: I6cbe59de2422dafcdf3714d0539b1757511c100b Bug-AGL: SPEC-662 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07sig-monitor: handle SIGSEGV in backtraceJosé Bollo1-12/+38
There was cases were the backtrace raised a segmentation fault. This commit also improves unblocking of signals in handler. Change-Id: I09493d3ecc4b477660366ea213bf451c9ae7d517 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-11afb-websocket: update websocket protocolJosé Bollo1-1/+0
After integration of UPGRADE in libmicrohttpd, the header "Connection: Upgrade" has to be removed because it is now sent 2 times. This caused Webkit to fail to connect its websocket. Bug-AGL: SPEC-821 Change-Id: Ib9744208cf7175f0c56e513b18b53ab0a9b60b9f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-10afb-xreq: handle when no reply was sentJosé Bollo1-0/+2
Send an error reply if no reply was sent. Change-Id: Ibc5c98d22b9820f1f0b5370083f79a52213ddc61 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-08afb-evt: fix a bug discovered by clang-checkJosé Bollo2-10/+7
Change-Id: I6bb1dffeb17fdcaf6e3a2686651d35dd0b0500b9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-08afb-session: fix an over allocationJosé Bollo1-1/+1
Thanks to Markus Fritzsch and clang-check Change-Id: I4822eb14bff49680df05e472363228cc82566edf Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-08sig-monitor: dump the stack on SIGABRTJosé Bollo1-0/+2
Change-Id: Id21c444d6d18a78f731458a43519a131515385c0 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-03afb-cred: fix default valuesJosé Bollo1-5/+9
Because SO_PEERCRED returns without error even when no data is available (tcp by example), the resulting uid is now tested. Also, for tcp, by default avoid by default to create a default user value. Instead, return NULL. This will allow client having an HTTP/Websocket connection to get full rights on the binder. Change-Id: I2defb585bf79c023e2391c2e18d6de17e5112770 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-03subcall_req: introduce afb_req_subcall_reqJosé Bollo3-16/+109
The function 'afb_req_subcall_req' can be used to make asynchronous subcalls. It improves the function 'afb_req_subcall' by automatically keeping the request opened for the callback and by passing it, the request, as an extra argument of the callback. Change-Id: I2dc79c01fc25c7a65b9c8cc9e001a5b85fba99df Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-02afb-xreq: integration of subcallsJosé Bollo4-242/+208
The file afb-subcall is now integrated within afb-xreq. It improves memory allocation and performance of synchronous calls. Change-Id: I4190199babbe0559527438b530b19ac9a35ec38b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-02afb-svc: allows NULL for callbacks or resultsJosé Bollo1-6/+16
This allows afb_service_call to set NULL callback and afb_service_call_sync to set a NULL result pointer. Change-Id: Ie16ae5557e6851d2f1e730ad32450489242b5daa Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-02afb-hook: renamingJosé Bollo1-4/+4
Change-Id: Ie1ac2eb96fb29711c38750c3babe7cbd4b472079 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-02afb-evt: unprefix event nameJosé Bollo1-1/+3
Removes the api prefix of the event name. Change-Id: I050dc86beb08659751c1e57b8d3ea233bac9e411 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-02afb-cred: provide default values of credentialsJosé Bollo1-1/+25
Change-Id: I3764edf986c01ef30e21ee1ec7e2b0098eec9e9e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-02afb-apiset: reduce verbosityJosé Bollo1-2/+2
Change-Id: Iceffd965f12f7afe658e374c29f13ab0abc8bb19 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-02debugging: add calls to 'personality'José Bollo2-0/+13
Insertion of calls to personality for the only pupose to be able to set breakpoint at some strategic places. The chosen places are: - After the debug wait point. The intend is to allow simulation of breakpoint after attaching to the waiting process. - Before starting the bindings but after loading it. The intend is to allow loading of symbols and setting of breakpoints in the debugged binding without attaching to afb-daemon that comes without debug symbols. Change-Id: Ie3bfce0956c9844586c7a5f8bd820acb7f58772c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-02debug: allow break after waitJosé Bollo1-9/+10
Change-Id: I634abe531606a30ba241c85bf650589c5f0ea4ca Signed-off-by: José Bollo <jose.bollo@iot.bzh>
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>