1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2013 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 #include <sys/socket.h>
26 #include <netinet/in.h>
34 #include "bus-error.h"
36 struct reply_callback {
37 sd_message_handler_t callback;
44 struct filter_callback {
45 sd_message_handler_t callback;
48 LIST_FIELDS(struct filter_callback, callbacks);
51 struct object_callback {
52 sd_message_handler_t callback;
78 sd_bus_message **rqueue;
81 sd_bus_message **wqueue;
89 Prioq *reply_callbacks_prioq;
90 Hashmap *reply_callbacks;
91 LIST_HEAD(struct filter_callback, filter_callbacks);
92 Hashmap *object_callbacks;
96 struct sockaddr_un un;
97 struct sockaddr_in in;
98 struct sockaddr_in6 in6;
100 socklen_t sockaddr_size;
105 unsigned address_index;
107 int last_connect_error;
109 struct iovec auth_iovec[3];
116 char label[NAME_MAX];
122 static inline void bus_unrefp(sd_bus **b) {
126 #define _cleanup_bus_unref_ __attribute__((cleanup(bus_unrefp)))
127 #define _cleanup_bus_error_free_ __attribute__((cleanup(sd_bus_error_free)))
129 #define BUS_DEFAULT_TIMEOUT ((usec_t) (25 * USEC_PER_SEC))
131 #define BUS_WQUEUE_MAX 128
132 #define BUS_RQUEUE_MAX 128
134 #define BUS_MESSAGE_SIZE_MAX (64*1024*1024)
135 #define BUS_AUTH_SIZE_MAX (64*1024)
137 #define BUS_CONTAINER_DEPTH 128
139 /* Defined by the specification as maximum size of an array in
141 #define BUS_ARRAY_MAX_SIZE 67108864
143 #define BUS_FDS_MAX 1024
145 bool object_path_is_valid(const char *p);
146 bool interface_name_is_valid(const char *p);
147 bool service_name_is_valid(const char *p);
148 bool member_name_is_valid(const char *p);
150 #define error_name_is_valid interface_name_is_valid
152 int bus_ensure_running(sd_bus *bus);