+ /* configure the daemon */
+ if (afb_session_init(main_config->nbSessionMax, main_config->cntxTimeout, main_config->token)) {
+ ERROR("initialisation of session manager failed");
+ goto error;
+ }
+ main_apiset = afb_apiset_create("main", main_config->apiTimeout);
+ if (!main_apiset) {
+ ERROR("can't create main api set");
+ goto error;
+ }
+ if (afb_monitor_init() < 0) {
+ ERROR("failed to setup monitor");
+ goto error;
+ }
+ if (afb_supervision_init() < 0) {
+ ERROR("failed to setup supervision");
+ goto error;
+ }
+
+ /* install hooks */
+ if (main_config->tracereq)
+ afb_hook_create_xreq(NULL, NULL, NULL, main_config->tracereq, NULL, NULL);
+ if (main_config->traceditf)
+ afb_hook_create_ditf(NULL, main_config->traceditf, NULL, NULL);
+ if (main_config->tracesvc)
+ afb_hook_create_svc(NULL, main_config->tracesvc, NULL, NULL);
+ if (main_config->traceevt)
+ afb_hook_create_evt(NULL, main_config->traceevt, NULL, NULL);
+ if (main_config->traceses)
+ afb_hook_create_session(NULL, main_config->traceses, NULL, NULL);
+
+ /* load bindings */
+ afb_debug("start-load");
+ apiset_start_list(main_config->so_bindings, afb_api_so_add_binding, "the binding");
+ apiset_start_list(main_config->dbus_clients, afb_api_dbus_add_client, "the afb-dbus client");
+ apiset_start_list(main_config->ws_clients, afb_api_ws_add_client_weak, "the afb-websocket client");
+ apiset_start_list(main_config->ldpaths, afb_api_so_add_pathset_fails, "the binding path set");
+ apiset_start_list(main_config->weak_ldpaths, afb_api_so_add_pathset_nofails, "the weak binding path set");
+
+ apiset_start_list(main_config->dbus_servers, afb_api_dbus_add_server, "the afb-dbus service");
+ apiset_start_list(main_config->ws_servers, afb_api_ws_add_server, "the afb-websocket service");
+