aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-ws-json1.c
AgeCommit message (Collapse)AuthorFilesLines
2019-12-03afb-context: Move credentials to contextJosé Bollo1-5/+1
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-29afb-evt: Use 16 bits for idsJose Bollo1-2/+2
16 bits are enough Bug-AGL: SPEC-2968 Change-Id: I0e8708c1d6a3934a342721a6ce5edb4676df6d1b Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-11-29Move tokens from sessions to requestsJose Bollo1-1/+21
Tokens are no more related to sessions. Each request provides a token. In the case of websockets or connected link, the context can record the token. Bug-AGL: SPEC-2968 Change-Id: I1442b0422584c5a5b860ddb826518b0e673612f9 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-11-29Don't return the uuidJose Bollo1-6/+0
uuid is available in cookies and through a call to monitor/session Bug-AGL: SPEC-2968 Change-Id: I72912f3dc7985cca09e77c952e416b608711abbe Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
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-20Introduce object for tokensicefish_8.99.1icefish/8.99.18.99.1Jose Bollo1-0/+5
For further optimizations, the token is represented by a specific structure. Bug-AGL: SPEC-2968 Change-Id: I3d46a12c8c16809c6cc1d543fa2e6309927ed84d Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-07-23afb-xreq: Remove field 'listener'Jose Bollo1-1/+18
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-18Tag broadcasted events with UUID and hopJosé Bollo1-5/+9
When API have mutual dependencies, leading to loops in dependecies, broadcasting an event never ends because of the loop (see SPEC-2625). To avoid that weird flood of events, a unic identifier (UUID) is attached to broadcasted event and a tiny memory records previously broadcasted events to avoid re-sending an already sent event. The size of the memory can be set using the macro variable EVENT_BROADCAST_MEMORY_COUNT whose default value is 8. It can be reduced to 0. An other mecanism is added to limit the count of hops that a broadcasted event can do. That count can be set using the macro variable EVENT_BROADCAST_HOP_MAX whose default value is 10. Bug-AGL: SPEC-2625 Change-Id: I29550a8a5c8f5e2ffb20edc3330357a1e870c0e2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-07-18afb-evt: Refactor processing of broadcasted eventsJosé Bollo1-10/+19
Solving the bug SPEC-2625 needs to rework the broadcasting of events. It appeared that the numerical event identifier passed for broadcast wasn't used by called function except for hooking. Suppressing it introduces a clear distinction between the push and the broadcast paths. The file afb-ws-json1 is changed to avoid casting of functions. Bug-AGL: SPEC-2625 Change-Id: I9fe75adc8086812b21b70ce28baffcf77bd5e1cf Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-27Rename afb-systemd to systemdJosé Bollo1-1/+2
Files "afb-systemd.[ch]" are renamed "systemd.[ch]" and their functions "afb_systemd_*" are renamed "systemd_*" Change-Id: I8362a2ca8b71945b54c6ab9a7ead51d9c50bc8e2 Signed-off-by: José 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-06-15api-v3: First draftJosé Bollo1-6/+10
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-22fdev: Introduce fdev for file event handlingJosé Bollo1-5/+6
This is an effort to keep cutting dependency to systemd. Change-Id: I9a0c032a1095e297c7f3ac5b67827fda3658b8d9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-21afb-systemd: Isolate systemd main entriesJosé Bollo1-2/+2
This change prepares the possibilty to remove the dependency to systemd/libsystemd. Change-Id: Ife4181d6c7195230a11a32e527b8973af6a096e1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Provide API and VERB name of requestsJosé Bollo1-2/+2
Change-Id: I9a86c6314f871334231e50f9cea60b54aed434b9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Introduce afb_eventidJosé Bollo1-2/+0
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-07-03Make status commonJosé Bollo1-3/+3
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-30afb-ws-json1: expose addref/unref functionsJosé Bollo1-5/+5
Change-Id: Ie264540d20e3a7afbbf2cd16cd54508d07f35034
2017-06-07Fix concurrency issue in handling referencesJosé Bollo1-2/+2
Change-Id: Iaae331fbdadb88f26057a64193a026950dcb56e4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-02Provide efficient store/unstore for afb_reqJosé Bollo1-1/+1
Change-Id: I231e2506f58227fb8d192df042539b1551a765c5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-29Relax authorisation checlk for selfJosé Bollo1-2/+0
Change-Id: I115bbebb2f51be92578d1cc6b2fb5ae89813b630 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-29Add 'afb_service_call_sync' functionJosé Bollo1-1/+0
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-05Add default cred to HTTP linkJosé Bollo1-0/+2
Change-Id: Ibb73cebc99094b33b61820482327296049c2026a Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-13Introduce apiset for grouping apisJosé Bollo1-4/+6
This will be used at the end for debugging facilities. Change-Id: I75e3345667e1f58143c77a885e166375680ca194 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-12Add credential data to xreqJosé Bollo1-0/+2
This will allow soon to check the credentials when evaluating calls. Change-Id: I993216ccbc02538dcd92e49fcb2de0541eeb8c01 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-12Optimisation of xreqJosé Bollo1-16/+11
Reduce the count of memory read Change-Id: Ie4dfa4bd30d6485be91961196294c43ffbd3b2a9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-12Add computation of credentialsJosé Bollo1-0/+4
Credentials are computed if possible. Change-Id: I36c7e95a35431b27109c26b51eab690d685862e1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-11Fix a crash on disconnectionJosé Bollo1-1/+2
Change-Id: Ib3654ac8125b040f8264524e7c821a6559f627cd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-04Definitive switch to internal's xreqJosé Bollo1-1/+1
This switch allows to work on a common base for the requests. Change-Id: I94e7fdda80c1966af399309334c41c7c8c8259dc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-31Use xreq for websocketsJosé Bollo1-101/+29
Change-Id: Ia489f863e8be3384fbe8a240f6010f7d5916b72a Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-27Simplify functions for callsJosé Bollo1-1/+1
For historical reasons, the call to apis was passing the length of the api and the length of the verb. The reason was to avoid a copy of strings. But the copy occured only for HTTP requests. Having this implementation is of small interest and compromise future changes. This patch simplify things. Change-Id: I8157724c6c721b6797cd0eab52b07e1b8d6eb5f8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-03Improves naming of session's moduleJosé Bollo1-5/+5
Make names looking like other names Change-Id: I63ce3d8a3d84193eca9d517cecb1888d630a9b2d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-03Adds 2017 to copyrightsJosé Bollo1-1/+1
Change-Id: Id85c4eb4e36a05b61346004ba95daa19faf5074f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-07-27Expose use of the event loopJosé Bollo1-1/+2
The use of the event loop where previously hidden in internal deep places of the websocket modules. This commits enforce the client of the library to explicitely tell what event loop must be used. This has 3 effects: - you know that the systemd event loop is used - you tell the event loop to use (no confusion) - you don't depend on afb-common.c Change-Id: Id13d8a96f981183c299cde414d9bb0cd77fe3daa Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-06-23evt: handles broadcasting and trackingJosé Bollo1-3/+9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-06-10improves readabilityJosé Bollo1-56/+79
Change-Id: I27411163aff0ecedad4019094f4a5c46d5a2c342 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-06-10common code reuseJosé Bollo1-13/+1
Change-Id: I5f400a92165bb380ec5f703dd8ca567e90aebca2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-06-09Make possible to call a method from a bindingJosé Bollo1-2/+11
The new request call 'afb_req_subcall' allows a binding to call the method of an other binding. Change-Id: I8538185be7a1663153a25db2bc940f9e2bdedb1a Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-06-09Events: refactoringJosé Bollo1-16/+22
This new version allows to subscribe a client for an event. The event should first be created for the API (the API's prefix is added) using 'afb_daemon_make_event'. After that, plugins can subscribe or unsubscribe their clients (identified through requests) to the events that it generates. See 'afb_req_subscribe' and 'afb_req_unsubscribe'. Events created by 'afb_daemon_make_event' can be widely broadcasted using 'afb_event_broadcast' or pushed only to suscribers using 'afb_event_push'. Events can be destroyed using 'afb_event_drop'. Change-Id: I7c0bed5e625c2052dcd81c6bfe960def1fa032f3 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-06-08Websocket: improves overall integrationJosé Bollo1-246/+69
Change-Id: I7af7b96d2f32b706eb378747c3719fa48f68c961 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-06-08Improves message formatingJosé Bollo1-4/+2
Change-Id: Ifde5ff73cd6a73715fd4d6fd58101d9e97a3bef4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-05-29compact formatting of jsonJosé Bollo1-1/+1
Change-Id: Ieb839f287593240aac4d784483ff4c6e6cb57d84 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-05-24improves commentsJosé Bollo1-0/+4
Change-Id: I6ddde79307b40c33ffd0208fe72ef84626c47cac Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-05-22Add verbs for closing and setting LOAJosé Bollo1-1/+3
These new verbs are now available to plugins. LOA is the level-of-authorisation. The usage of these new verbs must be protected by a mechanism that is still to be done. Change-Id: Ia591fb6bf9cd16956dc95658c5ba3a24ee4380be Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-05-18propagate context creation to websocketJosé Bollo1-4/+12
Change-Id: I9ff53f5920d6134030f3e1d63c46f4a30a5e1968 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-05-17provides developper filesJosé Bollo1-1/+1
Change-Id: I0e41a0db778c69b5f5ce71115d495b2bb8b4cffe Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-05-13cleaning copyrightsJosé Bollo1-1/+1
Change-Id: I4ff7349b1a87f92a7d9f378c715054061f06df57 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-05-12fix a typo bugJosé Bollo1-1/+2
Change-Id: If622b8964d554469204f4df379680c2d258b4bff Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-05-12fix the linked list leakJosé Bollo1-0/+8
Change-Id: I0a26ed98b400df3dfde07d86c058120c8d140329 Signed-off-by: José Bollo <jose.bollo@iot.bzh>