summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2017-04-14Create afb-stub-ws by spliting afb-api-wsJosé Bollo4-1184/+1259
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>
2017-04-14allow abstract unix socketsJosé Bollo1-1/+3
unix sockets named "unix:@something" are now treated as abstract sockets. Change-Id: Ieb2bb9dd1c7b420b9e3fae81590ef49c32f63802 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-14use heuristic message idsJosé Bollo1-3/+16
Change-Id: I9492288de61b79074db38818c459f7447b12b4e6 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-13Introduce apiset for grouping apisJosé Bollo30-316/+613
This will be used at the end for debugging facilities. Change-Id: I75e3345667e1f58143c77a885e166375680ca194 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-13Implement subcall for services over websocketsJosé Bollo1-56/+258
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>
2017-04-13secure subcall api and verbJosé Bollo1-4/+11
Change-Id: Ia1df54bfd139f247137f4373a2cbd75dcf74efc8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-13enforce reset of xreq at initJosé Bollo1-0/+1
Change-Id: I37ff13a34c780ab00fb43e0a4daeda45db821c00 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-13Enhance client->server protocolJosé Bollo1-8/+16
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>
2017-04-13Simplification of sig-monitorJosé Bollo2-14/+2
Remove unused functions Change-Id: Ie767469a3e721aba5d9d27ab318a1d316553b2cb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-13Use names for constantsJosé Bollo1-17/+24
quality improvement Change-Id: I1d8fda1ec48bb9d3c6eb2ee88b579cfcf8dcc5fb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-13Simplification and optimisation of jobsJosé Bollo2-168/+80
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>
2017-04-12reduce verbosityJosé Bollo1-3/+0
Change-Id: I625dd517912461bb55f298a11a5eb37adc92293b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-12Add credential data to xreqJosé Bollo6-0/+15
This will allow soon to check the credentials when evaluating calls. Change-Id: I993216ccbc02538dcd92e49fcb2de0541eeb8c01 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-12fix typoJosé Bollo1-2/+2
Change-Id: I83473a69d8af4d39d1ef7eba9c324a6bbb0364fc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-12Optimisation of xreqJosé Bollo9-137/+118
Reduce the count of memory read Change-Id: Ie4dfa4bd30d6485be91961196294c43ffbd3b2a9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-12Add computation of credentialsJosé Bollo6-0/+218
Credentials are computed if possible. Change-Id: I36c7e95a35431b27109c26b51eab690d685862e1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-12Rename destination as originJosé Bollo1-51/+51
Change-Id: I9c76ab3043506778640cb379e8f006674f8a8fcf Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-11Fix uninitialized variableJosé Bollo1-0/+1
Change-Id: Ia8a7a1471f004933a48797b91c01fd8b53465de0 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-11Fix a crash on disconnectionJosé Bollo1-1/+2
Change-Id: Ib3654ac8125b040f8264524e7c821a6559f627cd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-11fix typoJosé Bollo1-1/+1
Change-Id: I7a445c73a9bb6b39c3ba5e19422f5bcc319364fe Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-11Add startup call in command lineJosé Bollo3-1/+110
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>
2017-04-10Make implementation multithreadJosé Bollo4-44/+98
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>
2017-04-10Enforce flush of incoming dataJosé Bollo1-0/+4
Change-Id: I81deb974460e7f3edbccf132efeac87f873d78dd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-10Refactor of initialisationJosé Bollo1-8/+9
Change-Id: Ie5209f74ea1a65571a3ec54724131f15d22ca35f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-10Refactor setting of directoriesJosé Bollo2-9/+8
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>
2017-04-10Fix typoJosé Bollo1-1/+1
Change-Id: I0077f77984accdd1f07d0e7c1526720f687ec58e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-10Isolate interupt managementJosé Bollo1-7/+44
Provision daemon features: - SIGTERM for terminating - SIGHUP for config reload Change-Id: Id45a0b963812105c22ead5a0a2004f3f531a2a65 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-10Websocket client select if looping or notJosé Bollo3-3/+13
Allows the client to tell websocket module to not loop on messages. Change-Id: Iaa1025ce5442a5659554ba66fcc5869a1e8659b4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-10Refactor of API interfacesJosé Bollo6-24/+154
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>
2017-04-07Add hooking of daemon interfaceJosé Bollo13-59/+542
Change-Id: I5840609f4300ade98412e8527ac5ce1f1e8c0c59 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-07Improve log messagesJosé Bollo3-33/+61
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>
2017-04-07Finalize hooking of requestsJosé Bollo5-61/+131
Change-Id: I0c03b2c8ce556f1e6987ee5a7ad355ba9e67f142 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-06Reactivate hooking of requestsJosé Bollo6-449/+413
Change-Id: I0fc8429063d99e10344aaadba06480a470b9eb9d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-06Avoid prompting error on empty lineJosé Bollo1-3/+4
Change-Id: I9da7f17f93f1948da23f6a2304f0718d7bee6464 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-06Improve namesJosé Bollo1-11/+11
Change-Id: Ib7e31b50a725c73e6eaba414c6628524fbcd84f9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-06Make websocket concurrentJosé Bollo1-7/+31
Stress tests shown that the module wsj1 wasn't ready to concurrency. Change-Id: Ia54196f97e9712adf0920b59b188d570f39a6b4f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-06Add an easy function for synchronous callsJosé Bollo2-4/+74
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>
2017-04-06Avoid to stick on event loopJosé Bollo1-1/+10
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>
2017-04-06Reduce explicitely recursionJosé Bollo2-25/+24
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>
2017-04-05Make daemon interface commonJosé Bollo5-177/+173
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>
2017-04-05Add permission subsystemJosé Bollo6-0/+756
Change-Id: I0bbbf55832faf6413dd6147174934d0d4dc5277d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-04Ensure that subcall_sync use subcallJosé Bollo5-62/+63
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>
2017-04-04Avoid to count child threadsJosé Bollo1-7/+9
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>
2017-04-04Add synchronous subcallsJosé Bollo8-39/+141
Synchronous subcalls are more easy for writing simple applications with sequential logic. Change-Id: I76a0231a64a6db8270014cd2a64284e1b0fc16ec Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-04Use SIGHUP instead of SIGKILLJosé Bollo1-4/+3
This doesn't enforces anymore the brutal termination. Change-Id: I62445c7cb3692354637906fb1ddda1787c8fb82a Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-04Launch job at a earlier stepJosé Bollo9-48/+50
Change-Id: I3fcb96e4d748e38eacc4d413a451143dd9b4a10d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-04Definitive switch to internal's xreqJosé Bollo11-168/+16
This switch allows to work on a common base for the requests. Change-Id: I94e7fdda80c1966af399309334c41c7c8c8259dc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-04Migrates subcalls to use xreqJosé Bollo3-125/+70
Change-Id: If865208bc0c207511d2b11e4cff617005ed01e56 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-04Introduce subcontext for subcallsJosé Bollo2-6/+29
Change-Id: I5460e9c502cee814c59a0ee60c2be001385e7b4a Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-03Switch API D-Bus to xreqJosé Bollo1-110/+68
Change-Id: I16bfa2594f8de4babcc0d3cc1a62e7d0856d2479 Signed-off-by: José Bollo <jose.bollo@iot.bzh>