]>
Commit | Line | Data |
---|---|---|
1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ | |
2 | #pragma once | |
3 | ||
4 | #include "sd-bus.h" /* IWYU pragma: export */ | |
5 | ||
6 | #include "log.h" | |
7 | #include "forward.h" | |
8 | ||
9 | typedef enum BusTransport { | |
10 | BUS_TRANSPORT_LOCAL, | |
11 | BUS_TRANSPORT_REMOTE, | |
12 | BUS_TRANSPORT_MACHINE, | |
13 | BUS_TRANSPORT_CAPSULE, | |
14 | _BUS_TRANSPORT_MAX, | |
15 | _BUS_TRANSPORT_INVALID = -EINVAL, | |
16 | } BusTransport; | |
17 | ||
18 | int bus_async_unregister_and_exit(sd_event *e, sd_bus *bus, const char *name); | |
19 | ||
20 | typedef bool (*check_idle_t)(void *userdata); | |
21 | ||
22 | int bus_event_loop_with_idle(sd_event *e, sd_bus *bus, const char *name, usec_t timeout, check_idle_t check_idle, void *userdata); | |
23 | ||
24 | int bus_name_has_owner(sd_bus *bus, const char *name, sd_bus_error *reterr_error); | |
25 | ||
26 | bool bus_error_is_unknown_service(const sd_bus_error *error); | |
27 | bool bus_error_is_connection(const sd_bus_error *error); | |
28 | ||
29 | int bus_check_peercred(sd_bus *bus); | |
30 | ||
31 | int bus_set_address_capsule_bus(sd_bus *bus, const char *capsule, int *ret_pin_fd); | |
32 | ||
33 | int bus_connect_system_systemd(sd_bus **ret); | |
34 | int bus_connect_user_systemd(sd_bus **ret); | |
35 | int bus_connect_capsule_systemd(const char *capsule, sd_bus **ret); | |
36 | int bus_connect_capsule_bus(const char *capsule, sd_bus **ret); | |
37 | ||
38 | int bus_connect_transport(BusTransport transport, const char *host, RuntimeScope runtime_scope, sd_bus **bus); | |
39 | int bus_connect_transport_systemd(BusTransport transport, const char *host, RuntimeScope runtime_scope, sd_bus **bus); | |
40 | ||
41 | int bus_log_address_error(int r, BusTransport transport); | |
42 | int bus_log_connect_full(int log_level, int r, BusTransport transport, RuntimeScope scope); | |
43 | int bus_log_connect_error(int r, BusTransport transport, RuntimeScope scope); | |
44 | ||
45 | #define bus_log_parse_error(r) \ | |
46 | log_error_errno(r, "Failed to parse bus message: %m") | |
47 | ||
48 | #define bus_log_parse_error_debug(r) \ | |
49 | log_debug_errno(r, "Failed to parse bus message: %m") | |
50 | ||
51 | #define bus_log_create_error(r) \ | |
52 | log_error_errno(r, "Failed to create bus message: %m") | |
53 | ||
54 | int bus_path_encode_unique(sd_bus *b, const char *prefix, const char *sender_id, const char *external_id, char **ret_path); | |
55 | int bus_path_decode_unique(const char *path, const char *prefix, char **ret_sender, char **ret_external); | |
56 | ||
57 | int bus_track_add_name_many(sd_bus_track *t, char * const *l); | |
58 | int bus_track_to_strv(sd_bus_track *t, char ***ret); | |
59 | ||
60 | int bus_open_system_watch_bind_with_description(sd_bus **ret, const char *description); | |
61 | static inline int bus_open_system_watch_bind(sd_bus **ret) { | |
62 | return bus_open_system_watch_bind_with_description(ret, NULL); | |
63 | } | |
64 | ||
65 | int bus_reply_pair_array(sd_bus_message *m, char * const *l); | |
66 | ||
67 | /* Listen to GetMallocInfo() calls to 'destination' and return malloc_info() via FD */ | |
68 | int bus_register_malloc_status(sd_bus *bus, const char *destination); | |
69 | ||
70 | int bus_creds_get_pidref(sd_bus_creds *c, PidRef *ret); | |
71 | int bus_query_sender_pidref(sd_bus_message *m, PidRef *ret); | |
72 | ||
73 | int bus_get_instance_id(sd_bus *bus, sd_id128_t *ret); | |
74 | ||
75 | const char* bus_transport_to_string(BusTransport transport) _const_; |