aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-export.c
AgeCommit message (Collapse)AuthorFilesLines
2019-07-18Tag broadcasted events with UUID and hopJosé Bollo1-1/+1
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-2/+12
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-05-03afb-export: Fix requirement on multiple apisJosé Bollo1-6/+18
The test 'test-apiv3' was failing because the required api list "albert armel" wasn't splitted but set as-is. At the same time, test suite is improved. Bug-AGL: SPEC-1130 Bug-AGL: SPEC-2377 Change-Id: Ia4ab23bf666b5b4b1db3e1da2654d9387c2c01e5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-04-04afb-export: Fix heap corruptionJosé Bollo1-1/+1
The allocated size wasn't correct when 'path' was used. The effect be unseen depending on size and alignment of heap chunks. Change-Id: Id9f85a0078028319491b51bc3e11cd51e4bc3755 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
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-57/+101
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-04-02Improve setting of optionsJose Bollo1-15/+15
Change-Id: Idbadb9b7b801cb61d527addb5d3137aeb4cf6311 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-03-29hooks: Allow to remove hooking (and/or trace)Jose Bollo1-98/+137
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-03-27system & jobs: Reverse link and acquiring eventsJosé Bollo1-9/+36
- The new version of 'systemd_get_event_loop' dont depends anymore on jobs but returns a unique systemd event loop for any threads. - The event loop of jobs now use system.h function instead of the opposite. - The function 'jobs_get_sd_event' is removed - The function 'jobs_acquire_event_manager' is introduced. It is designed to that the current thread can manipulate the single event manager Change-Id: I31fe48dfe0f2cfa4d468e49338d36fea6e7e8081 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-27Rename afb-systemd to systemdJosé Bollo1-10/+11
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-11-22globset: Introduce globset for event handlingguppy_6.99.1guppy/6.99.16.99.1Jose Bollo1-87/+43
It optimises the event handling that was slow. It also fix few bugs: - at most one event handler is called now - the handler call has the most specific pattern Change-Id: Ic13a0258b5743579ab15e0e953ec62206d982850 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-11-16afb-export: Fix error in event handlingJosé Bollo1-1/+1
Change-Id: I2869a2a840fb07550d493ddc2d651358892d33d1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-10-23Added an option to color out the ouputLoïc Collignon1-1/+1
Enhance the readability using basic colorization to the logging system. As the '--call' option is almost unused, it doesn't require to have a shortname. So we use the '-c' and '--color' for the new colorization option, and keep only the longname for the 'call' option. Change-Id: I095fc9f38133fb742e0f0003540cd120feec8f5e Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2018-09-24afb-export: Emit a warning on bad 'afb_require_api' callguppy_6.90.0guppy/6.90.06.90.0José Bollo1-0/+5
The call to 'afb_require_api' in a preinit was forbiden before binding v3 refactoring. Since v3 it is made possible by deferring the requirement to the initialisation step. But this may lead to bad behaviour if someone use the call to test whether an api exists or not. This commit introduce a message that could warn a developper raising that issue. Change-Id: Icc14c3887d70f73d87da0e664bb0e5e961867b4a Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-08-08afb-export: Provide the real path of the bindingflounder_5.99.3flounder/5.99.35.99.3José Bollo1-2/+6
The path can be a symbolic link. It must be resolved to be usefull. Change-Id: I5db247fd9925065684e036d8d458c2131006f9db Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-08-02afb-export: Manage path of librariesJosé Bollo1-21/+49
This change allows a binding to know its installation path. This path is retrieved using the api function 'afb_api_settings'. The path is returned --if known-- as a string of key "binding-path". Change-Id: Ie1a349dc4936d4ccf173f1f77e118099f7f0599a Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-08-02Add ability to provide binding settingsJosé Bollo1-0/+61
Change-Id: Iab93a26340fa9743a58ca43cd903bbf31c783e5b Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-07-27afb-export: Set API context as validatedJosé Bollo1-0/+1
An API is always valid internally to the binder. Change-Id: I3c8eed166c9cfc1bcc47daa30c8f327af777d136 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-07-24json-c: Remove escaping of slashsJosé Bollo1-1/+5
By default json-c escapes the slashes. This is almost ugly and unuseful. But the resolution (with JSON_C_TO_STRING_NOSLASHESCAPE) was introduced lately by json-c. Integrate it as much as possible. Change-Id: Ia9c4bee78dc11df1ee9640cb04311991bd860e43 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-07-24afb-export: Fix event handler of APIJosé Bollo1-2/+2
Change-Id: Ibadaf6f41e39cce398d33a2a2a73751d68dad34d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-07-16Simplify starting of servicesJosé Bollo1-18/+11
The previous version was confusing and was expecting that onneed and share_session were always true. Removing this parameter simplifies the code. Also handle errors of required classes and apis at initialisation. Change-Id: I7c99aa356cba41f368bd47cab797fa086a5740af Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-07-13afb-export: Monitor calls to API initialisationJosé Bollo1-19/+49
Catching SEGV or other exceptional execution error is better for the whole process. Change-Id: I0ece72abe5e0a7ebd7d29aafa416462e6e5963af Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-06-15api-v3: First draftJosé Bollo1-702/+1072
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-21afb-systemd: Isolate systemd main entriesJosé Bollo1-9/+10
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-01-31afb-evt: Add event creation with prefixJosé Bollo1-11/+1
Change-Id: I2fd35e8ed59c28f4283be698a2586cdae5f7c8cf Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-01-31afb-api: Enforce api names to be hookableJosé Bollo1-1/+1
Change-Id: Ic1d5cb208c636d3261e1a96c4a81b488cb84a60e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-11-13afb-export: Ensure monitoring of eventsJosé Bollo1-1/+1
Change-Id: Id82c624f695a229023447c16652bcc912b6d6fed Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-11-06afb-session: redefine the function 'afb_session_create'José Bollo1-2/+2
Change-Id: Ib8a66af30ea2438248adb66c9a95ac82663ec223 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-11-03Add 'noconcurrency' when creating dynamic APIeel_4.99.2eel/4.99.24.99.2José Bollo1-2/+4
Change-Id: Ia108b23b9480bb32f27127ef00c18086fcf86752 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Improve naming of evt_eventidsJosé Bollo1-1/+1
Change-Id: I1fa3cf776110f67ad1b18c4c83f3a1707692ae8b 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-09Provide the name of the APIJosé Bollo1-0/+2
Change-Id: I5b4e4b40385830d1b8921d079f5e7e732ec4247f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Add a closure argument to dynamic verbsJosé Bollo1-2/+4
Also demonstrate the mix of api v2 with dynapi. Change-Id: I95e8d32ac836590ce3f7b3f0b5f29e5574808976 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Allow dynamic creation of APIsJosé Bollo1-32/+453
Change-Id: I825bfa7969c98dd214457d9ff94e2948362286a9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-export: prepare to eventidJosé Bollo1-7/+17
Change-Id: I87c09c2edb198598b3d303ceff07fcd6ec6a40f1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-export: cleanup of unused asyncJosé Bollo1-3/+0
Change-Id: I69e02e32444fe460219d849b26beb3db36ab5467 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Deprecate internal use of afb_eventJosé Bollo1-2/+6
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-09afb-export: record apiset at creationJosé Bollo1-8/+7
Change-Id: I058eaee990e34990d0860a316ba8c348c23eff5f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09Refactor of starting apisJosé Bollo1-57/+116
Change-Id: Ib2efcd8747c3537714dfa7058bb0623d6e283c3d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-export: getter for the apisetJosé Bollo1-3/+7
Change-Id: I6cb5bb0f19a6427bcc6532152863b67bc70dced4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-xreq: hide internal addref/unref to xreqsJosé Bollo1-2/+2
Change-Id: Ie175ec1e508c7bd3bcdc25d7e0b26e7a9da3fafb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09afb-export: refactor of binder interfaceJosé Bollo1-0/+882
The interfaces of the binder called afb_ditf and afb_svc are merged together to create the afb_export structure. Change-Id: I841ba04d7b2f94bfc19f691ec746d0bd221f164d Signed-off-by: José Bollo <jose.bollo@iot.bzh>