summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2017-03-27Make main thread used for common jobsJosé Bollo3-94/+229
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>
2017-03-27Remove option readyfdJosé Bollo3-15/+0
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>
2017-03-27Speed up accesses to session's cookiesJosé Bollo1-13/+36
Minor improvement to speed up refactored contextes. Change-Id: I45c1c4b0cecec52d10c2b7c5cd8e738fd75b25d6 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-27Replace session's value with sessions's cookiesJosé Bollo7-60/+11
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>
2017-03-27Implement dichotomic search of APIsJosé Bollo1-11/+49
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>
2017-03-27Simplify functions for callsJosé Bollo13-67/+108
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>
2017-03-22Refactor of threading and signal monitorJosé Bollo10-498/+626
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>
2017-03-21Instanciate the environment variablesJosé Bollo1-50/+95
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>
2017-03-13Integration of socket activation for servicesJosé Bollo1-11/+22
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>
2017-03-13Beginning of integration as systemd serviceJosé Bollo4-2/+100
This allows to receive socket activation by names. Change-Id: I6896dec785e8d434da452ed2d1341016f6eadb60 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-13notify systemd of being startedJosé Bollo1-0/+2
Change-Id: I10251b0800ac44e59d2a17ebd202c9f55c5c9196 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-06Add comments about always setting INFER_EXTENSION.Sebastien Douheret2-0/+7
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>
2017-02-27fix SEGFLT when unhendled requestJosé Bollo1-3/+5
Change-Id: I34c657972111db843d0d9d26a1732b21ac519c57 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-02-22Enable INFER_EXTENSION and add well-known mime types.Sebastien Douheret2-1/+6
Change-Id: I7c433eea63c01d2b0813a9cc84c12433839bf125 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2017-02-21Fix issue in initialisation of api by sessionsJosé Bollo1-2/+3
Change-Id: I72639196ce7462c34a2037cc825cf819add4a2fc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-02-21fix issue for C++José Bollo1-1/+1
Change-Id: I14b5fb9a0f517d5a784cbbc43ca1401877d0f2fe Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-02-21fix mimetype by using libmagicJosé Bollo1-0/+1
Change-Id: I418b7f9323d4847dfef0f1f3f6dd90f6538b2ffb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-02-16Update documentation of --roothttp option.Sebastien Douheret1-5/+5
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>
2017-02-16Ignore Visual Studio Code projectSebastien Douheret1-0/+1
Change-Id: Iecbef1a7887496deb849ab807ebf4de644e66343 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2017-02-15Fix html heading and hyperlink orderSebastien Douheret1-5/+5
Change-Id: I4f52c1c68fa357306faf6cd976a69e65de580fdb Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2017-01-12Improves documentation and directory managementJosé Bollo4-36/+99
Change-Id: I21c102f7439343476765c65011664feece2d2c18 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-11Add option --random-tokenJosé Bollo1-49/+76
Also fix a bug in use of getopt_long. Change-Id: Iffc90104665664c8e5a61fbee70f03f3cdb660cb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-05First step for grouping processesJosé Bollo1-4/+17
Actually make afb-daemon the process group leader. Change-Id: I01ca7bb027416e2446cfa322b69684da4db852e2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-05Improves loggingJosé Bollo1-1/+9
Adds error message for errors related to HTTP. Change-Id: I5a3069528f8e9a7fe9a8dae6c201a783948a565a Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-05Adds options --no-httpd and --execJosé Bollo4-26/+185
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>
2017-01-04adds short option for verbosityJosé Bollo2-24/+82
Change-Id: I2282057344b2b986520f1a76f5a3c0a827d63075 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-04allows to repeat option --ldpathsJosé Bollo3-87/+81
Change-Id: Id07b02eaef35732416de2fb1c6b24f3f75979ed6 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-04Refactor of file main.cJosé Bollo4-643/+752
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>
2017-01-03Improves naming of session's moduleJosé Bollo21-565/+565
Make names looking like other names Change-Id: I63ce3d8a3d84193eca9d517cecb1888d630a9b2d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-03Removes uses of readdir_rJosé Bollo2-22/+26
Since glibc 2.24, readdir_r is deprecated. Change-Id: Id0e186e67b7e60bd537a8ba85ede446be0c5095e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-01-03cleanup: removes legacy-named fileJosé Bollo7-43/+108
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>
2017-01-03Cleanup of the projectJosé Bollo21-3514/+0
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>
2017-01-03Adds 2017 to copyrightsJosé Bollo81-82/+82
Change-Id: Id85c4eb4e36a05b61346004ba95daa19faf5074f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-12-28Update gitreview file for master branchJan-Simon Möller1-1/+1
Change-Id: I44fea156e7dc5c5fb16ae16aad7529476b35d485 Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
2016-12-14main: Removes setting roothttp to . by defaultJosé Bollo1-5/+4
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>
2016-12-14afb-hsrv: Adds an error when alias dir doesn't existJosé Bollo1-1/+1
Change-Id: Iab0f9b1997f6471ceab8bb43be07d6d00c53fd78 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-12-12fix html linkRonan1-1/+1
Change-Id: Iafcdcc919352c567bd097ee86aadae02e38c5415 Signed-off-by: Ronan <ronan.lemartret@iot.bzh>
2016-12-09fix svg path for websiteRonan2-3/+3
Change-Id: I059fe29816c0cba1f423d02f5bc7034438843cac Signed-off-by: Ronan <ronan.lemartret@iot.bzh>
2016-12-05Fix typo, get diagrams pictures and reordering docRomain Forlot25-2781/+1353
Change-Id: Id8327460cf59b330283a98db8cef3a89ef505d30 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2016-11-17afb-api-so: adds verbosity on dlopen errorJosé Bollo1-1/+1
Change-Id: Ibe42a346c29e71b12d67ebbf43a6fc8152df8202 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-10-31api-so: cleanupJosé Bollo1-5/+0
The structure monitoring is not used anymore. Change-Id: I3b900f7b109b2549f0b4cf17550bb71c4b49d32d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-10-28hook: add few commentsJosé Bollo1-8/+13
Change-Id: I453625b70f13a5b01a84b2ac60eb6fb9e0dd0ebd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-10-28hook: adding of hook feature for requestsJosé Bollo7-1/+716
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>
2016-10-14event: add ability to get the event nameJosé Bollo2-4/+23
Change-Id: Iecfeb4ab07c07715093d729710669abecee722de Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-10-10Threads: handles request with threadsJosé Bollo9-59/+582
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>
2016-10-07Explicit dependency on gcc 4.9 or higherJosé Bollo1-0/+3
Needed for _Thread_local keyword Change-Id: Ia68b2d25fd747b87d95a94ac383c0107b276cf2f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-10-07Fix a compiler errorJosé Bollo1-1/+1
Change-Id: Id95c612de55fe5606be945ac74c2c157620c8839 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-09-20minor: improves updt.sh scriptJosé Bollo1-0/+1
Change-Id: I0acc567bab126c6e8fef10b294eb0e362222ce5c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-09-20Documentation: improvementsJosé Bollo5-8/+220
- improves formatting of the documentation on events - add documentations of functions in headers Change-Id: Ie39d34fca8bd563a099f6b575c72e314ca08a29d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-09-19cleanup of old unuseful dataJosé Bollo3-242/+0
Change-Id: I849c615c4ff8d08ab170ca22c7d9038706099ff6 Signed-off-by: José Bollo <jose.bollo@iot.bzh>