summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2017-08-08afb-trace: Add tracing features to API monitorJosé Bollo7-44/+1834
This api allows to receive events when particular actions are reached. At the moment, tracing is bound to the API monitor and can trace anything. In the future, this will not be the case and the API monitor will only allow to trace requests of its session. The tracing of all will be available for supervision only. Change-Id: I880852612c2f77ff5329496b16c75fe602db4090 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é Bollo6-16/+195
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-07-31afb-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-07-31Fix fallthrough warningsJosé Bollo4-1/+7
Change-Id: Ibe8e0b4e59ad4d5f0b0cca82ccdb3d0f035b0501 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-31afb-hook: renamingJosé Bollo1-4/+4
Change-Id: Ie1ac2eb96fb29711c38750c3babe7cbd4b472079 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-31wrap-json: add "for_all" functionsJosé Bollo2-0/+72
The "for_all" functions are facilities for handling collections of json objects Change-Id: Icaecb39e9f0108e1fb1c42bef2a90935feb312ed Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-31afb-evt: add internal push functionsJosé Bollo2-3/+33
For the implementation of monitoring, the event should be pushed without hooking internal. Change-Id: I4372bbc55e78c851db660a69bb2e60995fbdc88f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-31afb-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-07-31afb-cred: provide default values of credentialsJosé Bollo1-1/+25
Change-Id: I3764edf986c01ef30e21ee1ec7e2b0098eec9e9e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-31afb-apiset: reduce verbosityJosé Bollo1-2/+2
Change-Id: Iceffd965f12f7afe658e374c29f13ab0abc8bb19 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-31wrap-json: Fix warningsJosé Bollo1-12/+14
Fixes maybe-uninitialized warning Change-Id: I5416fb2c6cc017ddc53984475432fff90c41d42b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-31debugging: 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-07-28debug: allow break after waitJosé Bollo1-9/+10
Change-Id: I634abe531606a30ba241c85bf650589c5f0ea4ca Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-27afb-monitor: use of wrap-json unpackingJosé Bollo1-30/+28
Change-Id: Ibfcaa34c32cb4bbdedbaee08360ef829321c3035 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-27wrap-json: add unpacking tool for jsonJosé Bollo4-107/+892
The functions wrap_json_unpack, wrap_json_vunpack, wrap_json_check, wrap_json_vcheck, wrap_json_match and wrap_json_vmatch can be used to get items in a json object. These functions are likely to be compatible in the format with the unpacking functions of the library jansson [1]. [1] http://jansson.readthedocs.io/en/2.10/apiref.html#parsing-and-validating-values Change-Id: I18ad702498b9a70215d88b2a3c13bd0f6194bb45 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-27wrap-json: add packing tool for jsonJosé Bollo2-0/+431
The functions wrap_json_pack and wrap_json_vpack can be used to create json object. These functions are likely to be compatible in the format with the packing functions of the library jansson [1]. [1] http://jansson.readthedocs.io/en/2.10/apiref.html#building-values Change-Id: I2e251bdb9b590ba55707c5a9ed60528cad927fb3 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-27update markdown documentationRonan Le Martret11-656/+741
Change-Id: I4f466ff4b965022998d2418a9c1310d4f5e0188e Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
2017-07-17Missing member on new binding v2 struct.Romain Forlot1-0/+2
Change-Id: I5fc248d0fcbf3fb8d8cb25138778b11da7cd039a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-07-13Fix const issue in afb-auth.hJosé Bollo2-2/+5
The fields type and loa were declared as const. This worked well for C compilers that are allowing to initialize constant fixed structures. But when compiling with C++, it is no more easy to create initialized structure explicitely. In C++, the solution is to use C++14 constexpr functions. But for using these function, const must be removed. Bug-AGL: SPEC-741 Change-Id: I8096db6e4eba020f96fbf25789b2990d2a8cbabf 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: I5c896e4d9a3a098affc18d4282e260d9bb253611 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-03Make status commonJosé Bollo12-60/+61
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-03update libmicrohttpd to 0.9.55José Bollo1-1/+1
Change-Id: I47e00996d57eae29e846759cbb53d93c2803da6c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-03Update libmicrohttpd verion for native buildRonan Le Martret1-1/+1
Change-Id: Iaefdfe8a358b0ef864dce6740b9aae44f4495423 Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
2017-06-30Bindings V2: enforce prefix AFB_ to logging macrosJosé Bollo3-21/+24
This might break many codes but it is better in the long term. Change-Id: I346d13f0a6ef6b211edf25844489405351548299
2017-06-30afb-ws-json1: expose addref/unref functionsJosé Bollo2-5/+7
Change-Id: Ie264540d20e3a7afbbf2cd16cd54508d07f35034
2017-06-29Change debian files packagingRonan Le Martret11-55/+71
* rename package app-framework-binder to agl-app-framework-binder. * move packaging to conf.d/packaging as other packages Change-Id: Ia207345836fe3c44aef4d237c5785c537a725a81 Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
2017-06-28Bindings V2: reintroduce field 'info' for verbsJosé Bollo7-36/+45
CAUTION, this breaks binary compatibility Change-Id: I67acfffe1f04cdddee0ad1230b227b080da1ab06 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-28Fix bad error reportingJosé 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-28Use constants for verbosity and syslog levelsJosé Bollo3-21/+53
Change-Id: I98a765f7c40d77fbc565ed13aa6e9bba48cf3244 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-28Add new macro for handling verbosityJosé Bollo1-0/+18
It might be interesting to test the verbosity level before making resource consuming stuff. Se example below: if (afb_verbose_notice()) { char *s = compute(); NOTICE("I got %s", s); free(s); } Change-Id: I7be4248a86fc2a2a23820ec822b36d9fccafb203 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-20docs: fix book.json (headers/footers)Stephane Desneux1-2/+2
Change-Id: Ib2d59538d479d7e6e3ed6420fd3ba13ed6f0b695 Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
2017-06-20Merge "Auto generate cover from book.json fields."Stéphane Desneux3-2/+12
2017-06-20docs: add document revisionStephane Desneux3-3/+16
Change-Id: Ie941042d71ed8de25e0ea9fa9bdbb0990e64d5f2 Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
2017-06-20Auto generate cover from book.json fields.Sebastien Douheret3-2/+12
Change-Id: I678df3c78ac04fb2f7a8b3f843103d933c95d73c Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2017-06-19Add page-break for pdf and fix spellingSebastien Douheret9-101/+94
Change-Id: I3225f27a4e45792aeeb418eac5430c93c9d70061 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2017-06-19Add gitbook documentation (support PDF generation).Sebastien Douheret16-1/+960
To generate PDF doc: ./gendocs.sh pdf To generate HTML doc (local webserver): ./gendocs.sh serve Change-Id: I77156a45e86f3bcab045cee05694f93b7a50e4ba Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2017-06-13Refactor of the documentationJosé Bollo39-6/+5017
2017-06-12Moves tic-tac-toe sample to V2José Bollo1-51/+33
Change-Id: I761bca13f98f9bc9557725ed97979218d79fcbb2 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-12Add comment for bindings v2José Bollo1-3/+3
Change-Id: Ic9c1e89f6f4f5a124ffb2dbb88a26dc5e8e1e543 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-12Removes reference to NULL in includesJosé Bollo3-5/+5
Change-Id: I94b2d57b8234f607167488afd24364920f9624f0 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-08Merge "Add rpm and deb packaging"Jan-Simon Moeller8-0/+241
2017-06-08Merge "Add package archive documentation to README.md"Jan-Simon Moeller1-0/+9
2017-06-07Fix concurrency issue in handling referencesJosé Bollo3-14/+15
Change-Id: Iaae331fbdadb88f26057a64193a026950dcb56e4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>