summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2017-10-09Introduce afb_eventidJosé Bollo5-17/+16
This new name is better suited because it is not an event but the id of an event. This also prepares the new api with pointers. Change-Id: I7be88bb36cf72bf7df70793a77452e405130b951 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Make afb_event_drop obsoleteJosé Bollo6-45/+12
The function is now replaced by the function afb_event_unref. In the same time, the function afb_event_addref is made available. Change-Id: I9aa30e80e64e82f3b16ab359982337771b287185 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-trace: Use the fresh afb_eventid internalsJosé Bollo1-11/+11
Change-Id: Ia9c840fb768bc058e74c32028b8a4817463177e4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-evt: prepare futur afb_eventidJosé Bollo7-185/+426
Change-Id: Ie4668c2dadbdfbe79bac2c27a1b188edecbcf847 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-api: Define the notion of group for concurrencyJosé Bollo6-10/+8
Change-Id: Iafbbff8387bb1f8577cb7aeb6e8ed4b14ab1f4a4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Refactor of starting apisJosé Bollo4-157/+128
Change-Id: Ib2efcd8747c3537714dfa7058bb0623d6e283c3d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Atomic context initialisation for bindingsJosé Bollo8-15/+71
Change-Id: I3e81b64d57c917da1fba9b3a9387d0f4d7f3e6b7 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-session: Fig tiny bugJosé Bollo1-1/+1
Change-Id: I74efb96d3140edbf634210189a12399123c0a297 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09minor cleanupJosé Bollo2-2/+0
Change-Id: I32d44b1150814d8f80d5db44a5730c87606c054b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-export: getter for the apisetJosé Bollo2-3/+8
Change-Id: I6cb5bb0f19a6427bcc6532152863b67bc70dced4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-xreq: hide internal addref/unref to xreqsJosé Bollo6-32/+38
Change-Id: Ie175ec1e508c7bd3bcdc25d7e0b26e7a9da3fafb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-xreq: prepare futur afb_requestJosé Bollo2-5/+8
Change-Id: I0986113475f354bccdbc711e74a63c9ca809c5ed Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-xreq: take care of early failuresJosé Bollo1-34/+56
Change-Id: I7f6d7c11dd1bbf51e571ca3ad9545cadc20b2a2c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-trace: improve naming (minor)José Bollo1-4/+4
Change-Id: Ife42648b089d23d75820337e015703ee884d99fc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-xreq: Detection of self locks due to 'noconcurrency'José Bollo2-14/+33
Change-Id: I112526f315d861ebb6d0d12edea06372f902db2c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-context: add const qualifier for api_keyJosé Bollo2-3/+3
Change-Id: I138d70698342cc2350d4f9098bcf5c486d16faba Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09jobs: add const qualifier for groupsJosé Bollo2-11/+11
Change-Id: I34faa8e5da4321da53beb323559399d1460562c1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Add function 'afb_req_get_application_id'José Bollo4-5/+54
This function is intended to return an identifier of the calling application. At this time, the identifier is just derived from the application id but it can be changed in the future. Change-Id: Idacde8979ac5bb525352de9cab19e3fc1ed48627 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-export: refactor of binder interfaceJosé Bollo13-1133/+1214
The interfaces of the binder called afb_ditf and afb_svc are merged together to create the afb_export structure. Change-Id: I841ba04d7b2f94bfc19f691ec746d0bd221f164d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09verbose: Fix wrong error reportJosé Bollo1-0/+1
Change-Id: I0718204c52ccb4c28c2380c947b7db60b8785ead Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-api-so-v2: improve generation of descriptionJosé Bollo1-3/+30
Change-Id: Ibe8fbbec59cc8db35c635346f0d441f0140eced5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Remove tailing spaces and TODO fileJosé Bollo19-35/+27
Change-Id: Id7cdad4e24c6ab62bf9c325b542e1605b17223f4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-12afb-proto-ws: Split afb-stub-ws in twoeel_4.99.1eel/4.99.14.99.1José Bollo4-875/+1472
The file afb-stub-ws is split in two parts: - afb-stub-ws: implements the interface between xreq and protocol. - afb-proto-ws: implements the pbinary protocol over wer sockets The intent is to have a clean separation between a kind of generic stub and the protocol implmentation. This will allow soon to provide a library to access directly in C to the websocket of an API exposed through the otpion --ws-server. At the moment, the protocol implementation is on websockets but in the futur it will be cleanly rewritten to use any binary transport. This commit also fixe a double free in subcalls. Change-Id: I831787533db9fe073d060dd8ee9401cbab2894e1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-11afb-xreq: Fix bugs in subcallsJosé Bollo1-89/+125
Subcall was silently broken. Change-Id: I0b4c2887a0787b0b9e50e94a534712e21b91d786 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-11afb-hreq: Fix a leak on websocket upgradeJosé Bollo1-0/+2
A 'no-reply' answer was created but not emitted nor freed when http connection was upgraded to websocket. Merging replied and xreq.replied was a possible solution but I wanted not change much things. Change-Id: I86c6c7ee52f69d50732e50fa6594f1d22d77ddfd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-08afb-ws: optimize buffer managementJosé Bollo1-4/+13
Change-Id: I6cdfc9ccb6253efe5e22844c6ea66dae2c6272a2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-08sig-monitor: Fix a warning (minor)José Bollo1-2/+0
Change-Id: Ic9437062b0ee6c1d1a8c42cc938c8e73f2ed3846 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07Improve isolation of bindingsJosé Bollo1-1/+1
Adding this flag will avoid potential conflict with previously loaded bindings. Change-Id: Iae42a68fa4750d107895dc01045aac7b885759f7 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-07Allow renaming of APIJosé Bollo5-25/+70
The function afb_daemon_rename_api allows to rename an API during the preinit phase. Change-Id: I35477ba99d35b1dc51a7cacf8e55c3f02d86d7b4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07afb-ditf: use NULL function featureJosé Bollo1-2/+2
It is now safe to put NULL for function name. Change-Id: I83afc47e38b823e924ae8dab60a7a24065ae0ef6 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07Improve handling of verbosity in bindingsJosé Bollo9-11/+10
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-09-07Improve handling of verbosityJosé Bollo3-11/+82
The macros VERBOSE_NO_DATA and VERBOSE_NO_DETAILS can be used to tune what verbose parts are to be emitted: If VERBOSE_NO_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 in the binary. If VERBOSE_NO_DATA is not defined and VERBOSE_NO_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 (file, line and function). At the same time the emission of the details (file, line, function) is not done for levels NOTICE, INFO, DEBUG on the console Change-Id: Ibb83cd435797fadf90626cb06bbda77f0f8b3cde Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07afb-ditf: track daemon stateJosé Bollo4-5/+42
Change-Id: Ic21c79dcd9908919a1a8d13e8747ef0bd2490477 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07afb-hook: change output formatJosé Bollo1-4/+4
Putting HOOK: in front is better because other outputs are also prefixed with SOMETHING: It greatly improves readability Change-Id: I591126198b630e3b7977ecb2501bc59163fd0c11 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07afb-hook: output hooks to stderr directlyJosé Bollo1-3/+36
Change-Id: Ife66db644c62ea4a3e7be11e7f454234c093a824 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07Implement afb_req_has_permissionJosé Bollo5-31/+61
This new verb is available in bindings to check whether the client identified by a request has a given permission or not. Change-Id: I5eaa0892d8260d26bd76f37123251c103c981e10 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07afb-auth: improve afb_auth_check_permissionJosé Bollo1-6/+12
The test was previously done in the caller but because afb_auth_check_permission can now be called by other callers, the test must be relocated. Change-Id: I08a3a92afbe0b4dcfb223335b1e76b2d4aff005f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07afb-auth: export method to check a single permissionJosé Bollo2-5/+5
Change-Id: I45c4872f34ff8f25c14872d7b3610fa15f48062e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07afb-auth: revert order of arguments (minor)José Bollo3-10/+10
Change-Id: I29140a3c047799ee600051fb62998e7bb73d45f5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-07afb-api-so: take care of SIGSEGV in dlopenJosé 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-11/+37
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-09-05Fix segmentation fault when random tokenJosé Bollo3-2/+10
Change-Id: I98795f71dfab1fbc86d694d7ed357ae8387abd5d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-05sig-monitor: Dump stack atomicallyJosé Bollo1-8/+25
Emitting the stack as a single string avoids its accidental split and is better when receiving monitoring events. Change-Id: I74c16f36f026b4af4a42064f694ac1f4a342cc1f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-05afb-apiset: Refactor and cleanJosé Bollo3-25/+22
Change-Id: I063329b23f4476e2570e99dfc639b11320df41d2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-05afb-api-ws: Fix bug introduced by 2e83db0José Bollo1-1/+1
Change-Id: Ia73d2d49ac888770f78d65a6258c0184b6aaa2da Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-09-01Give priority to option --bindingJosé Bollo1-1/+1
Change-Id: I822f2d50a35fdffae82678c67be0e017d54cebff Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-31Make noconcurrency more efficientJosé Bollo6-41/+16
The previous handling of noconcurrency suffered of inefficiency, was complicated and dedicated to api-so-v2. Change-Id: I32aea9187663ac533819496e9dc9b944db0d89ec Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-31afb-apiset: refactor access to apisJosé Bollo6-64/+38
Change-Id: If003067ada5802b7d77f06f560a5d07464909a61 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-31afb-trace: use constants for verbosity levelJosé Bollo1-1/+2
Change-Id: I0908c5057efe5360cccd3b2e1e3f926f48453bd2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>