bus-internal.h revision 8f155917bf5c11c8f156d7f25f242257d6086cb9
d657c51f14601d0235434ffb78cf6ac0f27cc83cLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
204fa33c82588c47ebeef3f8c4c0b7da750e37f7Lennart Poettering This file is part of systemd.
204fa33c82588c47ebeef3f8c4c0b7da750e37f7Lennart Poettering Copyright 2013 Lennart Poettering
204fa33c82588c47ebeef3f8c4c0b7da750e37f7Lennart Poettering systemd is free software; you can redistribute it and/or modify it
204fa33c82588c47ebeef3f8c4c0b7da750e37f7Lennart Poettering under the terms of the GNU Lesser General Public License as published by
204fa33c82588c47ebeef3f8c4c0b7da750e37f7Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
204fa33c82588c47ebeef3f8c4c0b7da750e37f7Lennart Poettering (at your option) any later version.
204fa33c82588c47ebeef3f8c4c0b7da750e37f7Lennart Poettering systemd is distributed in the hope that it will be useful, but
204fa33c82588c47ebeef3f8c4c0b7da750e37f7Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
204fa33c82588c47ebeef3f8c4c0b7da750e37f7Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
204fa33c82588c47ebeef3f8c4c0b7da750e37f7Lennart Poettering Lesser General Public License for more details.
204fa33c82588c47ebeef3f8c4c0b7da750e37f7Lennart Poettering You should have received a copy of the GNU Lesser General Public License
204fa33c82588c47ebeef3f8c4c0b7da750e37f7Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
d26e4270409506cd398875216413b651d6ee7de6Lennart Poettering LIST_FIELDS(struct filter_callback, callbacks);
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poetteringstatic inline bool BUS_IS_OPEN(enum bus_state state) {
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering return state > BUS_UNSET && state < BUS_CLOSED;
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering /* We use atomic ref counting here since sd_bus_message
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering objects retain references to their originating sd_bus but
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering we want to allow them to be processed in a different
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering thread. We won't provide full thread safety, but only the
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering bare minimum that makes it possible to use sd_bus and
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering sd_bus_message objects independently and on different
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering threads as long as each object is used only once at the
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering LIST_HEAD(struct filter_callback, filter_callbacks);
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering /* We do locking around the memfd cache, since we want to
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering * allow people to process a sd_bus_message in a different
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering * thread then it was generated on and free it there. Since
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering * adding something to the memfd cache might happen when a
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering * message is released, we hence need to protect this bit with
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering struct memfd_cache memfd_cache[MEMFD_CACHE_MAX];
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poetteringstatic inline void bus_unrefp(sd_bus **b) {
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering#define _cleanup_bus_unref_ __attribute__((cleanup(bus_unrefp)))
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering#define _cleanup_bus_error_free_ __attribute__((cleanup(sd_bus_error_free)))
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering#define BUS_DEFAULT_TIMEOUT ((usec_t) (25 * USEC_PER_SEC))
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering#define BUS_MESSAGE_SIZE_MAX (64*1024*1024)
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering/* Defined by the specification as maximum size of an array in
bool object_path_is_valid(const char *p);
bool interface_name_is_valid(const char *p);
bool service_name_is_valid(const char *p);
bool member_name_is_valid(const char *p);