src/app-framework-binder.git
4 years agoFix detection of error in call synchronous 05/22005/1 flounder
Jose Bollo [Mon, 29 Jul 2019 09:48:00 +0000 (11:48 +0200)]
Fix detection of error in call synchronous

There fixes a bug with an inversion between info
and error in implementation of synchronous calls,
leading to bad detection of errors.

Bug-AGL: SPEC-2697

Change-Id: I30a8cd9c45a91b442f6c501dd3b0c32cd3ea632d
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agoafb-migration-to-binding-v3: fix broken links 58/21058/1
Clément Bénier [Tue, 16 Apr 2019 14:47:40 +0000 (16:47 +0200)]
afb-migration-to-binding-v3: fix broken links

- fix broken link to the same section

Change-Id: I5e104c5527fae29ff51b6208f43ed0eb3c5f8c04
Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
5 years agoafb-stub-ws: Fix concurrent memory issues 21/20021/1 6.0.5 flounder/6.0.5 flounder_6.0.5
José Bollo [Fri, 8 Feb 2019 12:09:39 +0000 (13:09 +0100)]
afb-stub-ws: Fix concurrent memory issues

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>
5 years agojobs: Ensure releasing event loop 71/19971/1
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 agojobs: Remove conditionnal REMOVE_SYSTEMD_EVENT 57/19857/1
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: I1ff707eee54d8aa3ae2e53cb8bbfa109e366185e
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agojobs: Separate internal threads from others 55/19855/1
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: I6d7caf30574cbca7ad56a6f4846a7d031de5cf95
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agojobs: Refactor event loop handling 53/19853/1
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: I1b40a11eee495cccfd3ed7a25ae6889042abd6bb
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-proto-ws: Serialize incoming message 51/19851/1
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: I0e673c1efe5ef2317bb28dc05891004b71f2b2ae
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agojobs: Fix a lock of call sync 49/19849/1
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: Ib4047e8c09f638655d83e7f2d0eeebe6c03cc69e
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
5 years agodocs: add yaml book 39/19539/1 6.0.4 flounder/6.0.4 flounder_6.0.4
Frederic Marec [Wed, 9 Jan 2019 14:16:44 +0000 (15:16 +0100)]
docs: add yaml book

Bug-AGL: SPEC-1988

Change-Id: I1684c187d2b64128d5e032fd377831a204fd6b24
Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
5 years agoRevert "jobs: Fix a lock of call sync" 13/19513/1
José Bollo [Sat, 5 Jan 2019 06:53:26 +0000 (06:53 +0000)]
Revert "jobs: Fix a lock of call sync"

This reverts commit 821ed8ff1beabd10cf9b9046e41fb7e954ff93c0.

Change-Id: I94c738c20a2526b7f6950a806c6ae1e65467fbf0

5 years agojobs: Fix a lock of call sync 05/19405/1
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 agoafb-trace: Make real timestamps 59/18759/1
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 agoafb-socket: Fix address reuse 63/18063/1 6.0.3 flounder/6.0.3 flounder_6.0.3
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 47/18047/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>
5 years agogenskel: Fix issues for C++ bindings v3 59/17659/1 6.0.2 flounder/6.0.2 flounder_6.0.2
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>
5 years agomonitoring: Fix naming of apis 57/17357/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>
5 years agoMake profile.d file consistent between rpm and debian 55/17355/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>
5 years agoafb-apiset: Reorder priority of messages 53/17353/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>
5 years agoafb-api-so-v3: Keep root API in all cases 87/17187/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>
5 years agoafb-session: Fix an issue in managing sessions 31/16631/1 6.0.0 6.0.1 flounder/6.0.0 flounder/6.0.1 flounder_6.0.0 flounder_6.0.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>
5 years agoVersion 6.0.0 aka "Funky Flounder" 15/16515/2 5.99.7 flounder/5.99.7 flounder_5.99.7
Jose Bollo [Mon, 10 Sep 2018 07:51:13 +0000 (09:51 +0200)]
Version 6.0.0 aka "Funky Flounder"

Change-Id: I6c7c55b1b77d70448be8df154b481757e6e063aa
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agoAdd gitreview file for flounder branch
Jan-Simon Möller [Mon, 10 Sep 2018 06:55:43 +0000 (08:55 +0200)]
Add gitreview file for flounder branch

Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
5 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>
5 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>
5 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>
5 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"

5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 years agocoverage: Add inet's API test case 37/15737/1
José Bollo [Tue, 24 Jul 2018 12:44:25 +0000 (14:44 +0200)]
coverage: Add inet's API test case

Change-Id: I2a08d70b655478252de48fa2071cd4682aa4192d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoFix some more memory leaks 35/15735/1
Jose Bollo [Wed, 25 Jul 2018 12:13:36 +0000 (14:13 +0200)]
Fix some more memory leaks

While making coverage test, few leaks appeared.
This corrects the last discorvered ones.

Change-Id: Id9e508bc9412072b628742971b02dd3d62799f3f
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agoafb-config: Rewrite the config as JSON object 33/15733/1
José Bollo [Fri, 20 Jul 2018 15:57:59 +0000 (17:57 +0200)]
afb-config: Rewrite the config as JSON object

Despite its poor performance, this changes is good
at the end because:

 - it allows to put config in files
 - it removes dirty code to translate to JSON
 - it removes dirty code to dump the config
 - it unifies code for scanning hook's flag's names
 - it improves unity of naming between option's names and JSON's names

Change-Id: I2487c8746d78a0cff80505a12b9fa60e40da9951
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoFix tiny documentation bug 31/15731/1
Jose Bollo [Wed, 25 Jul 2018 13:09:07 +0000 (15:09 +0200)]
Fix tiny documentation bug

Change-Id: Ib11160a8137480af92c450b65039b1272084f2d6
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agomain-afb-daemon: Reorder instantiation of API 63/15663/1
José Bollo [Tue, 24 Jul 2018 12:45:11 +0000 (14:45 +0200)]
main-afb-daemon: Reorder instantiation of API

The client API are now instanciated after the server API.
This allows to be client of itself but forbids to export
(serve) a client API.

Change-Id: I9b19180cfb60108344c2f846427e964df8339430
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agojson-c: Remove escaping of slashs 61/15661/1
José Bollo [Tue, 24 Jul 2018 09:47:44 +0000 (11:47 +0200)]
json-c: Remove escaping of slashs

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>
5 years agocoverage and test: Add tests 59/15659/1
Jose Bollo [Thu, 12 Jul 2018 08:59:48 +0000 (10:59 +0200)]
coverage and test: Add tests

coverage values:
  - lines:     70.5 %
  - functions: 76.3 %

Change-Id: Iaf802e84bbfa57502bbbac8c3b567b14c01608b6
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agoafb-api: Define the function afb_api_is_public 57/15657/1
José Bollo [Tue, 24 Jul 2018 08:00:17 +0000 (10:00 +0200)]
afb-api: Define the function afb_api_is_public

And remove the info line setting that the API .
is added.

Change-Id: I42e247036b9a1016797bb2674ad95f8a8c30e9be
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoTiny documentation fixes 55/15655/1
José Bollo [Tue, 24 Jul 2018 09:53:44 +0000 (11:53 +0200)]
Tiny documentation fixes

Some english improvement of the documentation.

Change-Id: I066c41d657a1921ed7dcc46dafcc7c65d122239c
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-export: Fix event handler of API 53/15653/1
José Bollo [Tue, 24 Jul 2018 13:27:13 +0000 (15:27 +0200)]
afb-export: Fix event handler of API

Change-Id: Ibadaf6f41e39cce398d33a2a2a73751d68dad34d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-config: Simplify version print 97/15497/1 5.99.2 flounder/5.99.2 flounder_5.99.2
José Bollo [Thu, 19 Jul 2018 17:19:13 +0000 (19:19 +0200)]
afb-config: Simplify version print

Change-Id: Ia9fc00fbb04a27a46dd66cb60e9b359645f9dc11
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-trace: Fix bug on uuid of session's events 93/15493/1
José Bollo [Thu, 19 Jul 2018 16:28:07 +0000 (18:28 +0200)]
afb-trace: Fix bug on uuid of session's events

Change-Id: I4e4c2f337ae61a3399c7c97cfd028411f1471f98
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-trace: Fix bug in session handling 75/15475/1
José Bollo [Thu, 19 Jul 2018 14:36:25 +0000 (16:36 +0200)]
afb-trace: Fix bug in session handling

A copy-paste error!

Change-Id: Iaf7bd9f3cbd62cddfbab04fecc685f334f983175
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoFix errors in migration to V3 65/15465/2
José Bollo [Thu, 19 Jul 2018 12:09:17 +0000 (14:09 +0200)]
Fix errors in migration to V3

Fix a tiny error in the migration script and improve it.

Fix declaration of afb_daemon_get... without args for
binding V3 compatibility.

Fix declaration of afb_api_event_handler_...

Fix the correct URL to the sed script:
 valid:   https://git.automotivelinux.org/src/app-framework-binder/plain/docs/migration-to-binding-v3.sed
 invalid: https://git.automotivelinux.org/src/app-framework-binder/tree/docs/migration-to-binding-v3.sed

Bug-AGL: SPEC-1595

Change-Id: I245b20a9c14634a94c69420312afbd97628bc750
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoSet version to 5.99.FFRC3 25/15425/1
José Bollo [Tue, 17 Jul 2018 09:27:45 +0000 (11:27 +0200)]
Set version to 5.99.FFRC3

Change-Id: Ia735f23a473849d130992c32c312213533311736
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-binding: Add missing declarations 95/15395/3
José Bollo [Fri, 13 Jul 2018 17:13:52 +0000 (19:13 +0200)]
afb-binding: Add missing declarations

The functions afb_api_set_verbs_v3 and afb_api_delete_api
were missing.

Change-Id: Icab928984dd6620b8b3920d0406aeb3cb35c9428
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoSimplify starting of services 87/15387/2
José Bollo [Fri, 13 Jul 2018 14:38:55 +0000 (16:38 +0200)]
Simplify starting of services

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>
5 years agoafb-trace: Fix compiling error on old json-c 85/15385/1
José Bollo [Fri, 13 Jul 2018 13:46:01 +0000 (15:46 +0200)]
afb-trace: Fix compiling error on old json-c

Versions of json-c older than 0.12 doesn't have
the function json_object_new_double_s.

Change-Id: If34c36ddcfabb3796aeb6739cd150e2b3e763679
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-hook & afb-trace: Fix usage of readlink 75/15375/2
José Bollo [Fri, 13 Jul 2018 12:33:56 +0000 (14:33 +0200)]
afb-hook & afb-trace: Fix usage of readlink

The function readlink doesn't add a terminating null.
This patch fixes that were needed.

Change-Id: Ie15309471fe8203c8e98b97315c4ea30de3ccd75
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-binding: Fix export of "class" handling 73/15373/2
José Bollo [Fri, 13 Jul 2018 12:30:55 +0000 (14:30 +0200)]
afb-binding: Fix export of "class" handling

The functions afb_api_require_class and afb_api_provide_class
weren't exported. This commit fix that oversight.

Change-Id: Ica6532bd9e06aa9003a24ae7a54b05c64be7093b
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-wsj1: Fix json parsing of unterminated 67/15367/2
José Bollo [Fri, 13 Jul 2018 09:13:29 +0000 (11:13 +0200)]
afb-wsj1: Fix json parsing of unterminated

When receiving 'false', 'true' or 1, the tokener isn't able
to terminate its job without ambiguity. Catch this case
to force a terminating character.

Change-Id: I5c78f759852060ccf0fac87b3f6fc33a65bf30c9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-api-v3: Fix wrong error message 55/15355/3
José Bollo [Thu, 12 Jul 2018 17:34:51 +0000 (19:34 +0200)]
afb-api-v3: Fix wrong error message

Change-Id: Idc2d85ccf71fb7c88a3bbcf981c316b5ba70f434
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-apiset: Try to initialize all APIs 53/15353/3
José Bollo [Thu, 12 Jul 2018 15:22:37 +0000 (17:22 +0200)]
afb-apiset: Try to initialize all APIs

Don't stop on the first error when initializing apis.
Record the error and return it at the end.

Change-Id: I1f0f50ff4e527ca5bf0e78904fccddafe54ba5f2
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-export: Monitor calls to API initialisation 51/15351/2
José Bollo [Thu, 12 Jul 2018 15:17:16 +0000 (17:17 +0200)]
afb-export: Monitor calls to API initialisation

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>
5 years agoafb-api-so-v2: Monitor the preinit to catch SEGV 49/15349/2
José Bollo [Thu, 12 Jul 2018 15:15:56 +0000 (17:15 +0200)]
afb-api-so-v2: Monitor the preinit to catch SEGV

Add monitoring of preinitialisation of bindings v2
in the hope to better handle arbitrary code execution.

Change-Id: I86354caedb17ef9d4904c1f4f47b1ea3c6dd4c40
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agomain-afb-daemon: Kill child instead of it 47/15347/2
José Bollo [Thu, 12 Jul 2018 15:14:00 +0000 (17:14 +0200)]
main-afb-daemon: Kill child instead of it

Killing afb-daemon when exit is called has bad side effects.
Because there is no need to do it now, remove it.

Change-Id: I18903bb168b1722a522cb4a78c5c8c2508483996
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-config: Fix wrong error message and more info 45/15345/2
José Bollo [Thu, 12 Jul 2018 12:21:50 +0000 (14:21 +0200)]
afb-config: Fix wrong error message and more info

The wrong value of the log option wasn't displayed.

The output of --version now prints more compile options.

Change-Id: I09b8b66279a10cd4b2b6d460b3dbaeb370b3dadd
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-supervision: Remove dependency to external 43/15343/2
José Bollo [Thu, 12 Jul 2018 09:22:14 +0000 (11:22 +0200)]
afb-supervision: Remove dependency to external

Also some cleaning in use of extern to allow
accurate grep.

Removing extern is better for linking and for
structuration.

Change-Id: I8121c4b9b34fa2737bffd2ecbe170d04d1d60ad1
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoPackaging: Fix RPM build 27/15327/3
Romain Forlot [Thu, 12 Jul 2018 08:19:58 +0000 (10:19 +0200)]
Packaging: Fix RPM build

RPM build failed because there is an unpackaged files
found which has been installed. This fix the build error:

Installed (but unpackaged) file(s) found:
 /opt/AGL/lib64/afb/hello2.so

Change-Id: Id5775966bbc4cac00d6adc8b9032d32cf41a7207
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
5 years agomain-afb-daemon: Remove call to "nice" 45/15145/1
José Bollo [Mon, 9 Jul 2018 16:30:53 +0000 (18:30 +0200)]
main-afb-daemon: Remove call to "nice"

Instead of setting the priority in the binder, delegate
that responsibility of setting the priority of the process
to the launcher.

Bug-AGL: SPEC-1578

Change-Id: Ia6bdbdda72ce76fabc19c6448deeb62e2861dce0
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agodocs: Fix internal links by referencing html files 25/15125/2
José Bollo [Mon, 9 Jul 2018 08:50:05 +0000 (10:50 +0200)]
docs: Fix internal links by referencing html files

What to reference? Markdown files or HTML files?
I dont like this solution but it is the least effort.

Bug-AGL: SPEC-1544

Change-Id: I0d2e2c7fe1cfe769149bee3af611b04d2fe1aead
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agocoverage: Improve testing 11/15111/2
Jose Bollo [Fri, 6 Jul 2018 15:07:19 +0000 (17:07 +0200)]
coverage: Improve testing

- Add test of bindings v2
- Distinguish between clean and cleanall
- More valgrind ouput

Change-Id: If929756d9d35ddb959b46f7330cbf318301d532e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agohello2: Add a binding v2 example 09/15109/2
José Bollo [Sun, 8 Jul 2018 17:00:51 +0000 (19:00 +0200)]
hello2: Add a binding v2 example

Needed for test of bindings v2.

Change-Id: I33f8b497428bf03f8f80ad26bcdec773d269f41d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agohello3: Fix a bug 07/15107/2
José Bollo [Sun, 8 Jul 2018 16:58:00 +0000 (18:58 +0200)]
hello3: Fix a bug

The request was released without any need.
It came from migration from v2 to v3.

Change-Id: If2558ca247f0db912ce5705fa1fd98f3771dcb1f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoafb-api-v3: Fix a bug introduced by 8ca7b69 01/15101/2
Jose Bollo [Fri, 6 Jul 2018 14:11:25 +0000 (16:11 +0200)]
afb-api-v3: Fix a bug introduced by 8ca7b69

This bug returned a wrong OpenAPI description
and produced a memory leaak.

It it could be good to rewrite this part using
wrap_json_pack.

Change-Id: Ie0cf03e4434f8674273e9fac3c49a0f9c8196eac
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agoafb-cred: Fix memory leak 99/15099/2
Jose Bollo [Fri, 6 Jul 2018 13:07:08 +0000 (15:07 +0200)]
afb-cred: Fix memory leak

Change-Id: I1badca46d9e829c9b9443fce0a1e7d6a5ffad595
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agocoverage: Add valgrind diagnostics 97/15097/2
Jose Bollo [Fri, 6 Jul 2018 13:05:22 +0000 (15:05 +0200)]
coverage: Add valgrind diagnostics

Change-Id: I047f6a1946ba523776abf9f252a3938e945c8028
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
5 years agoUpdate version to 5.99.FFRC2 47/15047/2
José Bollo [Thu, 5 Jul 2018 17:15:47 +0000 (19:15 +0200)]
Update version to 5.99.FFRC2

Change-Id: I42bdaff39ac5f91c21bee4e4f9ff089ee3040a5b
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
5 years agoSimplify build by introducing queuing function 45/15045/2
José Bollo [Thu, 5 Jul 2018 17:12:50 +0000 (19:12 +0200)]
Simplify build by introducing queuing function

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>
5 years agoRemove uses of deprecated macros 43/15043/1
José Bollo [Thu, 5 Jul 2018 15:34:11 +0000 (17:34 +0200)]
Remove uses of deprecated macros

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