aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-evt.c
AgeCommit message (Collapse)AuthorFilesLines
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-102/+132
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-7/+7
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-0/+30
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-11-29afb-evt: Use 16 bits for idsJose Bollo1-16/+24
16 bits are enough Bug-AGL: SPEC-2968 Change-Id: I0e8708c1d6a3934a342721a6ce5edb4676df6d1b Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-07-18Tag broadcasted events with UUID and hopJosé Bollo1-14/+87
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-71/+33
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-12afb-evt: send events in separate jobJose Bollo1-41/+226
Sending events in the context of the calling process had the consequence that the ordering of the messages had to be removed (see SPEC-2215 & SPEC-2219). This was not good by nature and lead to issues SPEC-2542 and SPEC-2599. Sending events in the context of the calling process also implies to delay the calling process. For this reasons, sending events is now done in an other jobs. For that reason, the count of allowed pending jobs is increased to 100 (was 50). Bug-AGL: SPEC-2215 Bug-AGL: SPEC-2219 Bug-AGL: SPEC-2542 Bug-AGL: SPEC-2599 Change-Id: I5b56d952cc187b65ad6eb9344ad74e5e8d3b7540 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-07-12afb-evt: Improve compatibility to guppyJosé Bollo1-89/+99
The commit "a2cf84e: hooks: Allow to remove hooking" re-order fragment of code. But this is an issue when backporting changes to guppy. That commit improve the situation for the file afb-evt.c in the process of fixing the issue SPEC-2599 Bug-AGL: SPEC-2599 Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: I4e56cbeee7d3a89770e37a3045f652f39fc07410
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-04-02Add conditionnal support of bindings version 2Jose Bollo1-0/+2
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-90/+114
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-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-06-15api-v3: First draftJosé Bollo1-72/+75
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-01-31afb-evt: Add event creation with prefixJosé Bollo1-0/+29
Change-Id: I2fd35e8ed59c28f4283be698a2586cdae5f7c8cf Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Add function afb_evt_eventid_addrefJosé Bollo1-0/+9
Change-Id: I737f3ceaa41b5ec9a200a615dbc29965ed11c17c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Improve naming of evt_eventidsJosé Bollo1-19/+19
Change-Id: I1fa3cf776110f67ad1b18c4c83f3a1707692ae8b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Deprecate internal use of afb_eventJosé Bollo1-22/+34
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-12/+13
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-18/+6
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-155/+325
Change-Id: Ie4668c2dadbdfbe79bac2c27a1b188edecbcf847 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-08-08afb-evt: fix a bug discovered by clang-checkJosé Bollo1-9/+5
Change-Id: I6bb1dffeb17fdcaf6e3a2686651d35dd0b0500b9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-31afb-evt: add internal push functionsJosé Bollo1-3/+30
For the implementation of monitoring, the event should be pushed without hooking internal. Change-Id: I4372bbc55e78c851db660a69bb2e60995fbdc88f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-07-31afb-evt: unprefix event nameJosé Bollo1-1/+3
Removes the api prefix of the event name. Change-Id: I050dc86beb08659751c1e57b8d3ea233bac9e411 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-01Add hooking for eventsJosé Bollo1-15/+60
Change-Id: If5fe736e04c9f4298302c3cbba568f1d6346ee67 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-05-18Fix a bug in subscribers countingJosé Bollo1-3/+4
To avoid as much as possible allocation/deallocation when possible sequences of subscribe/unsubscribe are encountered, the watch strucutre of events is destroyed only when either the event or the client is destroyed. This commit fixes a bad handling in the count of active subscribers. Change-Id: I3f240e69c3b21356ff07f584fe9bfb578d46732b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-11Fix uninitialized variableJosé Bollo1-0/+1
Change-Id: Ia8a7a1471f004933a48797b91c01fd8b53465de0 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-10Make implementation multithreadJosé Bollo1-35/+89
This changes makes many improvement needed for multi-threading: - json object can't be shared across threads because get/set is not protected - event are now multithread compatible Change-Id: Id44b12c68e0fa67042b8ea44939af4edfa76270a 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-10-14event: add ability to get the event nameJosé Bollo1-3/+13
Change-Id: Iecfeb4ab07c07715093d729710669abecee722de Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-06-23evt: handles broadcasting and trackingJosé Bollo1-30/+115
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-06-17evt: exposes name of eventsJosé Bollo1-0/+8
Change-Id: I1976848be0e8aeb170da37e1254208035e0e741a Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-06-17evt: improves commentsJosé Bollo1-4/+88
Change-Id: I6c3e855030af9064335028e51d10c41db85a3f3c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-06-17evt: minor cleanupJosé Bollo1-5/+0
Change-Id: Ice4620cabc5a8643551439a149e80df255438020 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-06-09Events: refactoringJosé Bollo1-0/+261
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>