src/app-framework-binder.git
5 years agoUpdate copyright date
José Bollo [Tue, 5 Feb 2019 08:02:02 +0000 (09:02 +0100)]
Update copyright date

Change-Id: I3aaa92b2bfb01699ee8ae609272e93032b6f1a9d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoSet next version of binder
José Bollo [Tue, 5 Feb 2019 07:45:47 +0000 (08:45 +0100)]
Set next version of binder

Change-Id: I53c43380902f96b7a46a6a131a956965d7cf6fbc
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agojobs: Ensure releasing event loop
Jose Bollo [Wed, 6 Feb 2019 16:16:09 +0000 (17:16 +0100)]
jobs: Ensure releasing event loop

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>
5 years agoMerge changes from topic 'spec-2089'
Jan-Simon Moeller [Fri, 18 Jan 2019 18:28:56 +0000 (18:28 +0000)]
Merge changes from topic 'spec-2089'

* 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

Change-Id: I52455af14cb7d6fb69bc2b5eecacf688348cba58

5 years agopackaging: update dependency on libmicrohttpd version
Ronan Le Martret [Wed, 16 Jan 2019 08:29:53 +0000 (09:29 +0100)]
packaging: update dependency on libmicrohttpd version

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>
5 years agohello3: Fix warning unused variable
Jose Bollo [Mon, 14 Jan 2019 13:40:04 +0000 (14:40 +0100)]
hello3: Fix warning unused variable

The variable 'calling' was not used anymore.

Change-Id: I3a041cee57b2682374084003415d13a77a554fba
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agoafb-hsrv: Avoid call to getnameinfo
José Bollo [Sat, 5 Jan 2019 20:15:40 +0000 (21:15 +0100)]
afb-hsrv: Avoid call to getnameinfo

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>
5 years agojobs: Remove conditionnal REMOVE_SYSTEMD_EVENT
Jose Bollo [Wed, 16 Jan 2019 16:23:40 +0000 (17:23 +0100)]
jobs: Remove conditionnal REMOVE_SYSTEMD_EVENT

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>
5 years agojobs: Separate internal threads from others
José Bollo [Wed, 16 Jan 2019 10:57:38 +0000 (11:57 +0100)]
jobs: Separate internal threads from others

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>
5 years agojobs: Refactor event loop handling
José Bollo [Sun, 6 Jan 2019 09:34:12 +0000 (10:34 +0100)]
jobs: Refactor event loop handling

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>
5 years agoafb-proto-ws: Serialize incoming message
José Bollo [Sat, 5 Jan 2019 20:08:33 +0000 (21:08 +0100)]
afb-proto-ws: Serialize incoming message

Enforce serialisation for a connection

Bug-AGL: SPEC-2089

Change-Id: Id9f261b7cc02fda78922dc511856c34b7c5bf56d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoMake the object inherits the 'raw' class
Loïc Collignon [Mon, 21 Jan 2019 09:40:50 +0000 (10:40 +0100)]
Make the object inherits the 'raw' class

Base the 'object' api on the newly added api wrapper.

Change-Id: I8370552688bed19265427213fc1cc2f5660aada3
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
5 years agoAdded an 'api' wrapper
Loïc Collignon [Fri, 4 Jan 2019 15:50:06 +0000 (16:50 +0100)]
Added an 'api' wrapper

New 'api' wrapper for 'api' related functions.

Change-Id: If6fd7adad1d3172defffe020203b637ace17aa6e
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
5 years agoReworked the event class
Loïc Collignon [Fri, 4 Jan 2019 15:05:10 +0000 (16:05 +0100)]
Reworked the event class

Added move semantic and remove invalidation method as it's not used anymore
since we drop the support of APIv2.

Change-Id: I291155cef3e55ca14c706aa2315ab8dbfd09dffb
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
5 years agoFix multiple definition and cast
Loïc Collignon [Fri, 4 Jan 2019 14:49:18 +0000 (15:49 +0100)]
Fix multiple definition and cast

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: Iee5677873180accfddcad0b3a58f3776f9fd8c5e
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
5 years agobinding-wrap: Add verb initialisation for C++
Jose Bollo [Wed, 2 Jan 2019 16:38:00 +0000 (17:38 +0100)]
binding-wrap: Add verb initialisation for C++

This new constexpr initialisation method accepts
a callback receiving a afb::req instead of a
afb_req_t.

Change-Id: I742e3dcf1e81873e76f61c319198e3cf7ef5ec0f
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agoFix a template that use the wrong callback definition
Loïc Collignon [Fri, 4 Jan 2019 14:31:02 +0000 (15:31 +0100)]
Fix a template that use the wrong callback definition

It used the legacy callback definition instead of the good one.

Change-Id: I5ad6e881e9fb99f1076a6dfa9ded221ccfec4a03
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
5 years agoDrop APIv2 support on the C++ interface
Loïc Collignon [Fri, 4 Jan 2019 14:25:31 +0000 (15:25 +0100)]
Drop APIv2 support on the C++ interface

The C++ interface is currently used only in APIv3.

Change-Id: Idc53bc80a939292f9882fdc62849dd27e543cbf8
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
5 years agoAvoid relative path when including headers
Loïc Collignon [Fri, 4 Jan 2019 14:22:27 +0000 (15:22 +0100)]
Avoid relative path when including headers

Prefer the system path to include headers.

Change-Id: Id20d7c07b628bb8da25abeef3bc10456693a93f9
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
5 years agoAdded a new C++ API
Loïc Collignon [Wed, 2 Jan 2019 16:44:27 +0000 (17:44 +0100)]
Added a new C++ API

You can create an API by inheriting a base class and overring the
methods you want.

Change-Id: I62fa5ee8f347cd4d7baa7df39c0fcd6c83c4c34e
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
5 years agoafb-api-v3: Fix potential buffer overflow
Jose Bollo [Fri, 4 Jan 2019 13:30:04 +0000 (14:30 +0100)]
afb-api-v3: Fix potential buffer overflow

Change-Id: I170e127ebf96d2accfdd6d6a4ec322afeaa2782f
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agoafb-binding-v3: Fix issues in includes
José Bollo [Wed, 2 Jan 2019 19:01:44 +0000 (20:01 +0100)]
afb-binding-v3: Fix issues in includes

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>
5 years agopackaging: Remove hard dependency to samples
Jose Bollo [Thu, 3 Jan 2019 12:53:16 +0000 (13:53 +0100)]
packaging: Remove hard dependency to samples

Fixing names and number of samples in packaging
could be avoided.

Change-Id: I57355e68be45e1a4fdd6d76bcd44dea57ca63813
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agohello3: Add verb 'after'
Jose Bollo [Mon, 31 Dec 2018 10:15:19 +0000 (11:15 +0100)]
hello3: Add verb 'after'

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>
5 years agobindings/samples: Cleanup and tiny comment
Jose Bollo [Mon, 31 Dec 2018 08:59:16 +0000 (09:59 +0100)]
bindings/samples: Cleanup and tiny comment

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>
5 years agoAdded a new C++ API
Loïc Collignon [Wed, 2 Jan 2019 16:44:27 +0000 (17:44 +0100)]
Added a new C++ API

You can create an API by inheriting a base class and overring the
methods you want.

Change-Id: I62fa5ee8f347cd4d7baa7df39c0fcd6c83c4c34e
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
5 years agojobs: Fix a lock of call sync 95/19395/4
Jose Bollo [Mon, 31 Dec 2018 08:33:01 +0000 (09:33 +0100)]
jobs: Fix a lock of call sync

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>
5 years agoRemove useless %lang% prefix in yaml book file 65/19165/1 6.99.3 guppy/6.99.3 guppy_6.99.3
Sebastien Douheret [Wed, 19 Dec 2018 22:19:32 +0000 (23:19 +0100)]
Remove useless %lang% prefix in yaml book file

Change-Id: I25c5efebc281f774324851372d2d074e31988847
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
5 years agowrap-json: Upgrade to latest version 27/18927/1
José Bollo [Fri, 14 Dec 2018 17:37:14 +0000 (18:37 +0100)]
wrap-json: Upgrade to latest version

Change-Id: I3eb4e922cb5106bcf8a1ccc5e1b010bd0a60bf34
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-hsrv: Prepare selection of listening interfaces 47/18747/2
Jose Bollo [Tue, 30 Oct 2018 13:31:33 +0000 (14:31 +0100)]
afb-hsrv: Prepare selection of listening interfaces

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>
5 years agoafb-trace: Make real timestamps 45/18745/2
José Bollo [Wed, 12 Dec 2018 16:13:14 +0000 (17:13 +0100)]
afb-trace: Make real timestamps

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>
5 years agodocs: add yaml book 35/18735/2
Clément Bénier [Wed, 12 Dec 2018 08:40:02 +0000 (09:40 +0100)]
docs: add yaml book

SPEC-1988

Change-Id: Ida94e5cf39b8c23efca9620d62ec2db55746d2b3
Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
5 years agoafb-proto-ws: Add error report 85/18585/1
Jose Bollo [Mon, 3 Dec 2018 14:16:30 +0000 (15:16 +0100)]
afb-proto-ws: Add error report

Change-Id: I58c88f8bcaf4cfb8a53b58eeefd7fa3415bf894a
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agoafb-hook: Improve reentrancy of hooking 83/18583/1
José Bollo [Tue, 4 Dec 2018 11:05:01 +0000 (12:05 +0100)]
afb-hook: Improve reentrancy of hooking

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>
5 years agoFix deprecation warnings for older GCC versions 77/18377/1 6.99.2 guppy/6.99.2 guppy_6.99.2
Johann CAHIER [Wed, 28 Nov 2018 14:29:45 +0000 (15:29 +0100)]
Fix deprecation warnings for older GCC versions

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>
5 years agoglobset: Introduce globset for event handling 73/18173/1 6.99.1 guppy/6.99.1 guppy_6.99.1
Jose Bollo [Thu, 22 Nov 2018 08:03:33 +0000 (09:03 +0100)]
globset: Introduce globset for event handling

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>
5 years agoAFB.js: Tiny improvement and space fix 77/18077/1
José Bollo [Tue, 20 Nov 2018 08:58:50 +0000 (09:58 +0100)]
AFB.js: Tiny improvement and space fix

Change-Id: I170abe0dd1a1de3d2cc2ea7f86c746eb93e63eae
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-socket: Fix address reuse 61/18061/1
José Bollo [Fri, 16 Nov 2018 18:09:22 +0000 (19:09 +0100)]
afb-socket: Fix address reuse

Change-Id: I3ae51611b92762a4f09b1f6cca6ff27853cd9f95
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-export: Fix error in event handling 45/18045/1
José Bollo [Fri, 16 Nov 2018 10:37:54 +0000 (11:37 +0100)]
afb-export: Fix error in event handling

Change-Id: I2869a2a840fb07550d493ddc2d651358892d33d1
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agomain-afb-daemon: Export variables to connect to binder 11/17811/1
José Bollo [Thu, 8 Nov 2018 14:25:11 +0000 (15:25 +0100)]
main-afb-daemon: Export variables to connect to binder

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>
6 years agoMerge "afb-socket: Relax requirement of tcp ending slash"
Jan-Simon Moeller [Fri, 2 Nov 2018 12:47:36 +0000 (12:47 +0000)]
Merge "afb-socket: Relax requirement of tcp ending slash"

6 years agoMerge "afb-socket: Handle listening on all interfaces"
Jan-Simon Moeller [Fri, 2 Nov 2018 12:47:36 +0000 (12:47 +0000)]
Merge "afb-socket: Handle listening on all interfaces"

6 years agoafb-socket: Relax requirement of tcp ending slash 21/17521/1
José Bollo [Tue, 30 Oct 2018 15:25:54 +0000 (16:25 +0100)]
afb-socket: Relax requirement of tcp ending slash

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>
6 years agosamples: Fix compiling error 17/17517/1
Jose Bollo [Tue, 30 Oct 2018 09:54:02 +0000 (10:54 +0100)]
samples: Fix compiling error

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>
6 years agoafb-socket: Handle listening on all interfaces 19/17519/1
Jose Bollo [Tue, 30 Oct 2018 09:55:49 +0000 (10:55 +0100)]
afb-socket: Handle listening on all interfaces

Change-Id: I909493166f98f152e5aeb02a72f40bc3c58b42b2
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoafb-hsrv: Adapt to next version of libmicrohttpd 57/17457/1
José Bollo [Fri, 26 Oct 2018 07:16:19 +0000 (09:16 +0200)]
afb-hsrv: Adapt to next version of libmicrohttpd

Change-Id: I5bef17178e972e73b653ddbff5a8b09cfc2287eb
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoAdded an option to color out the ouput 59/17359/3
Loïc Collignon [Mon, 22 Oct 2018 14:44:03 +0000 (16:44 +0200)]
Added an option to color out the ouput

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>
6 years agoafb-session: Add language to session 51/17351/1
Jose Bollo [Mon, 22 Oct 2018 10:09:58 +0000 (12:09 +0200)]
afb-session: Add language to session

Bug-AGL: SPEC-1827

Change-Id: Icfb9e2ee76186ac677ff2fbb37be28cd83dd3b6b
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agomonitoring: Fix naming of apis 49/17349/1
Jose Bollo [Sat, 20 Oct 2018 06:56:31 +0000 (08:56 +0200)]
monitoring: Fix naming of apis

The introduction of API v3 changed the API of
monitoring/tracing. This introduced a regression
of the monitoring: it wass not more possible to
filter api by name. This fix that issue.

Bug-AGL: SPEC-1828

Change-Id: Ic7f614f6c696119c7fd313e3cd252095f578c64c
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoMerge "Make profile.d file consistent between rpm and debian"
Jan-Simon Moeller [Fri, 19 Oct 2018 07:52:38 +0000 (07:52 +0000)]
Merge "Make profile.d file consistent between rpm and debian"

6 years agoafb-apiset: Reorder priority of messages 47/17247/1
Jose Bollo [Tue, 16 Oct 2018 17:58:03 +0000 (19:58 +0200)]
afb-apiset: Reorder priority of messages

The message before starting has now a greater
priority than the one stating that start
completed. Expecting that in case of problem
it wil be cleaner.

Change-Id: I2c27eb70f218d0492291c3eab4f8396ab5a6c093
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoMake profile.d file consistent between rpm and debian 33/17233/1
Sebastien Douheret [Mon, 15 Oct 2018 15:54:40 +0000 (17:54 +0200)]
Make profile.d file consistent between rpm and debian

The file /etc/profile.d/AGL-app-framework-binder.sh must have the same
name for all distro / packages, all the more that a reference of this
file is given in the online documentation:
  http://docs.automotivelinux.org/docs/devguides/en/dev/
reference/host-configuration/docs/2_AGL_Application_Framework.html

Change-Id: If3bd2d87bdce7af2f625eeb9a7b230f11520b9e9
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
6 years agoAFB.html: Allow to call any verb of any API 97/17197/1
José Bollo [Fri, 12 Oct 2018 16:51:31 +0000 (18:51 +0200)]
AFB.html: Allow to call any verb of any API

Change-Id: I3bfff2632d5854d5885740e55f0ec38fe3214424
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoafb-hsrv: Lower the "no handler" message 95/17195/1
José Bollo [Fri, 12 Oct 2018 16:41:16 +0000 (18:41 +0200)]
afb-hsrv: Lower the "no handler" message

Bored to see WARNING: Unhandled request to favicon.ico

Change-Id: I7289b508f93bcd5ac4650ec32670ed0fd291044e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoAPIv3: Allow to write application binding 73/17173/2
José Bollo [Thu, 11 Oct 2018 15:37:02 +0000 (17:37 +0200)]
APIv3: Allow to write application binding

This enable a binding version 3 to declare
no API. This is used to start a job that will
will run after initialisation.

The tutorial tuto-app1 shows how. Run it with:

  afb-daemon --binding tuto-app1.so

A further option could be add to close stdin
even if running in foreground, as it was the
case before.

Change-Id: I2b384d125accb4642eed8e004642ba959326878f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoafb-api-so-v3: Keep root API in all cases 85/17185/1
José Bollo [Fri, 12 Oct 2018 12:29:43 +0000 (14:29 +0200)]
afb-api-so-v3: Keep root API in all cases

For bindings v3, it is possible to have no
explicit default root API.

In that case, the binder creates a fake API
that references the binding itself. That api
isn't callable be it allows to emit messages,
to catch events and to call services (other
apis).

It must be kept to ensure that there is no
further error in the hypothetical case where
it is used.

Bug-AGL: SPEC-1812

Change-Id: I1a6c1e1390411a45521b9a6c1c386dc7807191df
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agogenskel: Fix issues for C++ bindings v3 55/17155/1
José Bollo [Wed, 10 Oct 2018 16:46:23 +0000 (18:46 +0200)]
genskel: Fix issues for C++ bindings v3

The C++ compiler is too much strict. It doesn't accept
valid C because fields are in the wrong order or missing.

 - afb_verb_t generated structure invert vcbdata and session

 -  missing provide_class, require_class, require_api in the
    afb_binding_v3 generated struct

The signature of the declared function was wrong.

 -  wrong verb's callback signature void fun(afb_req) instead of
    void fun(afb_req_t)

This add the declaration of the (pre)initialization and onevent functions.

 -  missing init function signation generation, or probably preinit and
    onevent (not tested those ones)

Bug-AGL: SPEC-1806

Change-Id: I1abf8a29f831ecc80458edcd3bd094b2108dc227
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agopackaging/deb: install all headers 39/16939/1
José Bollo [Thu, 4 Oct 2018 13:44:46 +0000 (15:44 +0200)]
packaging/deb: install all headers

The previous filter wasn't installing the files
afb/afb-binding and afb/afb-binding.hpp

The packaging/rpm is modified to do the same

Change-Id: I77e31d618b9a2c6f8f8dd3f02a4219c4c8c1604f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoFix native deb pkg install dependency 33/16933/1
Ronan Le Martret [Thu, 4 Oct 2018 09:03:38 +0000 (11:03 +0200)]
Fix native deb pkg install dependency

agl-app-framework-binder-bin failed to install on Ubuntu 18.04.
(libmicrohttpd is named libmicrohttpd12)
Remove hard coded libmicrohttpd dependency solve the issue.

Change-Id: Ic1e760c422a9ea1d294d1bec614aa7b134c5b042
Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
6 years agoafb-export: Emit a warning on bad 'afb_require_api' call 53/16753/1 6.90.0 guppy/6.90.0 guppy_6.90.0
José Bollo [Tue, 18 Sep 2018 09:03:23 +0000 (11:03 +0200)]
afb-export: Emit a warning on bad 'afb_require_api' call

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>
6 years agoafb-socket: API name cares of abstract UDS 51/16751/1
Jose Bollo [Thu, 13 Sep 2018 10:18:44 +0000 (12:18 +0200)]
afb-socket: API name cares of abstract UDS

Change-Id: Ie485672d8f66ff32ea20cb0eb313690ba380db4a
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoafb-session: Fix an issue in managing sessions 29/16629/1
José Bollo [Fri, 14 Sep 2018 08:14:31 +0000 (10:14 +0200)]
afb-session: Fix an issue in managing sessions

Probably an old copy/paste error in the commit
d45426257d5149c735e33e3055220625a919e7bc

It doesn't affect version EE (Electric Eel).

Bug-AGL: SPEC-1735

Change-Id: Ia1536e141ac12275000196a3218eb62d77b36a06
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoCMakeLists: Use AGLVERSION if set 05/16605/1
José Bollo [Wed, 12 Sep 2018 12:35:03 +0000 (14:35 +0200)]
CMakeLists: Use AGLVERSION if set

And default the version to the next version of AGL
pre-guppy: 6.90.0

Change-Id: I5955add9307dd2d07a071383950839f1137e7705
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoafb-apiset: fixed the error message upon api open. 01/16501/1 5.99.6 flounder/5.99.6 flounder_5.99.6
Thierry Bultel [Fri, 7 Sep 2018 15:09:47 +0000 (17:09 +0200)]
afb-apiset: fixed the error message upon api open.

just a typo

Change-Id: I2963c2568cffdc89f577e99f2280da6dcb732b04
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
6 years agoafb-session: Use ad-hoc pseudo-random uuid 81/16481/1
Jose Bollo [Thu, 6 Sep 2018 14:01:20 +0000 (16:01 +0200)]
afb-session: Use ad-hoc pseudo-random uuid

The use of the generator given by the lib uuid
implies the use of the system call 'getrandom'
without the flag GRND_NONBLOCK. It has a weird
effect on boot because many binders require
the generation of uuid at the same time but
getrandom is subject to starving.

This introduced a tiny pseudo-random generation
of UUID that does not implies the use of 'getrandom'.

Bug-AGL: SPEC-1655

Change-Id: I5131072881d7a53f0edda9e36762985c96a04550
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoVERSION 5.99.FFRC6 75/16475/2
Jose Bollo [Thu, 6 Sep 2018 08:48:40 +0000 (10:48 +0200)]
VERSION 5.99.FFRC6

Also add newline at end of .gitreview

Change-Id: I826ecaf695a40dd883a690125fe8e2bffce1cd87
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoMerge "main-afb-daemon: Export API after initialization"
José Bollo [Thu, 6 Sep 2018 08:25:47 +0000 (08:25 +0000)]
Merge "main-afb-daemon: Export API after initialization"

6 years agomain-afb-daemon: Export API after initialization 69/16469/2
Jose Bollo [Wed, 5 Sep 2018 12:25:50 +0000 (14:25 +0200)]
main-afb-daemon: Export API after initialization

Exporting API after initialization is a simple technic
to avoid interleaving of incoming foreign calls during
initialisation.

Also a tiny fix in jobs.c and afb-socket.c.

Bug-AGL: SPEC-1724

Change-Id: I59596256481c8afcd88755ec303bf7f881b55c12
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoapp-framework-binder doc: Changed doc to fit new format. 33/16433/1 5.99.5 flounder/5.99.5 flounder_5.99.5
CorentinLGS [Fri, 31 Aug 2018 07:39:04 +0000 (09:39 +0200)]
app-framework-binder doc: Changed doc to fit new format.

-Split book.json in 2.
-Deleted unwanted files.
-Changed all links to .html files to .md files in the SUMMARY.md,
it is used by gitbook to build the pdf and as gitbook
doesn't handle .html files I had to change it.

Change-Id: I15705ef0f0d9143971c046ccb72a4eee04b98890
Signed-off-by: CorentinLGS <corentinlgs@gmail.com>
6 years agoAllow choice to trap or not program faults 89/16389/1
José Bollo [Tue, 28 Aug 2018 15:15:12 +0000 (17:15 +0200)]
Allow choice to trap or not program faults

The binder traps faults by default to recover as much as
possible from unexpected errors.

Developers may need to remove that behaviour to get core file.

This introduces 2 ways to set or remove the trapping of faults:

 - the environment variable AFB_TRAP_FAULTS

 - the command line option --trap-faults

Both take a boolean value set using on of the following words:

 1  yes  true   on    -- enable trapping of faults (the default)
 0  no   false  off   -- disable trapping of faults

Bug-AGL: SPEC-1702

Change-Id: I6c6a3b933dbda9922a6079c390a601c533d49e55
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agomain-afb-daemon: Set AFB_ROOTDIR and AFB_WORKDIR in environment 83/16383/2
Jose Bollo [Mon, 27 Aug 2018 16:25:30 +0000 (18:25 +0200)]
main-afb-daemon: Set AFB_ROOTDIR and AFB_WORKDIR in environment

It may be difficult to retrieve the root directory from bindings
and from process spawn by option --exec.

In the same way, well identifying the workdir might interest
programs or bindings.

So, from now, the environment variables below are set:

 - AFB_ROOTDIR: identify the rootdir as set by --rootdir
   and in the context of AGL it will be the widget directory

 - AFB_WORKDIR: identify the workdir as set by --workdir

To avoid any confusion, the function realpath is used to export
absolute path names.

Bug-AGL: SPEC-1694

Change-Id: Id272e009ca975e28aaab8b14fa2a98fbd2216e73
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoafb-hook-flags: Fix a compilation warning 45/16345/1
Jose Bollo [Mon, 27 Aug 2018 11:19:19 +0000 (13:19 +0200)]
afb-hook-flags: Fix a compilation warning

Change-Id: Ic9d1cc44ef1bbf6db4afe8eb7016b05f4cddb9a4
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agojobs: Abort when systemd's event loop lost 67/16267/1 5.99.4 flounder/5.99.4 flounder_5.99.4
José Bollo [Thu, 23 Aug 2018 10:23:39 +0000 (12:23 +0200)]
jobs: Abort when systemd's event loop lost

When sd_event_prepare returns an error there is currently
no way to restore the event loop working.

It happens when a callback of an sd_event is faulty
(ex: SIGSEGV). In that case the monitoring of signals
(sig-monitor) interfer badly with systemd. But at the
the application firstly has error.

To avoid flooding the journal with messages, aborting
is the best solution.

Bug-AGL: SPEC-1681

Change-Id: If01295f07b3c3fc8c8ec1ac5bf04840d42ee9774
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoafb-stub-ws: Add reconnection of ws-clients on need 65/16265/1
José Bollo [Tue, 21 Aug 2018 19:15:31 +0000 (21:15 +0200)]
afb-stub-ws: Add reconnection of ws-clients on need

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>
6 years agoafb-stub-ws: Safe handling of deconnections 55/16255/3
Jose Bollo [Mon, 20 Aug 2018 15:30:55 +0000 (17:30 +0200)]
afb-stub-ws: Safe handling of deconnections

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>
6 years agoafb-stub-ws: Process error on call to remote 53/16253/2
José Bollo [Tue, 21 Aug 2018 12:31:41 +0000 (14:31 +0200)]
afb-stub-ws: Process error on call to remote

Change-Id: I8bb96419cfac3da88e75da42c66a5d359ec7c666
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoSend error replies on disconnection 51/16251/2
Jose Bollo [Mon, 20 Aug 2018 15:45:42 +0000 (17:45 +0200)]
Send error replies on disconnection

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>
6 years agoafb-wsj1: Split 'wsj1_on_text' in 2 49/16249/2
José Bollo [Tue, 21 Aug 2018 11:37:51 +0000 (13:37 +0200)]
afb-wsj1: Split 'wsj1_on_text' in 2

This improves the code and also prepare answering
diconnected on server hangup.

Bug-AGL: SPEC-1668

Change-Id: I2cf5a75bc2db6e9a0fd0cab88c7ff3cb9fd06242
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoafb-stub-ws: Clean up 47/16247/2
Jose Bollo [Mon, 20 Aug 2018 15:35:27 +0000 (17:35 +0200)]
afb-stub-ws: Clean up

Change-Id: I6fbe737d4986fd18f9675942cd7ad75966125343
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoafb-api-ws: Use afb-socket features 43/16243/1
Jose Bollo [Mon, 20 Aug 2018 14:53:27 +0000 (16:53 +0200)]
afb-api-ws: Use afb-socket features

Use the feature of afb-socket to handle
the api name.

Bug-AGL: SPEC-1668

Change-Id: Ib13891d7948c75bc5d342b45c774f8e6c3ea016e
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoafb-socket: Improvement 41/16241/1
Jose Bollo [Mon, 20 Aug 2018 14:09:40 +0000 (16:09 +0200)]
afb-socket: Improvement

Allows to either open a 'struct fdev*' or a int.
This prepares further integration in afb-api-ws.

Bug-AGL: SPEC-1668

Change-Id: I3d61be582bceaab636460b3c7de3ac2f24ed9473
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoafb-stub-ws: Improve naming 39/16239/1
Jose Bollo [Mon, 20 Aug 2018 13:15:39 +0000 (15:15 +0200)]
afb-stub-ws: Improve naming

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>
6 years agohello3: Add mutebug 37/16237/1
Jose Bollo [Mon, 20 Aug 2018 13:06:56 +0000 (15:06 +0200)]
hello3: Add mutebug

The verb mutebug returns without answering
but increment the reference count of the request.

This has 2 weird effects:
 - on the service, it creates a memory leak
 - on the client, it creates a starve of answer

Both effects are intended to test further improvements
of the binder.

Change-Id: I76ebe0dff1b42a8a72e1b3536857d1d1811452c1
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoSet version to 5.99.FFRC4 29/16229/1
José Bollo [Wed, 22 Aug 2018 12:03:25 +0000 (14:03 +0200)]
Set version to 5.99.FFRC4

Change-Id: I8404d2cc83624eae755c39175e3096e024f30e24
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoProvide functions afb_service_call[_sync]_legacy 61/16161/1
Jose Bollo [Mon, 20 Aug 2018 12:44:31 +0000 (14:44 +0200)]
Provide functions afb_service_call[_sync]_legacy

These functions was missing and the documentation
was erronous. This fixes that issue by providing
the missing functions and updating the documentation.

Bug-AGL: SPEC-1669

Change-Id: I543b0fbe29370be6f35f15ca3bfa48fef9ab4055
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoafb-export: Provide the real path of the binding 05/16005/2 5.99.3 flounder/5.99.3 flounder_5.99.3
José Bollo [Fri, 3 Aug 2018 11:00:35 +0000 (13:00 +0200)]
afb-export: Provide the real path of the binding

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>
6 years agoFix warnings and false errors 67/15967/1
José Bollo [Thu, 2 Aug 2018 17:43:48 +0000 (19:43 +0200)]
Fix warnings and false errors

Change-Id: I434a0bd6be2758fd7964bc272d63dc280d400f47
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoafb-export: Manage path of libraries 63/15963/1
José Bollo [Thu, 2 Aug 2018 13:26:59 +0000 (15:26 +0200)]
afb-export: Manage path of libraries

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>
6 years agoAdd ability to provide binding settings 61/15961/1
José Bollo [Fri, 27 Jul 2018 15:38:22 +0000 (17:38 +0200)]
Add ability to provide binding settings

Change-Id: Iab93a26340fa9743a58ca43cd903bbf31c783e5b
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoImprove parsing of json string 59/15959/1
Jose Bollo [Wed, 1 Aug 2018 11:44:23 +0000 (13:44 +0200)]
Improve parsing of json string

Change-Id: I7100961ef8f8a75d623a0667178f191dd4cfb9d3
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoafb-socket: Separate socket creation 57/15957/1
José Bollo [Tue, 31 Jul 2018 17:02:18 +0000 (19:02 +0200)]
afb-socket: Separate socket creation

The objective is to have a well identified and
possibly reusable internally.

Change-Id: Icdb6ce7d85ae26373cfe4f0b492fe97b74ed747c
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agotic-tac-toe: improve event handling 55/15955/1
Jose Bollo [Wed, 1 Aug 2018 08:24:53 +0000 (10:24 +0200)]
tic-tac-toe: improve event handling

Change-Id: Ifba67b4b83650f9b32f78d077d0bbd3d3882238b
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoafb-msg-json: remove obsolete function 53/15953/1
Jose Bollo [Mon, 30 Jul 2018 15:43:14 +0000 (17:43 +0200)]
afb-msg-json: remove obsolete function

The function afb_msg_json_internal_error was based
on the previous reply standard and was not
used very much. Removing it seems a good idea.

Change-Id: I3dddee9c24ffd8c43c787b9b6a737ab013d757b7
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoafs-supervisor: Improve comments 51/15951/1
José Bollo [Tue, 31 Jul 2018 15:51:19 +0000 (17:51 +0200)]
afs-supervisor: Improve comments

Change-Id: Ic1954403e3924def8fc9fa395ac54e4c5ee6293a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agocoverage: Improve coverage test 13/15813/1
José Bollo [Tue, 24 Jul 2018 10:53:15 +0000 (12:53 +0200)]
coverage: Improve coverage test

The test now raise an overall coverage rate:

  lines......: 75.4% (8356 of 11080 lines)
  functions..: 80.4% (1094 of 1360 functions)

Also Improve the documentation and improve parts of code.

Change-Id: Ic2b8bc2f85d4181aa0b358a953f95cb105a0eed9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoafb-export: Set API context as validated 07/15807/1
José Bollo [Fri, 27 Jul 2018 12:40:19 +0000 (14:40 +0200)]
afb-export: Set API context as validated

An API is always valid internally to the binder.

Change-Id: I3c8eed166c9cfc1bcc47daa30c8f327af777d136
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agomain-afb-client-demo: Exit with a significant code 83/15783/2
José Bollo [Thu, 26 Jul 2018 13:55:09 +0000 (15:55 +0200)]
main-afb-client-demo: Exit with a significant code

The program afb-client-demo now exits whith one of the
following code:

 0 - everything went well, no error
 1 - last received answer was an error
 2 - the remote hung up the connection
 3 - stdin either has too long line (16384) or has error
 4 - bad argument of the command line
 5 - cant connect to remote

Bug-AGL: SPEC-1619

Change-Id: Ia979c9ddcdae496ce205882b895cd9742f93f365
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoTune dependency to fdev-epoll 53/15753/1
Jose Bollo [Wed, 25 Jul 2018 14:48:42 +0000 (16:48 +0200)]
Tune dependency to fdev-epoll

The dependency to fdev-epoll is not real
at the moment because afb-daemon still uses
systemd event loop mechanisms. At the end
use of it will depend on the conditional
compilation flag as REMOVE_SYSTEMD_EVENT here.

Change-Id: I46e65cddafef05a9418cd4cf4d5cbf596ebeda49
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agoafb-api-v3: Simplify the code 41/15741/1
Jose Bollo [Wed, 25 Jul 2018 13:05:08 +0000 (15:05 +0200)]
afb-api-v3: Simplify the code

Having a code more easy to read is better here.

Change-Id: I429e82d87729e41ec53d0852daa6f146261443c9
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
6 years agofdev: Simplify the code 39/15739/1
José Bollo [Tue, 24 Jul 2018 14:50:00 +0000 (16:50 +0200)]
fdev: Simplify the code

Less code is faster and safer.

Change-Id: Ide71fec5ee80f14482e2972a3d0f65ef0b589f12
Signed-off-by: José Bollo <jose.bollo@iot.bzh>