src/app-framework-binder.git
5 years agoFix deprecation warnings for older GCC versions sandbox/johann_cahier/warnings
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: Ib4f21f9958cf64ece3480327a189afad6fdb08a3
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>
5 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>
5 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"

5 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"

5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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"

5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
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>