aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-hook.c
AgeCommit message (Collapse)AuthorFilesLines
2019-12-03afb-context: Move credentials to contextJosé Bollo1-7/+9
The split between context and credentials in requests was somehow artificial and awkward. This change move the credentials to the context and removes as many references to credentials as possible in favor of working on contexts. Change the value returned by afb_auth_check to be 1 if validated, 0 or less than zero if not validated. Bug-AGL: SPEC-2968 Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: I979dc841e03247e126e3fa8433a1cc0d4108adf0
2019-11-25Remove returning tokenJose Bollo1-1/+1
The token is no more generated by the binder Bug-AGL: SPEC-2968 Change-Id: I43f66c7613b42d33058e167b831a93b2112d3b9e Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-11-25Remove refreshing tokenJose Bollo1-11/+0
The token is no more generated by the binder but by some external component. Bug-AGL: SPEC-2968 Change-Id: I2c6221034272ab097e21e7727e4840b6b47bd0dc Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-03-29hooks: Allow to remove hooking (and/or trace)Jose Bollo1-0/+3
This change allows to downsize the binder by removing its internal hooking and tracing features. Change-Id: Ifb080a7426216f6c6b1c8f8e5bf8ddd52df40a3e Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-02-06Update copyright datehalibut_7.90.0halibut/7.90.07.90.0José Bollo1-1/+1
Change-Id: I3aaa92b2bfb01699ee8ae609272e93032b6f1a9d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-12-05afb-hook: Improve reentrancy of hookingJosé Bollo1-126/+163
Work on testing showed that a deadlock was occuring in management of hooks. Change-Id: Ib51eb4f0b9ffc5d9dfe2770f2c3f8f47f262b60f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-08-02Fix warnings and false errorsJosé Bollo1-1/+1
Change-Id: I434a0bd6be2758fd7964bc272d63dc280d400f47 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-08-02Add ability to provide binding settingsJosé Bollo1-0/+12
Change-Id: Iab93a26340fa9743a58ca43cd903bbf31c783e5b Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-07-24json-c: Remove escaping of slashsJosé Bollo1-21/+24
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-24afb-api: Define the function afb_api_is_publicJosé Bollo1-1/+1
And remove the info line setting that the API . is added. Change-Id: I42e247036b9a1016797bb2674ad95f8a8c30e9be Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-07-13afb-hook & afb-trace: Fix usage of readlinkJosé Bollo1-2/+8
The function readlink doesn't add a terminating null. This patch fixes that were needed. Change-Id: Ie15309471fe8203c8e98b97315c4ea30de3ccd75 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-06-19Fix a warning in using readlinkJosé Bollo1-6/+6
The use of the same buffer as input and output of readlink leads to warnings due to restrict use in new versions of GLIBC Change-Id: Ifbf1277b88bd18a9df1e18211d4248e94c16d6da Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-06-15api-v3: First draftJosé Bollo1-448/+480
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-13afb-hook: Factorize call to pattern matchingJosé Bollo1-4/+6
The pattern matching actually use fnmatch but this could be changed in the futur to some lighter version. Change-Id: I4f3617cd4a5bdf95988428cb184cef9e9543771d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-06-13afb-hook: Refactor timestamps of hooks and traceJosé Bollo1-1/+1
Change-Id: Iebcab280123d1f954eda3b1260d0b984ae3a98b5 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-09afb-hook: Add hooks for sessionJosé Bollo1-4/+191
Change-Id: I4fbd6bf57958abb366a742b12afb92bfc03ad299
2018-01-31afb-hook: Allow to unhook some apisJosé Bollo1-33/+42
The apis starting with a $ (dollar) will not be tracked by hooks Change-Id: I3b83458c288ef1eb27993d4c71785b32e5a72deb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-10Add the function afb_req_get_uidJosé Bollo1-1/+13
Change-Id: I9caf38ee3811cf10b546489094f0bb5b3d844c40 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Improve naming of evt_eventidsJosé Bollo1-3/+3
Change-Id: I1fa3cf776110f67ad1b18c4c83f3a1707692ae8b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Provide API and VERB name of requestsJosé Bollo1-5/+5
Change-Id: I9a86c6314f871334231e50f9cea60b54aed434b9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Deprecate internal use of afb_eventJosé Bollo1-10/+10
The deprecation is made in favor of afb_eventid but this can change later in favor of afb_evt_evtid. Change-Id: Ic16cb25dbd97cb1e8d26b3c54b159d46bbf82671 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Introduce afb_requestJosé Bollo1-1/+1
This prepares the new api with pointers. Change-Id: I4eb299551145226e428934b6835a1a7810ae6439 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Introduce afb_eventidJosé Bollo1-1/+1
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é Bollo1-11/+0
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-evt: prepare futur afb_eventidJosé Bollo1-8/+30
Change-Id: Ie4668c2dadbdfbe79bac2c27a1b188edecbcf847 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Atomic context initialisation for bindingsJosé Bollo1-1/+13
Change-Id: I3e81b64d57c917da1fba9b3a9387d0f4d7f3e6b7 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Add function 'afb_req_get_application_id'José Bollo1-1/+13
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é Bollo1-108/+109
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-09-07Allow renaming of APIJosé Bollo1-1/+13
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-07Improve handling of verbosityJosé Bollo1-1/+1
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-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é Bollo1-1/+13
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-08-29hooking: Add hook at global scopeJosé Bollo1-1/+156
Actually the global scope only allows to trace log messages. Change-Id: Ib73edf2e3168311b2ad694d857e6647e34884313 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-29hook+trace: add a unique timestampJosé Bollo1-61/+66
A same event must have a unique time stamp. Change-Id: Id33351a97f62c04a84d26995a2cf9ae80613c613 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-29hook+trace: adds hookid and typeJosé Bollo1-55/+70
The hookid is a unic identifier for a hook event. Its purpose is to distinguish events that could match different filters: a same event has a same id. Also integrate the field "type" (of the event) in the trace event. Change-Id: I90b0b2d3a0846b673b993110d2752cc54db75bd8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-03subcall_req: introduce afb_req_subcall_reqJosé Bollo1-1/+23
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-06-02Add 'afb_daemon_require_api'José Bollo1-1/+24
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é Bollo1-4/+37
Change-Id: I231e2506f58227fb8d192df042539b1551a765c5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-01Improve log output formatJosé Bollo1-138/+56
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é Bollo1-3/+306
Change-Id: If5fe736e04c9f4298302c3cbba568f1d6346ee67 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-31Add logging by requestJosé Bollo1-0/+24
Change-Id: I6dda714bcb8c36392c14a1981cfb8960f3db45b8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-30Adds hooks for service (svc)José Bollo1-0/+235
Change-Id: I42265fcee9eae8219ef0cf56d3c8446d2c0fc015 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-30fix commentsJosé Bollo1-3/+3
Change-Id: I6a3b2df272a1c88c530fd229ba612ee30160e3cc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-29Cleanup legacy internal functionsJosé Bollo1-23/+0
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-05Add user to contextJosé Bollo1-1/+2
At this time, user is the string representation of the uid. Change-Id: I65fbb4112f209fdb948d24e9c47fa73dacdf571f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-26Print credential in default request hookJosé Bollo1-1/+11
Change-Id: I67af78d8838de4c5386fd62c8f3b26d1ad8fb338 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-25Add 'afb_daemon_queue_job' for bindingsJosé Bollo1-1/+10
This allow bindings to queue asynchronous jobs. Change-Id: I2a228388c9defde23adb672d579c4a299f212850 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-07Add hooking of daemon interfaceJosé Bollo1-28/+304
Change-Id: I5840609f4300ade98412e8527ac5ce1f1e8c0c59 Signed-off-by: José Bollo <jose.bollo@iot.bzh>