src/app-framework-binder.git
6 years agoFix cmake dependency 25/9425/1 3.99.1 dab/3.99.1 dab_3.99.1
Ronan Le Martret [Fri, 19 May 2017 14:58:14 +0000 (16:58 +0200)]
Fix cmake dependency

 * update documentation (get libmicrohttpd>=0.9.54 from upstream).

Change-Id: I361708fecd3b670dba0f32230fa3bcbd86fa9c55
Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
6 years agoFix a bug in subscribers counting
José Bollo [Thu, 18 May 2017 14:57:12 +0000 (16:57 +0200)]
Fix a bug in subscribers counting

To avoid as much as possible allocation/deallocation
when possible sequences of subscribe/unsubscribe are
encountered, the watch strucutre of events is destroyed
only when either the event or the client is destroyed.

This commit fixes a bad handling in the count of
active subscribers.

Change-Id: I3f240e69c3b21356ff07f584fe9bfb578d46732b
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoFix the timer signal number
José Bollo [Mon, 15 May 2017 09:50:44 +0000 (11:50 +0200)]
Fix the timer signal number

Change-Id: I2dc7520f41472afefc31be7d3ac1a205611c1828
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agofree SIGALRM for boost timers
José Bollo [Fri, 12 May 2017 15:49:19 +0000 (17:49 +0200)]
free SIGALRM for boost timers

Change-Id: Ib6825c21b6589db6c7e9b8c5a179c347bcc0a93d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agogenerate skeleton from OpenAPI 3
José Bollo [Wed, 10 May 2017 17:33:14 +0000 (19:33 +0200)]
generate skeleton from OpenAPI 3

Change-Id: Ia2c9d42a12e9b425d34a3a70ae255d82a9320e8c
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoimprove log
José Bollo [Wed, 10 May 2017 17:32:55 +0000 (19:32 +0200)]
improve log

Change-Id: I218356c3122179887e8be885affb82cdc6403dbf
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoCompiles for cynara if present
José Bollo [Wed, 10 May 2017 17:32:18 +0000 (19:32 +0200)]
Compiles for cynara if present

Change-Id: If8ef53f8a0a57bf6d19b0da3d13a7794a8d0eef9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoimplement authorisation check
José Bollo [Fri, 5 May 2017 17:22:55 +0000 (19:22 +0200)]
implement authorisation check

Change-Id: I2ef74b715a115acd11fa13744ba921e875f0bc65
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agorefactor hsrv using jobs queue
José Bollo [Fri, 5 May 2017 17:11:40 +0000 (19:11 +0200)]
refactor hsrv using jobs queue

Change-Id: I3d0c70efc2053340fcec93695006e01bb6b49e2c
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoremove afb-perm compiler
José Bollo [Fri, 5 May 2017 17:09:26 +0000 (19:09 +0200)]
remove afb-perm compiler

Change-Id: Ib35f33440ae7fafe72870ad437d39508aec7894e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoAdd default cred to HTTP link
José Bollo [Fri, 5 May 2017 17:04:43 +0000 (19:04 +0200)]
Add default cred to HTTP link

Change-Id: Ibb73cebc99094b33b61820482327296049c2026a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoAdd user to context
José Bollo [Fri, 5 May 2017 16:59:57 +0000 (18:59 +0200)]
Add user to context

At this time, user is the string representation
of the uid.

Change-Id: I65fbb4112f209fdb948d24e9c47fa73dacdf571f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoExpose session UUID from context
José Bollo [Fri, 5 May 2017 16:57:04 +0000 (18:57 +0200)]
Expose session UUID from context

Change-Id: Ifcf08e840b4ac92889874700c630495b6dfc3e66
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoImprove includes
José Bollo [Fri, 5 May 2017 10:59:09 +0000 (12:59 +0200)]
Improve includes

Change-Id: I87278ce38270782e74bd29a7920fe6a6e63eea0d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agomake function afb_context_set return a status
José Bollo [Fri, 5 May 2017 10:26:13 +0000 (12:26 +0200)]
make function afb_context_set return a status

Change-Id: I5172c58288e5974001f3478f7cee94d7a98abe7d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agoChange the effect of close session
José Bollo [Fri, 5 May 2017 10:18:59 +0000 (12:18 +0200)]
Change the effect of close session

Using the flag AFB_SESSION_CLOSE now has effect only
on the requesting binding.

Before, all the session was closed. This could lead
to unexpected conflicts.

Change-Id: Ic945e8d164a8558eae05d169b0c5f372b036cf36
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
6 years agosession: start to manage concurrency
José Bollo [Fri, 5 May 2017 10:04:25 +0000 (12:04 +0200)]
session: start to manage concurrency

Change-Id: I5895fa14fcb496e71fba600994e7e454cf1d110b
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoMake LOA local to the binding
José Bollo [Thu, 4 May 2017 16:01:29 +0000 (18:01 +0200)]
Make LOA local to the binding

Change-Id: If0494a19a4ce2865af699491c1f6d7b73bce8f11
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agofix a warning
José Bollo [Thu, 4 May 2017 15:07:39 +0000 (17:07 +0200)]
fix a warning

Change-Id: Iaebb861a56a490decdca0eada52e26b902457d1d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoadd function to get the current LOA
José Bollo [Thu, 4 May 2017 15:04:39 +0000 (17:04 +0200)]
add function to get the current LOA

Change-Id: I0f2a0eae8b4de982549fa4a87e2e0f8150c7d6cc
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoPrepare permission for binding version 2
José Bollo [Thu, 4 May 2017 14:45:54 +0000 (16:45 +0200)]
Prepare permission for binding version 2

Change-Id: I38c1291b3c11a9b436d00ef6dab4f7efb86e4996
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoPrepare bindings version 2
José Bollo [Thu, 4 May 2017 14:21:18 +0000 (16:21 +0200)]
Prepare bindings version 2

Change-Id: Ic9e417d9a36f5da08883c3ded127d8350ff893cc
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoPrepare xreq to be aware of the version
José Bollo [Thu, 4 May 2017 11:06:02 +0000 (13:06 +0200)]
Prepare xreq to be aware of the version

Change-Id: If8a1ac53e58ff644d7903aebd263d7d42308c756
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoEliminate use of AFB_SESSION_CREATE
José Bollo [Thu, 4 May 2017 09:55:35 +0000 (11:55 +0200)]
Eliminate use of AFB_SESSION_CREATE

AFB_SESSION_CREATE is obsolete since a while.

Change-Id: I3dc3eb374f0842d7b210a106b72bce2e4c5c1512
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agofix a warning
José Bollo [Wed, 26 Apr 2017 17:22:28 +0000 (19:22 +0200)]
fix a warning

Change-Id: I9aa2d121771a4a1cca2c4733b3f78ee72db70840
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agocleanup
José Bollo [Wed, 26 Apr 2017 16:17:15 +0000 (18:17 +0200)]
cleanup

Change-Id: I6296e8d0897e3a1619d1ad832a27dcb9828eae99
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoPrint credential in default request hook
José Bollo [Wed, 26 Apr 2017 15:51:47 +0000 (17:51 +0200)]
Print credential in default request hook

Change-Id: I67af78d8838de4c5386fd62c8f3b26d1ad8fb338
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoUse upgrade abitlity of libmicrohttpd
José Bollo [Thu, 13 Apr 2017 21:24:13 +0000 (23:24 +0200)]
Use upgrade abitlity of libmicrohttpd

Since version 0.9.52, libmicrohttpd correctly handles
upgrading of connections. Leveraging that feature
is a best.

Change-Id: Icde686cd9a3c12dda5ee74f354086ccff435796c
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoSort verbs and compute their permissions
José Bollo [Wed, 26 Apr 2017 11:35:17 +0000 (13:35 +0200)]
Sort verbs and compute their permissions

For the version 2, the verbs are alphabetically sorted
and the permissions are computed for further evaluation.

Change-Id: I10b50f841c920e9912bf734238f35e52aecedcc1
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd 'afb_daemon_queue_job' for bindings
José Bollo [Tue, 25 Apr 2017 15:21:28 +0000 (17:21 +0200)]
Add 'afb_daemon_queue_job' for bindings

This allow bindings to queue asynchronous jobs.

Change-Id: I2a228388c9defde23adb672d579c4a299f212850
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agotypo
José Bollo [Tue, 25 Apr 2017 14:46:43 +0000 (16:46 +0200)]
typo

Change-Id: Ie270c9716477054d0d16fd3b8d8bbfee1f8de084
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoMake monitor use the interface version 2
José Bollo [Tue, 25 Apr 2017 14:06:31 +0000 (16:06 +0200)]
Make monitor use the interface version 2

Enforce monitor API to be a kind of standard binding.

Change-Id: I4739f879d5e076eb3505f5fe2cf658e6f9299de6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoUpdate the monitor interface for private feature
José Bollo [Tue, 25 Apr 2017 14:04:12 +0000 (16:04 +0200)]
Update the monitor interface for private feature

Change-Id: I14caa33d2abad26bf244e93f7efe93206c6c50da
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd private binding interface feature
José Bollo [Tue, 25 Apr 2017 14:03:11 +0000 (16:03 +0200)]
Add private binding interface feature

Also make correct strings

Change-Id: Iac63fb8202c115458910ca1ec42fbca9872df9f8
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agogenskel: add tiny skeleton generator
José Bollo [Tue, 25 Apr 2017 12:30:24 +0000 (14:30 +0200)]
genskel: add tiny skeleton generator

This adds a tiny generator of skeleton for bindings
version 2. This is a research work.

Change-Id: Id72f6addfd18ebb866e3b609bb49e74ee676b83d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agocleanup
José Bollo [Tue, 25 Apr 2017 12:29:42 +0000 (14:29 +0200)]
cleanup

Change-Id: Ia49afc6c7d70da676ac9ea6b493a23fc3756a482
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agotypo
José Bollo [Tue, 25 Apr 2017 12:29:17 +0000 (14:29 +0200)]
typo

Change-Id: Ia6c5deab1ed154ae7ad690236b8739ddff6e3935
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoafb-monitor: draft of monitoring
José Bollo [Fri, 21 Apr 2017 17:04:54 +0000 (19:04 +0200)]
afb-monitor: draft of monitoring

this is a draft version to be continued.

Change-Id: I1062a6f872a2b36d4e0434fb18d1857961d50aab
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoafb-api: add a 'describe' function
José Bollo [Fri, 21 Apr 2017 17:02:41 +0000 (19:02 +0200)]
afb-api: add a 'describe' function

this is intended for introspection

Change-Id: I2518893c8cb04295159c3646f1286ffd30f739e0
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoafb-api-so-v2: split the declaration in two parts
José Bollo [Fri, 21 Apr 2017 17:01:31 +0000 (19:01 +0200)]
afb-api-so-v2: split the declaration in two parts

Having a part not linked to an existing opened shared library
might be useful for internal APIS.

Change-Id: I56348f07c87f6844682e3ea56dc07d7ee296bfbf
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agomain: init session module first
José Bollo [Fri, 21 Apr 2017 17:00:02 +0000 (19:00 +0200)]
main: init session module first

Change-Id: If2acee2fa6469cbfb6c2d11eb1e3fd622b093155
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoapiset: improvements
José Bollo [Fri, 21 Apr 2017 16:59:02 +0000 (18:59 +0200)]
apiset: improvements

Change-Id: I476ab17bb5c48dbb3cd6c215687989203407549f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agostress-server: fix rootdir
José Bollo [Fri, 21 Apr 2017 09:24:46 +0000 (11:24 +0200)]
stress-server: fix rootdir

Change-Id: Ic19ffd24be4bba54274150e1b71324e9017b402f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoafb-client-demo: Handle comments
José Bollo [Fri, 21 Apr 2017 09:23:52 +0000 (11:23 +0200)]
afb-client-demo: Handle comments

Change-Id: I39287c5b5bba8b3ec18dc36e58a0d0102c5b48d6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agofix bug on incoming event
José Bollo [Fri, 21 Apr 2017 09:19:50 +0000 (11:19 +0200)]
fix bug on incoming event

Change-Id: I7678412374565fd5802b0312e5808e2645df3728
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agocleanup and improvement of xreq
José Bollo [Thu, 20 Apr 2017 10:52:23 +0000 (12:52 +0200)]
cleanup and improvement of xreq

Change-Id: Iefda7f9d8f979a50fb2586a27edf0ca16d056a1f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd default api to apiset
José Bollo [Thu, 20 Apr 2017 08:02:49 +0000 (10:02 +0200)]
Add default api to apiset

Also improve interface of apiset.

Change-Id: I3c256ce1ecb089f0b518e45f0dee139c04943f2e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoUse of 'afb_api_is_valid_name'
José Bollo [Thu, 20 Apr 2017 07:35:23 +0000 (09:35 +0200)]
Use of 'afb_api_is_valid_name'

Use the common function 'afb_api_is_valid_name'
instead of 'afb_apiset_valid_name'.

Change-Id: I2d761473d4aa1cd90adf1b7a2c1976e727b437fc
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agosimplify main file
José Bollo [Wed, 19 Apr 2017 13:15:29 +0000 (15:15 +0200)]
simplify main file

Change-Id: I590bf289ce597531622dc95bb00df11e0a8bdbb6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoCreate afb-stub-ws by spliting afb-api-ws
José Bollo [Fri, 14 Apr 2017 17:47:57 +0000 (19:47 +0200)]
Create afb-stub-ws by spliting afb-api-ws

The file afb-stub-ws only carries the protocol
of the internal remote calling conventions.

It as the following benefits:
 - it easies transition to symetric connection (not planned)
 - it allows to have server stub on client socket and
   conversely, client stub on server socket (planned for
   debugging).

Change-Id: I57dc8e78d7bd63427421a180abcb844f8313d37b
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoallow abstract unix sockets
José Bollo [Fri, 14 Apr 2017 13:36:53 +0000 (15:36 +0200)]
allow abstract unix sockets

unix sockets named "unix:@something" are now treated
as abstract sockets.

Change-Id: Ieb2bb9dd1c7b420b9e3fae81590ef49c32f63802
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agouse heuristic message ids
José Bollo [Fri, 14 Apr 2017 13:35:43 +0000 (15:35 +0200)]
use heuristic message ids

Change-Id: I9492288de61b79074db38818c459f7447b12b4e6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoimprove stress test outputs
José Bollo [Fri, 14 Apr 2017 12:19:32 +0000 (14:19 +0200)]
improve stress test outputs

Change-Id: I86b62cfa2b6da6963d1014ae4362ea5f7338c736
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoIntroduce apiset for grouping apis
José Bollo [Thu, 13 Apr 2017 20:58:33 +0000 (22:58 +0200)]
Introduce apiset for grouping apis

This will be used at the end for debugging
facilities.

Change-Id: I75e3345667e1f58143c77a885e166375680ca194
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoImplement subcall for services over websockets
José Bollo [Thu, 13 Apr 2017 14:05:30 +0000 (16:05 +0200)]
Implement subcall for services over websockets

This modification make subcalls pushed back to
the client that will issue it for itself. This
will at the end ensure the security context of
the client.

Change-Id: Ib4bb5125ffe1b942103b72d1a3d13892dda87baa
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agosecure subcall api and verb
José Bollo [Thu, 13 Apr 2017 12:50:36 +0000 (14:50 +0200)]
secure subcall api and verb

Change-Id: Ia1df54bfd139f247137f4373a2cbd75dcf74efc8
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoenforce reset of xreq at init
José Bollo [Thu, 13 Apr 2017 12:49:51 +0000 (14:49 +0200)]
enforce reset of xreq at init

Change-Id: I37ff13a34c780ab00fb43e0a4daeda45db821c00
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoEnhance client->server protocol
José Bollo [Thu, 13 Apr 2017 08:50:15 +0000 (10:50 +0200)]
Enhance client->server protocol

This commit adds a protocol header for inter binder
communication in the direction client->server.
It also changes how data buffer is handled.

Change-Id: I1eb4253408ddd4c8042773da541d27046e90f715
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoSimplification of sig-monitor
José Bollo [Thu, 13 Apr 2017 08:25:16 +0000 (10:25 +0200)]
Simplification of sig-monitor

Remove unused functions

Change-Id: Ie767469a3e721aba5d9d27ab318a1d316553b2cb
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoUse names for constants
José Bollo [Thu, 13 Apr 2017 07:54:04 +0000 (09:54 +0200)]
Use names for constants

quality improvement

Change-Id: I1d8fda1ec48bb9d3c6eb2ee88b579cfcf8dcc5fb
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoSimplification and optimisation of jobs
José Bollo [Thu, 13 Apr 2017 07:43:18 +0000 (09:43 +0200)]
Simplification and optimisation of jobs

It comes from the use of this module that it can
be simplified to only get 1 argument. It reduces
either the complexity of the code and the time spent
in job management.

It optimise how normal jobs are called (not intermediate
function).

Also factorisation and simplification of synchronous
enter/call.

Change-Id: Id60dd2363fee2b007b4557430659faf733d2179d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoreduce verbosity
José Bollo [Wed, 12 Apr 2017 15:58:38 +0000 (17:58 +0200)]
reduce verbosity

Change-Id: I625dd517912461bb55f298a11a5eb37adc92293b
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd credential data to xreq
José Bollo [Wed, 12 Apr 2017 15:56:20 +0000 (17:56 +0200)]
Add credential data to xreq

This will allow soon to check the credentials when
evaluating calls.

Change-Id: I993216ccbc02538dcd92e49fcb2de0541eeb8c01
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoadd argument to stress-server.sh
José Bollo [Wed, 12 Apr 2017 15:56:10 +0000 (17:56 +0200)]
add argument to stress-server.sh

Change-Id: I75fccf6c9b5c37c7548019e510f7c3281a5cd664
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agofix typo
José Bollo [Wed, 12 Apr 2017 15:12:44 +0000 (17:12 +0200)]
fix typo

Change-Id: I83473a69d8af4d39d1ef7eba9c324a6bbb0364fc
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoOptimisation of xreq
José Bollo [Wed, 12 Apr 2017 15:00:33 +0000 (17:00 +0200)]
Optimisation of xreq

Reduce the count of memory read

Change-Id: Ie4dfa4bd30d6485be91961196294c43ffbd3b2a9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoAdd computation of credentials
José Bollo [Wed, 12 Apr 2017 12:11:16 +0000 (14:11 +0200)]
Add computation of credentials

Credentials are computed if possible.

Change-Id: I36c7e95a35431b27109c26b51eab690d685862e1
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoRename destination as origin
José Bollo [Wed, 12 Apr 2017 12:09:12 +0000 (14:09 +0200)]
Rename destination as origin

Change-Id: I9c76ab3043506778640cb379e8f006674f8a8fcf
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
7 years agoFix uninitialized variable
José Bollo [Tue, 11 Apr 2017 16:37:52 +0000 (18:37 +0200)]
Fix uninitialized variable

Change-Id: Ia8a7a1471f004933a48797b91c01fd8b53465de0
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
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>