summaryrefslogtreecommitdiffstats
path: root/src/afb-proto-ws.c
AgeCommit message (Collapse)AuthorFilesLines
2020-03-03Fix a tiny issue in the protocolJose Bollo1-4/+4
The id sent was 16 bits in one case and 32 bits in the other Bug-AGL: SPEC-3220 Change-Id: If38c99b2d903b6851ff4682e1f8d771aec7ddcee 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-proto-ws: Add message for unexpected eventJose Bollo1-0/+19
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>
2020-01-03afb-proto-ws: Improve comment and namesJose Bollo1-21/+21
Some more comment and naming improvement on the road of the following bug: Bug-AGL: SPEC-3069 Change-Id: I001ccfba2ea59604d217feb6afe3e5a313f3fbaf Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-11-29afb-proto-ws: Change the protocol WSAPIJose Bollo1-132/+352
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-20afb-proto-ws: Fix crash on event to disconnectedJose Bollo1-98/+102
There was a race condition that made the binder crashing when reporting event to a client that was disconnecting. Bug-AGL: SPEC-2967 Change-Id: I37a654960b42fbce5548ace9d3fb50cf2b375090 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-07-18Fix bad memory access at client disconnectionJosé Bollo1-9/+5
The management of structures handling a client connection to a exported --ws-server was accessing freed memory. Tha commit fixes that issue. Bug-AGL: SPEC-2651 Change-Id: I511218afc907308347bc422a8aead32ca00bdae6 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-07-18Tag broadcasted events with UUID and hopJosé Bollo1-7/+25
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-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-4/+3
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/+13
Change-Id: I58c88f8bcaf4cfb8a53b58eeefd7fa3415bf894a Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-08-23afb-stub-ws: Safe handling of deconnectionsJose Bollo1-1/+1
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-23Send error replies on disconnectionJose Bollo1-2/+12
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-02Improve parsing of json stringJose Bollo1-2/+3
Change-Id: I7100961ef8f8a75d623a0667178f191dd4cfb9d3 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-07-06Simplify build by introducing queuing functionJosé Bollo1-36/+37
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-258/+48
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-13/+14
This is an effort to keep cutting dependency to systemd. Change-Id: I9a0c032a1095e297c7f3ac5b67827fda3658b8d9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-11-17afb-proto-ws: Fix autolock in proto-wsJosé Bollo1-48/+94
Because a systemd event loop can not be reentered while evaluating an event callback, the event loop was removed from the threads. It had the effect to enter in deadlock when calling a synchronous call while in an event callback. Queueing a job solves the issue. But because using queued job has implications on libafbws, a fake job manager is added for libafbws. Change-Id: Id793bea55743790082eaab48cd4cc87f7993772a Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-11-11afb-proto-ws: fix self locking issueJosé Bollo1-29/+82
Calling synchronously a verb on an event of the same API was blocking. Change-Id: I58a988c6df8c60cd3a38c3cdff23d7be8b6be54e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-11-03afb-proto-ws: Fix unclosed file descriptorJosé Bollo1-0/+1
Change-Id: I3c831b4f803e283fc692fef66621a798a5e9296e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-11afb-proto-ws: remove dependenciesJosé Bollo1-17/+6
Remove dependencies to verbose and to afb-common. Change-Id: I140f2cd7c159e9be994ab7b786a164d605d1b1dc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Remove tailing spaces and TODO fileJosé Bollo1-1/+1
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-0/+1171
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>