1 Functions of class **afb_daemon**
2 ============================
4 All the functions of the class **afb_daemon** use the default api.
5 This are internally aliased to the corresponding function of class afb_api_t.
9 * Retrieves the common systemd's event loop of AFB
11 struct sd_event *afb_daemon_get_event_loop();
14 * Retrieves the common systemd's user/session d-bus of AFB
16 struct sd_bus *afb_daemon_get_user_bus();
19 * Retrieves the common systemd's system d-bus of AFB
21 struct sd_bus *afb_daemon_get_system_bus();
24 * Broadcasts widely the event of 'name' with the data 'object'.
25 * 'object' can be NULL.
27 * For convenience, the function calls 'json_object_put' for 'object'.
28 * Thus, in the case where 'object' should remain available after
29 * the function returns, the function 'json_object_get' shall be used.
31 * Calling this function is only forbidden during preinit.
33 * Returns the count of clients that received the event.
35 int afb_daemon_broadcast_event(
37 struct json_object *object);
40 * Creates an event of 'name' and returns it.
42 * Calling this function is only forbidden during preinit.
44 * See afb_event_is_valid to check if there is an error.
46 afb_event_t afb_daemon_make_event(
50 * @deprecated use bindings version 3
52 * Send a message described by 'fmt' and following parameters
53 * to the journal for the verbosity 'level'.
55 * 'file', 'line' and 'func' are indicators of position of the code in source files
56 * (see macros __FILE__, __LINE__ and __func__).
58 * 'level' is defined by syslog standard:
59 * EMERGENCY 0 System is unusable
60 * ALERT 1 Action must be taken immediately
61 * CRITICAL 2 Critical conditions
62 * ERROR 3 Error conditions
63 * WARNING 4 Warning conditions
64 * NOTICE 5 Normal but significant condition
65 * INFO 6 Informational
66 * DEBUG 7 Debug-level messages
68 void afb_daemon_verbose(
77 * @deprecated use bindings version 3
79 * Get the root directory file descriptor. This file descriptor can
80 * be used with functions 'openat', 'fstatat', ...
82 * Returns the file descriptor or -1 in case of error.
84 int afb_daemon_rootdir_get_fd();
87 * Opens 'filename' within the root directory with 'flags' (see function openat)
88 * using the 'locale' definition (example: "jp,en-US") that can be NULL.
90 * Returns the file descriptor or -1 in case of error.
92 int afb_daemon_rootdir_open_locale(
98 * Queue the job defined by 'callback' and 'argument' for being executed asynchronously
99 * in this thread (later) or in an other thread.
100 * If 'group' is not NUL, the jobs queued with a same value (as the pointer value 'group')
101 * are executed in sequence in the order of there submission.
102 * If 'timeout' is not 0, it represent the maximum execution time for the job in seconds.
103 * At first, the job is called with 0 as signum and the given argument.
104 * The job is executed with the monitoring of its time and some signals like SIGSEGV and
105 * SIGFPE. When a such signal is catched, the job is terminated and reexecuted but with
106 * signum being the signal number (SIGALRM when timeout expired).
108 * Returns 0 in case of success or -1 in case of error.
110 int afb_daemon_queue_job(
111 void (*callback)(int signum, void *arg),
117 * Tells that it requires the API of "name" to exist
118 * and if 'initialized' is not null to be initialized.
119 * Calling this function is only allowed within init.
121 * Returns 0 in case of success or -1 in case of error.
123 int afb_daemon_require_api(
128 * Create an aliased name 'as_name' for the api 'name'.
129 * Calling this function is only allowed within preinit.
131 * Returns 0 in case of success or -1 in case of error.
133 int afb_daemon_add_alias(const char *name, const char *as_name);
136 * Creates a new api of name 'api' with brief 'info'.
138 * Returns 0 in case of success or -1 in case of error.
140 int afb_daemon_new_api(
144 int (*preinit)(void*, struct afb_api_x3 *),