summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2019-03-11c++: Reworked the event classLoïc Collignon1-8/+11
Added move semantic and remove invalidation method as it's not used anymore since we drop the support of APIv2. Change-Id: If53840010d6f24d410712915051386190f55b504 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: Fix multiple definition and castLoïc Collignon1-6/+3
The function was defined as many time as the header was included. Making it a weak function fix the issue. Also, a plain old C cast is required to make this constexpr valid. Change-Id: I278f376e00ec6728272df4fde8ca8984195dd533 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: Add verb initialisation for C++Jose Bollo2-6/+37
This new constexpr initialisation method accepts a callback receiving a afb::req instead of a afb_req_t. Change-Id: I752e670b5545a9d7956987984e725b468196a6e9 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-03-11c++: Fix a wrong callback versionLoïc Collignon1-1/+1
It used the legacy callback definition of apiv2 instead of the apiv3 one. Change-Id: Iab281131a923ae59cfbbb50cf72fd4a5c3f11d65 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: Drop support of binding APIv2Loïc Collignon1-87/+3
The C++ interface is currently used only in APIv3. Change-Id: Id1a3bca5dc8e69c1af229871e7f33192395230e7 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: Avoid relative path when including headersLoïc Collignon4-7/+8
Prefer the system path to include headers. Change-Id: I08a64e8d27808084ea4592988f36b7e5099a7fc6 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: New C++ API for bindingsLoïc Collignon4-1/+344
You can implement a C++ binding API by inheriting the templated base class 'base_api_t' and overriding the methods you want. At the same time, the c++ files are now located in in their own subdirectory: afb/c++ Change-Id: Ie02535961ec6b4b5ae21390cb520acb1fdc44c9e Signed-off-by: Loïc Collignon <loic.collignon@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-03-07Fix build dep on OBSronan1-0/+6
Change-Id: I95fa03c430b9f488b3b5b9a9bdfc50a1ff0f0421 Signed-off-by: ronan <ronan.lemartret@iot.bzh>
2019-03-07Upgrade dependency to libmicrohttpd version 0.9.60José Bollo4-5/+5
The version of libmicrohttpd required is 0.9.60 at least. Change-Id: Ia0784f5433d63d4de50654dd7577a8767578c069 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-08stress: Improve the stress test scriptsJosé Bollo2-69/+109
The improvement was able to track the bug SPEC-2163 by launching: - ./stress-server.sh --ws --valgrind - ./stress-clients.sh --null --count 20 Bug-AGL: SPEC-2163 Change-Id: I04634f0e98ab7a28df7c1d34ecc0d9c1faf43d57 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é Bollo188-190/+190
Change-Id: I3aaa92b2bfb01699ee8ae609272e93032b6f1a9d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-06Set next version of binderJosé Bollo1-1/+1
Change-Id: I53c43380902f96b7a46a6a131a956965d7cf6fbc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-06jobs: Ensure releasing event loopJose Bollo3-1/+32
The internal functions blocking threads for implementing call_sync were not releasing the event loop, leading to deafness of the binder. Include a tuto-4 that reproduce the issue on a binder with the bug and that also shows interesting usages of the binder. Bug-AGL: SPEC-2161 Change-Id: I83ad4d55d721a6046e798a5e06967df4dd5a7284 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-18Merge changes from topic 'spec-2089'guppy_6.99.4guppy/6.99.46.99.4Jan-Simon Moeller10-298/+264
* changes: hello3: Fix warning unused variable afb-hsrv: Avoid call to getnameinfo jobs: Remove conditionnal REMOVE_SYSTEMD_EVENT jobs: Separate internal threads from others jobs: Refactor event loop handling afb-proto-ws: Serialize incoming message
2019-01-18hello3: Fix warning unused variableJose Bollo1-1/+0
The variable 'calling' was not used anymore. Change-Id: I3a041cee57b2682374084003415d13a77a554fba Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-18afb-hsrv: Avoid call to getnameinfoJosé Bollo1-6/+12
Calling getnameinfo may block the program a long time (5s) when address is zero. Bug-AGL: SPEC-2133 Change-Id: Id52b2989c5e996363fd4b6f39049f059a6ee97a2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-01-16jobs: Remove conditionnal REMOVE_SYSTEMD_EVENTJose Bollo3-128/+0
The removal of the systemd event loop will be made in later changes. Change-Id: Ia6c52feb4969f360c31cbfc50ae991f1767f007d Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-16jobs: Separate internal threads from othersJosé Bollo1-61/+92
Foreign threads, that are not started by jobs, are allowed to use synchronous jobs_call/job_leave (directly or indirectly). This commit ensure that those foreign thread will neither acquire the eventloop nor execute jobs. Includes a tiny cleanup of remain usage. Bug-AGL: SPEC-2089 Change-Id: I2ad7fcfe2c276e34bdc4ec0c2aa3a4207bea1854 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-01-16jobs: Refactor event loop handlingJosé Bollo3-125/+184
This improves the arbitration of the single event loop across threads. Before introduction of using 'evenfd' there was several event loop. At the current time, there is only one. At the end, there will probably remain only one. Bug-AGL: SPEC-2089 Change-Id: Iac9db7cbe15b4c9c76e6e9a8f6e641ed2a9039e0 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-01-16afb-proto-ws: Serialize incoming messageJosé Bollo3-7/+6
Enforce serialisation for a connection Bug-AGL: SPEC-2089 Change-Id: Id9f261b7cc02fda78922dc511856c34b7c5bf56d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-01-16packaging: update dependency on libmicrohttpd versionRonan Le Martret1-1/+3
app-framework-binder dependency on libmicrohttpd version has been set at least to 0.9.62 Change-Id: If6af70611a5cd6236068781437e4bcbd28f368b7 Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
2019-01-05Merge "afb-api-v3: Fix potential buffer overflow"Stéphane Desneux1-4/+5
2019-01-04afb-api-v3: Fix potential buffer overflowJose Bollo1-4/+5
Change-Id: I170e127ebf96d2accfdd6d6a4ec322afeaa2782f Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-04afb-binding-v3: Fix issues in includesJosé Bollo2-5/+6
Fix 1: afb_api_v3_verbose doesn't exist Fix 2: afb_api_vverbose isn't declared Fix 3: Ensure implicit cast of "api" and "req" Using presupposed knowledge of internals of afb_api_t and afb_req_t is bad when dealing with implicit conversion in C++ and is generally not the way to go. Change-Id: I2630faa5ea0ae315ca95e4fd6ed6ae1a0beb01a5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-01-03packaging: Remove hard dependency to samplesJose Bollo2-16/+2
Fixing names and number of samples in packaging could be avoided. Change-Id: I57355e68be45e1a4fdd6d76bcd44dea57ca63813 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-02hello3: Add verb 'after'Jose Bollo2-2/+79
The verb 'after' launches a new thread that after a delay will call a verb (like call). The type of call can be set to 'call', 'callsync', 'subcall' or 'subcallsync'. This allows to add test for asynchronous issues in multithreaded environment. Change-Id: Ic59a27b7b7fbd3716d34fdaa35c42aa9ecb7f201 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-02bindings/samples: Cleanup and tiny commentJose Bollo5-1465/+14
The count of samples was too large and with duplications. Hopefuly, removing duplications and adding a tiny README file lowers fuzzy. Change-Id: I55ed8f40a4f1e6e28e2a36f2819e25505246ecdd Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-12-31jobs: Fix a lock of call syncJose Bollo1-24/+59
Sometime the function jobs_leave missed to wake up the process that expected the result. It happened when that waiting thread was locked in the epoll. That commit unlock it. Bug-AGL: SPEC-2089 Change-Id: I6ab6a60a8c9ea3639143f282f90c7b77ed16853a Signed-off-by: Jose Bollo <jose.bollo@iot.bzh> Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
2018-12-19Remove useless %lang% prefix in yaml book fileguppy_6.99.3guppy/6.99.36.99.3Sebastien Douheret1-20/+20
Change-Id: I25c5efebc281f774324851372d2d074e31988847 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2018-12-14wrap-json: Upgrade to latest versionJosé Bollo1-18/+19
Change-Id: I3eb4e922cb5106bcf8a1ccc5e1b010bd0a60bf34 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-12-13afb-hsrv: Prepare selection of listening interfacesJose Bollo4-14/+139
The listening socket will no more be the default one but will be the selected ones, with ability to select more than just one listening interface. Nevertheless, the behavior is not changed at the moment. The default interface (0.0.0.0) is still used. A further change will add the ability to select the listening interfaces. That evolution depends on a fix of libmicrohttpd to enable at the same time epoll and no-listen-fd. Bug-AGL: SPEC-1833 Bug-AGL: SPEC-1016 Change-Id: Ia78671cbee90a243ba7b2c724b6155cffbde6920 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-12-13afb-trace: Make real timestampsJosé Bollo1-10/+0
The optimisation that represent the timestamp as a fake double is not accurate in local context. Bug-AGL: SPEC-2051 Change-Id: I285837251507a69ad210823020d0cf69ad5999f3 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-12-13docs: add yaml bookClément Bénier1-0/+55
SPEC-1988 Change-Id: Ida94e5cf39b8c23efca9620d62ec2db55746d2b3 Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
2018-12-05afb-proto-ws: Add error reportJose Bollo3-1/+15
Change-Id: I58c88f8bcaf4cfb8a53b58eeefd7fa3415bf894a Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-12-05afb-hook: Improve reentrancy of hookingJosé Bollo1-126/+163
Work on testing showed that a deadlock was occuring in management of hooks. Change-Id: Ib51eb4f0b9ffc5d9dfe2770f2c3f8f47f262b60f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-11-28Fix deprecation warnings for older GCC versionsguppy_6.99.2guppy/6.99.26.99.2Johann CAHIER1-2/+2
For some reason, SDK doesn't display warning when AFB_BINDING_VERSION is defined as 2. Using #warning instead of #pragma GCC warning fixes the display. Change-Id: I3c96b3630e0d1eac63b2fde72bdec3c7f3d1714a Signed-off-by: Johann CAHIER <johann.cahier@iot.bzh>
2018-11-22globset: Introduce globset for event handlingguppy_6.99.1guppy/6.99.16.99.1Jose Bollo9-87/+693
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-20AFB.js: Tiny improvement and space fixJosé Bollo1-4/+4
Change-Id: I170abe0dd1a1de3d2cc2ea7f86c746eb93e63eae Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-11-16afb-socket: Fix address reuseJosé Bollo1-7/+7
Change-Id: I3ae51611b92762a4f09b1f6cca6ff27853cd9f95 Signed-off-by: José 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-11-08main-afb-daemon: Export variables to connect to binderJosé Bollo1-12/+42
Two new variables are exported that will allow to connect to the binder: - AFB_PORT: the HTTP port that the binder listen - AFB_TOKEN: the initial token that the binder expects These variables are defined only if the HTTP server is started. They are available during initialisation of bindings, even if it is before the real start of the HTTP server. Change-Id: I1b7c8572e3d77b7036a32af47b2a2f1d95803a41 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-11-02Merge "afb-socket: Relax requirement of tcp ending slash"Jan-Simon Moeller1-1/+1
2018-11-02Merge "afb-socket: Handle listening on all interfaces"Jan-Simon Moeller1-0/+5
2018-10-30afb-socket: Relax requirement of tcp ending slashJosé Bollo1-1/+1
The uri for tcp was requiring a slash (/) after the port. This change allows to not provide that slash. This is usefull for future implementation of HTTP server selection. Change-Id: I0a76d167065258d242845579b7c8728eefcc359f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-10-30samples: Fix compiling errorJose Bollo1-1/+1
Latest versions of libraries used doesn't define TRUE. This fix it by using 1 instead. Change-Id: I17db5ca34aeceab96c83143f49094fbaca74a95a Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-10-30afb-socket: Handle listening on all interfacesJose Bollo1-0/+5
Change-Id: I909493166f98f152e5aeb02a72f40bc3c58b42b2 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-10-26afb-hsrv: Adapt to next version of libmicrohttpdJosé Bollo1-1/+4
Change-Id: I5bef17178e972e73b653ddbff5a8b09cfc2287eb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-10-23Added an option to color out the ouputLoïc Collignon5-7/+68
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>