2 * Copyright (C) 2016, 2017 "IoT.bzh"
3 * Author: José Bollo <jose.bollo@iot.bzh>
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 /* declaration of features of libsystemd */
25 * Definition of the facilities provided by the daemon.
27 struct afb_daemon_itf {
28 int (*event_broadcast)(void *closure, const char *name, struct json_object *object); /* broadcasts evant 'name' with 'object' */
29 struct sd_event *(*get_event_loop)(void *closure); /* gets the common systemd's event loop */
30 struct sd_bus *(*get_user_bus)(void *closure); /* gets the common systemd's user d-bus */
31 struct sd_bus *(*get_system_bus)(void *closure); /* gets the common systemd's system d-bus */
32 void (*vverbose_v1)(void*closure, int level, const char *file, int line, const char *fmt, va_list args);
33 struct afb_event (*event_make)(void *closure, const char *name); /* creates an event of 'name' */
34 int (*rootdir_get_fd)(void *closure);
35 int (*rootdir_open_locale)(void *closure, const char *filename, int flags, const char *locale);
36 int (*queue_job)(void *closure, void (*callback)(int signum, void *arg), void *argument, void *group, int timeout);
37 void (*vverbose_v2)(void*closure, int level, const char *file, int line, const char * func, const char *fmt, va_list args);
41 * Structure for accessing daemon.
42 * See also: afb_daemon_get_event_sender, afb_daemon_get_event_loop, afb_daemon_get_user_bus, afb_daemon_get_system_bus
45 const struct afb_daemon_itf *itf; /* the interfacing functions */
46 void *closure; /* the closure when calling these functions */