aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-xreq.c
AgeCommit message (Collapse)AuthorFilesLines
2019-11-29Use afb_token in contextsJose Bollo1-1/+1
Tokens are now object used in the context. Bug-AGL: SPEC-2968 Change-Id: I107d31732202b7b1172afaf09f3a52470f050d7c Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-11-25Remove refreshing tokenJose Bollo1-6/+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-07-23afb-xreq: Remove field 'listener'Jose Bollo1-4/+0
This simplifies the flow that now has only one case: the callbacks subscribe/unsubscribe of struct afb_xreq_query_itf. Bug-AGL: SPEC-2658 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh> Change-Id: Ia49f3ce7aaa4d8603014fe163f311eadfcbf68e4
2019-07-12afb-xreq: Forbids (un)subscribes after replyJose Bollo1-12/+22
Allowing to subscribe to a request that was replied was possible and lead to problem revealed by issues SPEC-2542 and SPEC-2599 (these issues are more related to processing unordered incoming messages). The choice was - fix the bug and authorize (un)subscribe after reply - forbids to (un)subscribe after reply Second solution was chosen for its simplicity and its networking efficiency. Bug-AGL: SPEC-2542 Bug-AGL: SPEC-2599 Change-Id: I09f48b760b1fd6f70d42b80df3c8053696c45966 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-04-02Add conditionnal support of bindings version 2Jose Bollo1-0/+6
Bindings version 2 will become legacy soon. This patch allows their removal Change-Id: Iecad3abd0ddd714e5d55c0b935be756a29d1ca37 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-03-29hooks: Allow to remove hooking (and/or trace)Jose Bollo1-48/+61
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-07-24json-c: Remove escaping of slashsJosé Bollo1-1/+4
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-06-15api-v3: First draftJosé Bollo1-601/+376
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-02-27Update date of copyright noticesJosé Bollo1-1/+1
Change-Id: If9d7e7728df086fbb7214f1de5cbec35cd2f1d9b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-22xreq: export a function to get reqJosé Bollo1-13/+6
Change-Id: Ie7eac225f514349926341b7db61ea0eb9029c5d8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-06afb-xreq: Export afb_request facilitiesJosé Bollo1-70/+60
Internally, the binder can need to convert afb_request to xreq and conversely. Exporting this facilities is good. Change-Id: I5bb01d701eee0ac30ad6ce490609f6124a9d5860 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-10Add the function afb_req_get_uidJosé Bollo1-0/+15
Change-Id: I9caf38ee3811cf10b546489094f0bb5b3d844c40 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Improve naming of evt_eventidsJosé Bollo1-2/+2
Change-Id: I1fa3cf776110f67ad1b18c4c83f3a1707692ae8b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Provide API and VERB name of requestsJosé Bollo1-11/+11
Change-Id: I9a86c6314f871334231e50f9cea60b54aed434b9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Allow dynamic creation of APIsJosé Bollo1-0/+10
Change-Id: I825bfa7969c98dd214457d9ff94e2948362286a9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Make single afb_request_subcallJosé Bollo1-7/+66
Change-Id: I8cc96ef9c05781069f07b807bc6632d13668ac69 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Provide conversions for afb_event and afb_reqJosé Bollo1-4/+4
Provision is made here to convert, trivially: afb_event -> afb_eventid* afb_req -> afb_request* The opposite conversions aren't provided to favor new interfaces. Change-Id: Ib67c2317f782e2edfd1ba0e49e10b321a3b770a3 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Prepare subscription to eventidJosé Bollo1-6/+22
Change-Id: Ie3f75377009be36f7f5bd52bdb31d0611cd49778 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Make addref for request return the pointerJosé Bollo1-3/+4
Change-Id: I4286cbd9d02b406570185d265e7b925c43bbc42c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Deprecate internal use of afb_eventJosé Bollo1-14/+26
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-102/+113
This prepares the new api with pointers. Change-Id: I4eb299551145226e428934b6835a1a7810ae6439 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-api: Define the notion of group for concurrencyJosé Bollo1-5/+3
Change-Id: Iafbbff8387bb1f8577cb7aeb6e8ed4b14ab1f4a4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Atomic context initialisation for bindingsJosé Bollo1-2/+17
Change-Id: I3e81b64d57c917da1fba9b3a9387d0f4d7f3e6b7 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-xreq: hide internal addref/unref to xreqsJosé Bollo1-22/+26
Change-Id: Ie175ec1e508c7bd3bcdc25d7e0b26e7a9da3fafb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-xreq: prepare futur afb_requestJosé Bollo1-4/+4
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-xreq: Detection of self locks due to 'noconcurrency'José Bollo1-14/+32
Change-Id: I112526f315d861ebb6d0d12edea06372f902db2c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Add function 'afb_req_get_application_id'José Bollo1-2/+17
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-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-07Improve handling of verbosity in bindingsJosé Bollo1-3/+9
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-07Implement afb_req_has_permissionJosé Bollo1-2/+17
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: revert order of arguments (minor)José Bollo1-1/+1
Change-Id: I29140a3c047799ee600051fb62998e7bb73d45f5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-31Make noconcurrency more efficientJosé Bollo1-6/+10
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é Bollo1-4/+5
Change-Id: If003067ada5802b7d77f06f560a5d07464909a61 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-03subcall_req: introduce afb_req_subcall_reqJosé Bollo1-9/+73
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é Bollo1-93/+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-03Make status commonJosé Bollo1-12/+12
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-06-02Provide efficient store/unstore for afb_reqJosé Bollo1-2/+26
Change-Id: I231e2506f58227fb8d192df042539b1551a765c5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-02Localize construction of afb_argJosé Bollo1-3/+16
Change-Id: I08f1bc228c419243044949aa3c4094873932d3f2 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-01Enforce starting services on needJosé Bollo1-2/+5
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-01Add backward compatibility and remarksJosé Bollo1-1/+2
Change-Id: Ia261e2d9efce399b210f834c1acb679215021edd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-31Add logging by requestJosé Bollo1-2/+20
Change-Id: I6dda714bcb8c36392c14a1981cfb8960f3db45b8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-29Add vfail and vsuccess interfacesJosé Bollo1-0/+36
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é Bollo1-38/+5
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é Bollo1-3/+6
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-24Handles subcall sync within xreqJosé Bollo1-14/+96
Change-Id: Ieac7c589ddadfb67761332443a3fd92038b6d548 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-19Bindings V2: Refactor session flagsJosé Bollo1-11/+41
Change-Id: Idb104b3db69d785b11446fe9b66084839290362f Signed-off-by: José Bollo <jose.bollo@iot.bzh>