aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-stub-ws.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-20Introduce object for tokensicefish_8.99.1icefish/8.99.18.99.1Jose Bollo1-2/+1
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-18Tag broadcasted events with UUID and hopJosé Bollo1-4/+4
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-1/+1
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-07-12Revert "afb-stub-ws: Allow unordered process of messages"José Bollo1-1/+1
This reverts commit 5425e054fbf87fe6d024103f46e53f2a28e074f2. The change introduced in the reverted commit is no more necessary since events are sent asynchronousely. Bug-AGL: SPEC-2215 Bug-AGL: SPEC-2219 Bug-AGL: SPEC-2542 Bug-AGL: SPEC-2599 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh> Change-Id: I4fd8d1516c97e2f95caaa244e28491f71b15bba7
2019-04-02Fix false ***buffer overflow*** detectionJosé Bollo1-2/+2
The compiling option __FORTIFY_SOURCE=2 introduced a false ***buffer overflow*** detection when the flexible array 'pattern' was initilized in globset. The compiler is only complaining when the array is in a struct that is in a struct like struct { ...; struct { ...; char name[1]; }} To avoid these false detections, it is enougth to ellipsese the dimension of the array. Seems to be the now standard way of declaring flexible arrays when it was before an extension. So now: struct { ...; struct { ...; char name[]; }} works even when __FORTIFY_SOURCE=2. Bug-AGL: SPEC-2292 Change-Id: I4b4a5df505a5357f92b9ab1657175911198ca582 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-07afb-stub-ws: Allow unordered process of messagesJosé Bollo1-1/+1
Requests are already sequenced on need (noconcurrency flag of bindings). Sequencing messages until their completion has a side effect when dealing with events and synchronous calls: event -> call -> reply locked until event completion (see SPEC-2219). This change could be reverted if events are converted to jobs (see SPEC-2215). Bug-AGL: SPEC-2219 Change-Id: Ia577bc54ba38291817fd5ed3e3dda1b67b2818b7 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-08afb-stub-ws: Fix concurrent memory issuesJosé Bollo1-3/+4
This changes takes care to increment the the count of reference before using it. Bug-AGL: SPEC-2163 Change-Id: Ia7882427eeae933eeb5030aad025ebb1da129d6f 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>
2019-01-16afb-proto-ws: Serialize incoming messageJosé Bollo1-2/+2
Enforce serialisation for a connection Bug-AGL: SPEC-2089 Change-Id: Id9f261b7cc02fda78922dc511856c34b7c5bf56d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-12-05afb-proto-ws: Add error reportJose Bollo1-0/+1
Change-Id: I58c88f8bcaf4cfb8a53b58eeefd7fa3415bf894a Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-08-23afb-stub-ws: Add reconnection of ws-clients on needJosé Bollo1-5/+50
This implementation detects deconnections and try to reconnect lazily on need. Bug-AGL: SPEC-1668 Change-Id: Ib2a20a4578f2da80afe1564c42de96c4aa250e64 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-08-23afb-stub-ws: Safe handling of deconnectionsJose Bollo1-132/+164
This commit also include many comments and improvements in naming of functions. Bug-AGL: SPEC-1668 Change-Id: I1b5dd95678d94e9edfca1c598c5697e90bb9e5bf Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-08-23afb-stub-ws: Process error on call to remoteJosé Bollo1-2/+6
Change-Id: I8bb96419cfac3da88e75da42c66a5d359ec7c666 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-08-23Send error replies on disconnectionJose Bollo1-2/+1
The pending calls receive an error notification when the server hang up. Bug-AGL: SPEC-1668 Change-Id: I052dca5e338a7650d7630856e21f1d3a81c6f265 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-08-23afb-stub-ws: Clean upJose Bollo1-10/+0
Change-Id: I6fbe737d4986fd18f9675942cd7ad75966125343 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-08-22afb-stub-ws: Improve namingJose Bollo1-1/+1
The function afb_stub_ws_on_hangup is now named afb_stub_ws_set_on_hangup. Bug-AGL: SPEC-1668 Change-Id: Ie96c77d4af10ee6b42aea6f57d7c3aadb95e6467 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-07-06Simplify build by introducing queuing functionJosé Bollo1-0/+6
It is not valuable at the end to continue to have this fake job implementation. So removing it is good. Change-Id: I930ade3e3a511f0ebfb91292e5725ac3be884d44 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-07-05Remove uses of deprecated macrosJosé Bollo1-2/+0
Change-Id: I439e891d92fb34087755e68102fda97c43b5b786 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-06-15api-v3: First draftJosé Bollo1-100/+38
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-26afb-stub-ws: cosmetic improvementsJosé Bollo1-6/+9
Change-Id: Ib6adf0ca4bdfee9d3da07055430bfe1974ac28bc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-22fdev: Introduce fdev for file event handlingJosé Bollo1-11/+12
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-3/+3
This change prepares the possibilty to remove the dependency to systemd/libsystemd. Change-Id: Ife4181d6c7195230a11a32e527b8973af6a096e1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-13afb-stub-ws: Fix segfault on diconectionJosé Bollo1-1/+2
Change-Id: I7826b86e4d4cc921b2daaca5c8dda0fd27faae10 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-13afb-stub-ws: Protect against self-destructionJosé Bollo1-0/+2
Change-Id: I43b15b8f675173a693816a0b8efd05fd024278f0 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-09afb-session: Refactor and test unitJosé Bollo1-3/+3
The session are refactored and now to include a test unit. Change-Id: Ia8c4b707191f3af95c0549b333d14b384a81eaa7 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-09afb-stub-ws: Fix a session leak bugJosé Bollo1-1/+1
Change-Id: I55b72d7a4e7ca18e61addb3b0efa2ec75729060b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-11-07afb-stub-ws: autoclose session on disconnectionJosé Bollo1-0/+2
Change-Id: If46ca2fa34a080b7087edb4e0da109c5ee85b14f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-11-07afb-stub-ws: manage closed sessionsJosé Bollo1-13/+22
Change-Id: I16620f12719c222c0da03caf330a865149fe9051 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-11-07afb-stub-ws: Track sessions for releasing itJosé Bollo1-0/+47
Change-Id: If0ff0f491e0fd8267137aa742d7acbe0157f88ad Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-12afb-stub-ws: Always validate clients of stub-wsJosé Bollo1-0/+1
Change-Id: I2c020d586e6f22e47dac8ddb50c8ee9ca9c46b2e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-11afb-proto-ws: remove dependenciesJosé Bollo1-3/+2
Remove dependencies to verbose and to afb-common. Change-Id: I140f2cd7c159e9be994ab7b786a164d605d1b1dc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Improve naming of evt_eventidsJosé Bollo1-9/+9
Change-Id: I1fa3cf776110f67ad1b18c4c83f3a1707692ae8b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Provide API and VERB name of requestsJosé Bollo1-3/+3
Change-Id: I9a86c6314f871334231e50f9cea60b54aed434b9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Make single afb_request_subcallJosé Bollo1-1/+1
Change-Id: I8cc96ef9c05781069f07b807bc6632d13668ac69 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Deprecate internal use of afb_eventJosé Bollo1-13/+13
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_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-2/+2
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-3/+3
Change-Id: Ie4668c2dadbdfbe79bac2c27a1b188edecbcf847 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-api: Define the notion of group for concurrencyJosé Bollo1-1/+1
Change-Id: Iafbbff8387bb1f8577cb7aeb6e8ed4b14ab1f4a4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-xreq: hide internal addref/unref to xreqsJosé Bollo1-3/+3
Change-Id: Ie175ec1e508c7bd3bcdc25d7e0b26e7a9da3fafb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Remove tailing spaces and TODO fileJosé Bollo1-2/+2
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é Bollo1-875/+218
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-08-31Make noconcurrency more efficientJosé Bollo1-0/+1
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-11afb-stub-ws: improvementsJosé Bollo1-14/+32
The client stub isn't connecting anymore automatically to the apiset. The function 'afb_stub_ws_client_add' provides the feature. The client now returns a afb_api structure. name and on_hangup features added. Change-Id: I204cc39adeb782f5d40360c22c79d14f54dd5c63 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-11afb-apiset: add a wrapper for 'describe'José Bollo1-7/+1
And use it in monitor. Change-Id: I9efbd19cfbdc665d1d686831b529ebaa7bd917a2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-03Make status commonJosé Bollo1-7/+7
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-1/+1
Change-Id: I231e2506f58227fb8d192df042539b1551a765c5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-31Return API description through websocketJosé Bollo1-3/+180
Change-Id: Iab10ed193bf6f6fc4240f6856c5835e35cd85dfa Signed-off-by: José Bollo <jose.bollo@iot.bzh>