summaryrefslogtreecommitdiffstats
path: root/src/afb-stub-ws.c
AgeCommit message (Collapse)AuthorFilesLines
2020-03-12afb-stub-ws: fix bug in reconnectionicefish_9.0.1icefish/9.0.19.0.1José Bollo1-1/+1
When the client reconnected, it used the wrong type and reconnected as server leading to unexpected continuations. Bug-AGL: SPEC-3272 Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: I1baac1b65014e840acb6ecedb501fc14abc17ed6
2020-03-03Fix bug in session and token removalJose Bollo1-4/+6
The bug is trivial and was revealed by testing. A copy paste bug... Bug-AGL: SPEC-3220 Change-Id: I65ed8a3a3e377338fd41a2b64b8698f421bbacb9 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2020-01-08Update copyright datesJosé Bollo1-1/+1
Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: I01a566a693b8ec6239209c9323ae4ff15a07f737
2020-01-03afb-evt: Ensure unsubscribe worksJose Bollo1-4/+1
Fix the logic of unsubscribing to events. It was not possible before to implment it without tracking every session and context. It was not done because of the required complexity. This implementation ensures that unexpected events lead to a removal of the listener from the list of watchers of the events. The management of the list of watchers is reworked to free unused memory. Bug-AGL: SPEC-3069 Change-Id: Ie67372adbde9dcb9dc6c5c2738111d22609e7256 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2020-01-03afb-evt: Improve name of listening functionsJosé Bollo1-3/+3
Some more improvement on the road of the following bug: Bug-AGL: SPEC-3069 Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: I5ad6439fa6051566ab2caf271345eda1efcef398
2020-01-03afb-proto-ws: Add message for unexpected eventJose Bollo1-2/+12
This new message allows to revoke an event no more expected or listened. Bug-AGL: SPEC-3069 Change-Id: I71945e322276f29b01b628bdf43d75599b521fc3 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-12-03afb-context: Move credentials to contextJosé Bollo1-3/+2
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-error-text: Introduce standard error textJose Bollo1-3/+4
The standard error text are used to return standard HTTP error codes. Bug-AGL: SPEC-2968 Change-Id: Ic70e7982b1e05a1830cfa4e54813227621192ae2 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-11-29afb-proto-ws: Change the protocol WSAPIJose Bollo1-172/+244
Change internals of the protocol WSAPI for the following rationale: 1. Enforce specific declaration and transmission of session identifiers and of access tokens. 2. Lower the size of identifiers to be 16 bits. 3. Introduce protocol versionning through a mechanism of offer/set. The main purpose of that change is to optimize the count of data transmitted. It manages as best as possible the transmission of access tokens the less possible times. Same for sessions that the chage was transmitted at each call. Bug-AGL: SPEC-2968 Change-Id: If0a22b86627ead35a410e51c1028025c5b02c38f Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-11-29afb-stub-ws: Enforce asynchronous describeJose Bollo1-67/+13
Because remote apis describe themselves asynchronousely, it is better to have asynchronous describe api. Bug-AGL: SPEC-2968 Change-Id: I52b4dab697f229ad01ea2b73d6b8dee22d507912 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-11-29afb-evt: Use 16 bits for idsJose Bollo1-3/+3
16 bits are enough Bug-AGL: SPEC-2968 Change-Id: I0e8708c1d6a3934a342721a6ce5edb4676df6d1b Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
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>