src/app-framework-binder.git
7 years agoRefactor stress test
José Bollo [Tue, 11 Apr 2017 13:40:44 +0000 (15:40 +0200)]
Refactor stress test

Stress test now has 2 parts: the server part and
the client part.

Change-Id: I24e46060a1a710381476157f4fb4e8ad32370a5e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoFix a crash on disconnection
José Bollo [Tue, 11 Apr 2017 12:15:55 +0000 (14:15 +0200)]
Fix a crash on disconnection

Change-Id: Ib3654ac8125b040f8264524e7c821a6559f627cd
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoFix a memory leak
José Bollo [Tue, 11 Apr 2017 12:15:38 +0000 (14:15 +0200)]
Fix a memory leak

Change-Id: Id47b417f6e5f8bf2322b1de7ed12579de711160f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agofix typo
José Bollo [Tue, 11 Apr 2017 11:16:36 +0000 (13:16 +0200)]
fix typo

Change-Id: I7a445c73a9bb6b39c3ba5e19422f5bcc319364fe
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd startup call in command line
José Bollo [Tue, 11 Apr 2017 09:47:27 +0000 (11:47 +0200)]
Add startup call in command line

The option -c (aka --call) allows to specify calls
to api/verb at startup. The calls are made sequentially.

Change-Id: I7f087dce71480fe288cca355c209a4c8ccf4f4b9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoMake implementation multithread
José Bollo [Mon, 10 Apr 2017 19:39:22 +0000 (21:39 +0200)]
Make implementation multithread

This changes makes many improvement needed
for multi-threading:
 - json object can't be shared across threads
   because get/set is not protected
 - event are now multithread compatible

Change-Id: Id44b12c68e0fa67042b8ea44939af4edfa76270a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoEnforce flush of incoming data
José Bollo [Mon, 10 Apr 2017 19:36:26 +0000 (21:36 +0200)]
Enforce flush of incoming data

Change-Id: I81deb974460e7f3edbccf132efeac87f873d78dd
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoMake HelloWord binding multi-thread
José Bollo [Mon, 10 Apr 2017 19:35:57 +0000 (21:35 +0200)]
Make HelloWord binding multi-thread

Handling of event was not compatible with
multi threaded. This implmentation solves
this by protecting event access with mutexes.

Change-Id: Ie52216289000f1ae6352c9dda442dfbda1ebe850
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoRefactor of initialisation
José Bollo [Mon, 10 Apr 2017 13:19:04 +0000 (15:19 +0200)]
Refactor of initialisation

Change-Id: Ie5209f74ea1a65571a3ec54724131f15d22ca35f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoRefactor setting of directories
José Bollo [Mon, 10 Apr 2017 13:15:21 +0000 (15:15 +0200)]
Refactor setting of directories

When not specified, the default directories are
now ".". The workdir is relative to the current directory
and other directories are relative the the workdir.

Change-Id: I52c013e3a3c93b3f984903562cf0c56d990900e6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoFix typo
José Bollo [Mon, 10 Apr 2017 11:11:04 +0000 (13:11 +0200)]
Fix typo

Change-Id: I0077f77984accdd1f07d0e7c1526720f687ec58e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoIsolate interupt management
José Bollo [Mon, 10 Apr 2017 11:10:48 +0000 (13:10 +0200)]
Isolate interupt management

Provision daemon features:
 - SIGTERM for terminating
 - SIGHUP for config reload

Change-Id: Id45a0b963812105c22ead5a0a2004f3f531a2a65
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoWebsocket client select if looping or not
José Bollo [Mon, 10 Apr 2017 10:00:14 +0000 (12:00 +0200)]
Websocket client select if looping or not

Allows the client to tell websocket module to not
loop on messages.

Change-Id: Iaa1025ce5442a5659554ba66fcc5869a1e8659b4
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoRefactor of API interfaces
José Bollo [Mon, 10 Apr 2017 09:41:21 +0000 (11:41 +0200)]
Refactor of API interfaces

The new interface has increased functionnality,
it allows to set debug flags by API.

Change-Id: Ibd35fb02ed645e22cac8e7021b37b96e07e79877
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd hooking of daemon interface
José Bollo [Fri, 7 Apr 2017 15:05:24 +0000 (17:05 +0200)]
Add hooking of daemon interface

Change-Id: I5840609f4300ade98412e8527ac5ce1f1e8c0c59
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoImprove log messages
José Bollo [Fri, 7 Apr 2017 10:52:58 +0000 (12:52 +0200)]
Improve log messages

Add ability to discuss directly with systemd journal.
Add report of functions name when logging.

Change-Id: Ia7c5836e387b621b47e3700a7abca40bc0e481c8
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoFinalize hooking of requests
José Bollo [Fri, 7 Apr 2017 08:57:55 +0000 (10:57 +0200)]
Finalize hooking of requests

Change-Id: I0c03b2c8ce556f1e6987ee5a7ad355ba9e67f142
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoReactivate hooking of requests
José Bollo [Thu, 6 Apr 2017 17:18:08 +0000 (19:18 +0200)]
Reactivate hooking of requests

Change-Id: I0fc8429063d99e10344aaadba06480a470b9eb9d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAvoid prompting error on empty line
José Bollo [Thu, 6 Apr 2017 12:52:04 +0000 (14:52 +0200)]
Avoid prompting error on empty line

Change-Id: I9da7f17f93f1948da23f6a2304f0718d7bee6464
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoImprove names
José Bollo [Thu, 6 Apr 2017 12:51:08 +0000 (14:51 +0200)]
Improve names

Change-Id: Ib7e31b50a725c73e6eaba414c6628524fbcd84f9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoMake websocket concurrent
José Bollo [Thu, 6 Apr 2017 14:24:46 +0000 (16:24 +0200)]
Make websocket concurrent

Stress tests shown that the module wsj1
wasn't ready to concurrency.

Change-Id: Ia54196f97e9712adf0920b59b188d570f39a6b4f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd a script for stressing the daemon
José Bollo [Thu, 6 Apr 2017 12:47:53 +0000 (14:47 +0200)]
Add a script for stressing the daemon

Change-Id: Ic8c5241339106376daaf91acafca1e4fb0f5f818
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd an easy function for synchronous calls
José Bollo [Thu, 6 Apr 2017 08:31:09 +0000 (10:31 +0200)]
Add an easy function for synchronous calls

The added function, 'jobs_call', allows to call
a job with 'group' sequencing and 'timeout'
handling synchronously.

The difference with 'jobs_enter' is that the
function 'jobs_call' assert that the job is
terminated when 'callback' returns.

Change-Id: I8c01d1cd017787ca0448b03a899305a9069ebb6c
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAvoid to stick on event loop
José Bollo [Thu, 6 Apr 2017 08:20:45 +0000 (10:20 +0200)]
Avoid to stick on event loop

When working synchronously, waiting continuously
to an event can make deadlocks. This commit
enforce threads that wait for some job completion
to wait for a fixed amount of time.

An alternative management with signals should
be studied in future.

Change-Id: Idcfadc60f8c14d73d7fa32e937c6ea0f552cc09b
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoReduce explicitely recursion
José Bollo [Thu, 6 Apr 2017 07:20:56 +0000 (09:20 +0200)]
Reduce explicitely recursion

When evaluating permissions, the recursive
algorithm is replaced with an algorithm
that eliminates the tail recursion.

Change-Id: I3298c42fa658498a954f4bf7dedfad87f00ab736
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoMake daemon interface common
José Bollo [Wed, 5 Apr 2017 16:08:27 +0000 (18:08 +0200)]
Make daemon interface common

For the future, having only one piece of code
to handle daemon interface to bindings is an
improvement.

Change-Id: I806c424eb1a82637d27bc84b921612789907d971
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd permission subsystem
José Bollo [Wed, 5 Apr 2017 12:47:12 +0000 (14:47 +0200)]
Add permission subsystem

Change-Id: I0bbbf55832faf6413dd6147174934d0d4dc5277d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoEnsure that subcall_sync use subcall
José Bollo [Tue, 4 Apr 2017 15:30:55 +0000 (17:30 +0200)]
Ensure that subcall_sync use subcall

The intent is to provide the asynchronous subcall
as standard. This is needed for fixing subcall
across connections (DBus or WebSocket).

Change-Id: Ia046cfa4d0124bfa3ba7eb8e8f936eeafcf09875
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAvoid to count child threads
José Bollo [Tue, 4 Apr 2017 13:04:21 +0000 (15:04 +0200)]
Avoid to count child threads

The count of allowed threads must be the real
count of threads started.

Change-Id: Iaefc9fa4368042d6db45ed3333f9591da027b2f0
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoImprove debugging options
José Bollo [Tue, 4 Apr 2017 12:54:22 +0000 (14:54 +0200)]
Improve debugging options

Change-Id: I3550a4c2500b98efa985e678217e3d91bc8ca4c6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd synchronous subcalls
José Bollo [Tue, 4 Apr 2017 12:52:40 +0000 (14:52 +0200)]
Add synchronous subcalls

Synchronous subcalls are more easy for
writing simple applications with sequential
logic.

Change-Id: I76a0231a64a6db8270014cd2a64284e1b0fc16ec
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoUse SIGHUP instead of SIGKILL
José Bollo [Tue, 4 Apr 2017 09:50:17 +0000 (11:50 +0200)]
Use SIGHUP instead of SIGKILL

This doesn't enforces anymore the brutal
termination.

Change-Id: I62445c7cb3692354637906fb1ddda1787c8fb82a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoLaunch job at a earlier step
José Bollo [Tue, 4 Apr 2017 09:49:15 +0000 (11:49 +0200)]
Launch job at a earlier step

Change-Id: I3fcb96e4d748e38eacc4d413a451143dd9b4a10d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoDefinitive switch to internal's xreq
José Bollo [Tue, 4 Apr 2017 08:10:13 +0000 (10:10 +0200)]
Definitive switch to internal's xreq

This switch allows to work on a common base for
the requests.

Change-Id: I94e7fdda80c1966af399309334c41c7c8c8259dc
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoMigrates subcalls to use xreq
José Bollo [Tue, 4 Apr 2017 07:51:28 +0000 (09:51 +0200)]
Migrates subcalls to use xreq

Change-Id: If865208bc0c207511d2b11e4cff617005ed01e56
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoIntroduce subcontext for subcalls
José Bollo [Tue, 4 Apr 2017 07:50:53 +0000 (09:50 +0200)]
Introduce subcontext for subcalls

Change-Id: I5460e9c502cee814c59a0ee60c2be001385e7b4a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoSwitch API D-Bus to xreq
José Bollo [Mon, 3 Apr 2017 15:35:32 +0000 (17:35 +0200)]
Switch API D-Bus to xreq

Change-Id: I16bfa2594f8de4babcc0d3cc1a62e7d0856d2479
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoSwitch API websocket to xreq
José Bollo [Mon, 3 Apr 2017 15:35:03 +0000 (17:35 +0200)]
Switch API websocket to xreq

Change-Id: I57600d8dc99bf37f207b126a0e3ab5731ad08ced
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoImprove interface xreq
José Bollo [Mon, 3 Apr 2017 15:34:21 +0000 (17:34 +0200)]
Improve interface xreq

Add missing function for further work

Change-Id: I4e2b7a35b45ffb0edb1fd14b52500c9b00fab807
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd notification message for added API
José Bollo [Mon, 3 Apr 2017 15:33:35 +0000 (17:33 +0200)]
Add notification message for added API

Change-Id: I797afeaa0758f2fef854a1ffaee398aff6c9041e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoRework the jobs
José Bollo [Mon, 3 Apr 2017 15:22:39 +0000 (17:22 +0200)]
Rework the jobs

Enforce starting jobs with acquiring the
calling thread.

Removes invoke methods in favour of
enter/leave synchronisation.

Change-Id: I7086f7f53b919b43ddafd2355316abc0d3516f49
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoUse xreq for services
José Bollo [Fri, 31 Mar 2017 15:50:19 +0000 (17:50 +0200)]
Use xreq for services

Change-Id: I05d0ddb36635c01b3d56ae52a08fbb68f3b3a6a9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoUse xreq for websockets
José Bollo [Fri, 31 Mar 2017 14:58:14 +0000 (16:58 +0200)]
Use xreq for websockets

Change-Id: Ia489f863e8be3384fbe8a240f6010f7d5916b72a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoFactorize common code for handling requests
José Bollo [Fri, 31 Mar 2017 14:11:07 +0000 (16:11 +0200)]
Factorize common code for handling requests

The common code for session handling is
shared using struct afb_xreq. At the moment
only hreq leverages the new feature.

The objective is double: make the work of
writing new internal requests more easy and
prepare to check permissions.

Change-Id: If3ca311d68c2d8c427d1125f31a2704b150c2c94
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAllow detection of session closure
José Bollo [Fri, 31 Mar 2017 09:55:20 +0000 (11:55 +0200)]
Allow detection of session closure

In some case it can be good to have a function called
when the session closes. This is the case when a binding
records an item in the context. With this modification
the recorded item can be simply NULL.

Change-Id: I5e23f00eb2a6e2639fdeea15f9dea79c7df9dfbb
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoStart to implement the bindings V2
José Bollo [Thu, 30 Mar 2017 17:02:06 +0000 (19:02 +0200)]
Start to implement the bindings V2

More work has to be done for merging common
code.

Change-Id: I72b01901f978854843967c12bfcb3cc59cc10310
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoOverall integration of job initialisation
José Bollo [Thu, 30 Mar 2017 12:22:03 +0000 (14:22 +0200)]
Overall integration of job initialisation

Move the job initialisation from main to jobs.

Change-Id: I8f5b54adb62e60592884ff1e3fad9811b5934d47
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoFix concurrency issues on event manager
José Bollo [Thu, 30 Mar 2017 11:33:11 +0000 (13:33 +0200)]
Fix concurrency issues on event manager

Having only one event manager is not possible
in multithreading due to the way that systemd
has to manage timer events. We observed that
timers were not armed when set in a thread
because event was polling in an other thread.

This patch provides more than one event manager
and at most as many as the number of threads
avalaible to start.

Change-Id: Iaeab353b7bc79ce61361ab73c7b197a9e69a6109
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoRefactor initialisation of the daemon
José Bollo [Thu, 30 Mar 2017 09:19:42 +0000 (11:19 +0200)]
Refactor initialisation of the daemon

This commit prepares a future job centrered
main where 'sig_monitor_init', 'jobs_init',
'jobs_add_events', 'jobs_queue0' and 'jobs_add_me'
will be merged in one single call provided as
a feature of module jobs.

Change-Id: I8ccb1bf1761c4fa1031e903bead863ff68e7df83
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoPrepare migration to binding v2
José Bollo [Wed, 29 Mar 2017 16:09:38 +0000 (18:09 +0200)]
Prepare migration to binding v2

Change-Id: I48c1fdb5199c9fb0f001576ceed3ddcb50fc9066
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agocosmetic
José Bollo [Wed, 29 Mar 2017 15:41:16 +0000 (17:41 +0200)]
cosmetic

Change-Id: I26e35f99a68557d005ee46dd4cd1c0fbd728bfd2
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoPrepare move to bindings version 2
José Bollo [Wed, 29 Mar 2017 15:39:23 +0000 (17:39 +0200)]
Prepare move to bindings version 2

Change-Id: I3105a5898d0703d1e57eff09f179b38742482842
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd comments
José Bollo [Wed, 29 Mar 2017 14:02:13 +0000 (16:02 +0200)]
Add comments

Improves the comments of the module jobs

Change-Id: Id99e9c6d6c9572d68ae9cca0f13e2498348de91d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoRefactor job to allow synchronous calls
José Bollo [Tue, 28 Mar 2017 15:46:32 +0000 (17:46 +0200)]
Refactor job to allow synchronous calls

The family of methods "jobs_invoke" make synchronous
job activation. It waits for the completion of the
job while still dispatching it internally and
providing the calling thread for processing any job
queued.

Change-Id: Id36a30789cc51245a7bbfca42f0122cf4ea623b2
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoFix bug in recycling jobs
José Bollo [Tue, 28 Mar 2017 08:18:06 +0000 (10:18 +0200)]
Fix bug in recycling jobs

The bug was creating an infinite loop starving
the system (or other possible horrific stuff).

Also updated the test.

Change-Id: Id71dd112d2ed4651ac8aa56d2c57b088d69b8655
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoMake main thread used for common jobs
José Bollo [Mon, 27 Mar 2017 20:49:44 +0000 (22:49 +0200)]
Make main thread used for common jobs

This commit make the main thread behaving
like any other threads. The main loop
is shared across threads, the first one
without job taking it. The main event loop
now have the lowest priority. It is
activated only when no job is queued.
This has the good effect to not try to
overfill the queue of jobs.

Change-Id: I07cecc9d94a02134c63bc2a814db56e171ab719e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoRemove option readyfd
José Bollo [Mon, 27 Mar 2017 13:54:44 +0000 (15:54 +0200)]
Remove option readyfd

This option is no more useful. Instead it is
possible to use systemd notify feature.

Change-Id: I8dd286242d3dc74238ca0908e83072367874d19e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoSpeed up accesses to session's cookies
José Bollo [Mon, 27 Mar 2017 12:48:53 +0000 (14:48 +0200)]
Speed up accesses to session's cookies

Minor improvement to speed up refactored contextes.

Change-Id: I45c1c4b0cecec52d10c2b7c5cd8e738fd75b25d6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoReplace session's value with sessions's cookies
José Bollo [Mon, 27 Mar 2017 12:24:46 +0000 (14:24 +0200)]
Replace session's value with sessions's cookies

This is a simplifaction with the benefits of
only allocating needed memory and avoiding to
create indexes on apis (path to dynanic?).
Conversely it replaces a direct access with
a linear search.

Change-Id: Ibb130528ad8f23dfd6b420c228f51e181efb2664
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoImplement dichotomic search of APIs
José Bollo [Mon, 27 Mar 2017 10:00:12 +0000 (12:00 +0200)]
Implement dichotomic search of APIs

This is a small improvement but it costs
so few that it is welcome.

Change-Id: I96db79b17ec811582c8e5d1d512afacece284016
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoSimplify functions for calls
José Bollo [Mon, 27 Mar 2017 09:23:51 +0000 (11:23 +0200)]
Simplify functions for calls

For historical reasons, the call to apis was
passing the length of the api and the length
of the verb. The reason was to avoid a copy
of strings. But the copy occured only for HTTP
requests. Having this implementation is of
small interest and compromise future changes.

This patch simplify things.

Change-Id: I8157724c6c721b6797cd0eab52b07e1b8d6eb5f8
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoRefactor of threading and signal monitor
José Bollo [Wed, 22 Mar 2017 15:49:53 +0000 (16:49 +0100)]
Refactor of threading and signal monitor

The goal is to allow use of this facilities for
things that are not 'afb_req'.

Change-Id: I0d99c227934ed45136477bf6235bd1541d5f05cf
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoInstanciate the environment variables
José Bollo [Tue, 21 Mar 2017 15:28:00 +0000 (16:28 +0100)]
Instanciate the environment variables

Because it could be of interest to transmit the
port and the token in environment variables,
provision is made here to instanciate environment
variables before exec.

Change-Id: I65cc8e052ca9e2831520a19d2da2a96ada7f672e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoIntegration of socket activation for services
José Bollo [Mon, 13 Mar 2017 15:18:23 +0000 (16:18 +0100)]
Integration of socket activation for services

The services provided using the option --ws-server
can now be linked to socket activation of systemd.

When afb-daemon is launched, the api to be provided
by socket activation is declared by adding the
option

   --ws-server=sd:APINAME

Where APINAME is the name of the provided api.

The binder looks to the prefix "sd:" to automatically
use the "listen fd" of name APINAME for serving
the api APINAME.

In the socket activation unit the connection
to this socket must be named using the
directive FileDescriptorName as below:

[socket]
FileDescriptorName=APINAME
...

Change-Id: I281e1a2b9fed3eac3bd0ee27b7f56df99df7bbd6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoBeginning of integration as systemd service
José Bollo [Mon, 13 Mar 2017 14:49:11 +0000 (15:49 +0100)]
Beginning of integration as systemd service

This allows to receive socket activation by names.

Change-Id: I6896dec785e8d434da452ed2d1341016f6eadb60
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agonotify systemd of being started
José Bollo [Mon, 13 Mar 2017 14:16:26 +0000 (15:16 +0100)]
notify systemd of being started

Change-Id: I10251b0800ac44e59d2a17ebd202c9f55c5c9196
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd comments about always setting INFER_EXTENSION.
Sebastien Douheret [Mon, 6 Mar 2017 09:50:17 +0000 (10:50 +0100)]
Add comments about always setting INFER_EXTENSION.

INFER_EXTENSION must always be set in order to provide right mimetypes for
some files.
For example mimetype for css files must be 'text/css' and not 'text/plain' as
returned by libmagic. If mimetype is not correct, css files of HTML5 webapps
will be not correctly interpreted resulting in a strange rendering in browser
like Chrome.

Change-Id: I7f0d9f97ede19308c87256f7850f5c51135827f3
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
7 years agofix SEGFLT when unhendled request
José Bollo [Mon, 27 Feb 2017 08:31:33 +0000 (09:31 +0100)]
fix SEGFLT when unhendled request

Change-Id: I34c657972111db843d0d9d26a1732b21ac519c57
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoEnable INFER_EXTENSION and add well-known mime types.
Sebastien Douheret [Wed, 22 Feb 2017 10:24:14 +0000 (11:24 +0100)]
Enable INFER_EXTENSION and add well-known mime types.

Change-Id: I7c433eea63c01d2b0813a9cc84c12433839bf125
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
7 years agoFix issue in initialisation of api by sessions
José Bollo [Tue, 21 Feb 2017 18:22:49 +0000 (19:22 +0100)]
Fix issue in initialisation of api by sessions

Change-Id: I72639196ce7462c34a2037cc825cf819add4a2fc
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agofix issue for C++
José Bollo [Tue, 21 Feb 2017 08:22:10 +0000 (09:22 +0100)]
fix issue for C++

Change-Id: I14b5fb9a0f517d5a784cbbc43ca1401877d0f2fe
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agofix mimetype by using libmagic
José Bollo [Tue, 21 Feb 2017 08:20:22 +0000 (09:20 +0100)]
fix mimetype by using libmagic

Change-Id: I418b7f9323d4847dfef0f1f3f6dd90f6538b2ffb
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoUpdate documentation of --roothttp option. 93/8493/1
Sebastien Douheret [Thu, 16 Feb 2017 09:34:56 +0000 (10:34 +0100)]
Update documentation of --roothttp option.

By default when roothttp option is not set, no files are served but
note that apis are still available.

Change-Id: I461b6c94d4d16cf873c0f8fb2543576595ed24c1
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
7 years agoIgnore Visual Studio Code project 91/8491/1
Sebastien Douheret [Thu, 16 Feb 2017 09:34:39 +0000 (10:34 +0100)]
Ignore Visual Studio Code project

Change-Id: Iecbef1a7887496deb849ab807ebf4de644e66343
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
7 years agoFix html heading and hyperlink order 65/8465/1
Sebastien Douheret [Wed, 15 Feb 2017 13:40:11 +0000 (14:40 +0100)]
Fix html heading and hyperlink order

Change-Id: I4f52c1c68fa357306faf6cd976a69e65de580fdb
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
7 years agoImproves documentation and directory management
José Bollo [Thu, 12 Jan 2017 16:34:02 +0000 (17:34 +0100)]
Improves documentation and directory management

Change-Id: I21c102f7439343476765c65011664feece2d2c18
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd option --random-token
José Bollo [Wed, 11 Jan 2017 17:28:23 +0000 (18:28 +0100)]
Add option --random-token

Also fix a bug in use of getopt_long.

Change-Id: Iffc90104665664c8e5a61fbee70f03f3cdb660cb
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoFirst step for grouping processes
José Bollo [Thu, 5 Jan 2017 15:02:14 +0000 (16:02 +0100)]
First step for grouping processes

Actually make afb-daemon the process group leader.

Change-Id: I01ca7bb027416e2446cfa322b69684da4db852e2
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoImproves logging
José Bollo [Thu, 5 Jan 2017 14:23:35 +0000 (15:23 +0100)]
Improves logging

Adds error message for errors related to HTTP.

Change-Id: I5a3069528f8e9a7fe9a8dae6c201a783948a565a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdds options --no-httpd and --exec
José Bollo [Wed, 4 Jan 2017 17:52:32 +0000 (18:52 +0100)]
Adds options --no-httpd and --exec

The option option --exec use the remaining arguments
of the command line (at the right of --exec) as a
command to launch with its arguments. Arguments can
use @p (for port), @t (for token) or @@ for @.

When the option --exec is given, the command is launched
as soon as afb-daemon is ready. When the command die,
afb-daemon exits and before exiting, afb-daemon kills
the launched command and its childs.

The option --no-http forbids the activation of
the HTTP server.

Change-Id: Icdd91d84c818796b5ac6ea5d33ff3549a2fe3c25
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoadds short option for verbosity
José Bollo [Wed, 4 Jan 2017 16:58:17 +0000 (17:58 +0100)]
adds short option for verbosity

Change-Id: I2282057344b2b986520f1a76f5a3c0a827d63075
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoallows to repeat option --ldpaths
José Bollo [Wed, 4 Jan 2017 15:50:13 +0000 (16:50 +0100)]
allows to repeat option --ldpaths

Change-Id: Id07b02eaef35732416de2fb1c6b24f3f75979ed6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoRefactor of file main.c
José Bollo [Wed, 4 Jan 2017 15:14:52 +0000 (16:14 +0100)]
Refactor of file main.c

File main.c is splitted in 2 files, one for scanning
arguments and the other for setting up the process.

Change-Id: I5f2d7fd354392d13cdeac6c2a8fceaaf551dea22
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoImproves naming of session's module
José Bollo [Tue, 3 Jan 2017 16:52:19 +0000 (17:52 +0100)]
Improves naming of session's module

Make names looking like other names

Change-Id: I63ce3d8a3d84193eca9d517cecb1888d630a9b2d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoRemoves uses of readdir_r
José Bollo [Tue, 3 Jan 2017 16:13:47 +0000 (17:13 +0100)]
Removes uses of readdir_r

Since glibc 2.24, readdir_r is deprecated.

Change-Id: Id0e186e67b7e60bd537a8ba85ede446be0c5095e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agocleanup: removes legacy-named file
José Bollo [Tue, 3 Jan 2017 15:21:51 +0000 (16:21 +0100)]
cleanup: removes legacy-named file

The file include/afb/afb-plugin.h was kept
for compatibility with previous versions.

Change-Id: If144803b5f56e9828ec78de5279520319bbc3342
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoCleanup of the project
José Bollo [Tue, 3 Jan 2017 10:13:47 +0000 (11:13 +0100)]
Cleanup of the project

The bindings "audio", "media" and "radio"
were in the project since its beginning
for historical reasons.

But this bindings msut not be part of the
current tree of sources.

Change-Id: I9d903f094ddc4d2457e63987df0c221d2bd7b4d1
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdds 2017 to copyrights
José Bollo [Tue, 3 Jan 2017 10:07:56 +0000 (11:07 +0100)]
Adds 2017 to copyrights

Change-Id: Id85c4eb4e36a05b61346004ba95daa19faf5074f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoUpdate gitreview file for master branch 37/7937/2
Jan-Simon Möller [Wed, 28 Dec 2016 21:28:26 +0000 (22:28 +0100)]
Update gitreview file for master branch

Change-Id: I44fea156e7dc5c5fb16ae16aad7529476b35d485
Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
7 years agomain: Removes setting roothttp to . by default
José Bollo [Wed, 14 Dec 2016 15:22:54 +0000 (16:22 +0100)]
main: Removes setting roothttp to . by default

When option --roothttp is not set, the server will
not serve HTTP files.

Change-Id: I16e09f7ad6f735967cde27d5c51758499110fb54
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoafb-hsrv: Adds an error when alias dir doesn't exist
José Bollo [Wed, 14 Dec 2016 15:20:50 +0000 (16:20 +0100)]
afb-hsrv: Adds an error when alias dir doesn't exist

Change-Id: Iab0f9b1997f6471ceab8bb43be07d6d00c53fd78
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agofix html link 51/7551/1
Ronan [Mon, 12 Dec 2016 21:16:42 +0000 (22:16 +0100)]
fix html link

Change-Id: Iafcdcc919352c567bd097ee86aadae02e38c5415
Signed-off-by: Ronan <ronan.lemartret@iot.bzh>
7 years agofix svg path for website 21/7521/1
Ronan [Fri, 9 Dec 2016 16:08:11 +0000 (17:08 +0100)]
fix svg path for website

Change-Id: I059fe29816c0cba1f423d02f5bc7034438843cac
Signed-off-by: Ronan <ronan.lemartret@iot.bzh>
7 years agoFix typo, get diagrams pictures and reordering doc 25/7325/4
Romain Forlot [Mon, 21 Nov 2016 22:25:02 +0000 (23:25 +0100)]
Fix typo, get diagrams pictures and reordering doc

Change-Id: Id8327460cf59b330283a98db8cef3a89ef505d30
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
7 years agoafb-api-so: adds verbosity on dlopen error
José Bollo [Thu, 17 Nov 2016 16:22:40 +0000 (17:22 +0100)]
afb-api-so: adds verbosity on dlopen error

Change-Id: Ibe42a346c29e71b12d67ebbf43a6fc8152df8202
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoapi-so: cleanup
José Bollo [Mon, 31 Oct 2016 10:16:05 +0000 (11:16 +0100)]
api-so: cleanup

The structure monitoring is not used anymore.

Change-Id: I3b900f7b109b2549f0b4cf17550bb71c4b49d32d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agohook: add few comments
José Bollo [Fri, 28 Oct 2016 12:42:54 +0000 (14:42 +0200)]
hook: add few comments

Change-Id: I453625b70f13a5b01a84b2ac60eb6fb9e0dd0ebd
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agohook: adding of hook feature for requests
José Bollo [Wed, 26 Oct 2016 07:23:30 +0000 (09:23 +0200)]
hook: adding of hook feature for requests

The current implementation is for hooking requests.
It allows implementation of command line option for
debugging. Further development is needed to also
handle events and service API. Also a binding for
debugging would be cool.

Change-Id: Ib1ac4711180db7b4097ed92ebbbf1a1a9fd2cc1c
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoevent: add ability to get the event name
José Bollo [Fri, 14 Oct 2016 13:13:43 +0000 (15:13 +0200)]
event: add ability to get the event name

Change-Id: Iecfeb4ab07c07715093d729710669abecee722de
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoThreads: handles request with threads
José Bollo [Wed, 3 Aug 2016 18:04:08 +0000 (20:04 +0200)]
Threads: handles request with threads

This implementation handles all requests with threads.
Later implementation could add a mechanism to choose
what request will be handled by threads.

Each API receive its requests in serial order without
reentrancy. Here again, this can change in the future
if a choice is possible to allow reentrant calls.

The signal/event are not processed using threads
in this version. It may change in the future.

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