bus-message.h revision 77adde638217112c9e080035197a76f4dc4af700
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering#pragma once
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering/***
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering This file is part of systemd.
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering Copyright 2013 Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering systemd is free software; you can redistribute it and/or modify it
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering under the terms of the GNU Lesser General Public License as published by
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering (at your option) any later version.
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering systemd is distributed in the hope that it will be useful, but
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering Lesser General Public License for more details.
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering You should have received a copy of the GNU Lesser General Public License
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering***/
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering#include <stdbool.h>
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering#include <byteswap.h>
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering#include <sys/socket.h>
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering#include "macro.h"
1ca208fb4f93e5869704af1812cbff7130a2fc03Zbigniew Jędrzejewski-Szmek#include "sd-bus.h"
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering#include "kdbus.h"
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering#include "time-util.h"
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering#include "bus-creds.h"
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering#include "bus-protocol.h"
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstruct bus_container {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char enclosing;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool need_offsets:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* Indexes into the signature string */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering unsigned index, saved_index;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *signature;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t before, begin, end;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* dbus1: pointer to the array size value, if this is a value */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t *array_size;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* gvariant: list of offsets to end of children if this is struct/dict entry/array */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t *offsets, n_offsets, offsets_allocated, offset_index;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t item_size;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *peeked_signature;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering};
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstruct bus_body_part {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct bus_body_part *next;
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek void *data;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t size;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t mapped;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t allocated;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t memfd_offset;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering int memfd;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool free_this:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool munmap_this:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool sealed:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool is_zero:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering};
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstruct sd_bus_message {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering unsigned n_ref;
39883f622f392d8579f4428fc5a789a102efbb10Lennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering sd_bus *bus;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek uint64_t reply_cookie;
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering const char *path;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering const char *interface;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering const char *member;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering const char *destination;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering const char *sender;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering sd_bus_error error;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering sd_bus_creds creds;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering usec_t monotonic;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering usec_t realtime;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint64_t seqnum;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering int64_t priority;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint64_t verify_destination_id;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool sealed:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool dont_send:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool allow_fds:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool free_header:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool free_kdbus:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool free_fds:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool release_kdbus:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool poisoned:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct bus_header *header;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct bus_body_part body;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct bus_body_part *body_end;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering unsigned n_body_parts;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t rindex;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct bus_body_part *cached_rindex_part;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t cached_rindex_part_begin;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t n_fds;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering int *fds;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct bus_container root_container, *containers;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering unsigned n_containers;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t containers_allocated;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct iovec *iovec;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct iovec iovec_fixed[2];
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering unsigned n_iovec;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct kdbus_msg *kdbus;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *peeked_signature;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* If set replies to this message must carry the signature
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering * specified here to successfully seal. This is initialized
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering * from the vtable data */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering const char *enforced_reply_signature;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering usec_t timeout;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char sender_buffer[3 + DECIMAL_STR_MAX(uint64_t) + 1];
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char destination_buffer[3 + DECIMAL_STR_MAX(uint64_t) + 1];
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *destination_ptr;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t header_offsets[_BUS_MESSAGE_HEADER_MAX];
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering unsigned n_header_offsets;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering};
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering#define BUS_MESSAGE_NEED_BSWAP(m) ((m)->header->endian != BUS_NATIVE_ENDIAN)
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstatic inline uint16_t BUS_MESSAGE_BSWAP16(sd_bus_message *m, uint16_t u) {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering return BUS_MESSAGE_NEED_BSWAP(m) ? bswap_16(u) : u;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering}
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstatic inline uint32_t BUS_MESSAGE_BSWAP32(sd_bus_message *m, uint32_t u) {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering return BUS_MESSAGE_NEED_BSWAP(m) ? bswap_32(u) : u;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering}
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstatic inline uint64_t BUS_MESSAGE_BSWAP64(sd_bus_message *m, uint64_t u) {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering return BUS_MESSAGE_NEED_BSWAP(m) ? bswap_64(u) : u;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering}
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstatic inline uint64_t BUS_MESSAGE_COOKIE(sd_bus_message *m) {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* Note that we return the serial converted to a 64bit value here */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering return BUS_MESSAGE_BSWAP32(m, m->header->serial);
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering}
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstatic inline uint32_t BUS_MESSAGE_BODY_SIZE(sd_bus_message *m) {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering return BUS_MESSAGE_BSWAP32(m, m->header->body_size);
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering}
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstatic inline uint32_t BUS_MESSAGE_FIELDS_SIZE(sd_bus_message *m) {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering return BUS_MESSAGE_BSWAP32(m, m->header->fields_size);
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering}
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstatic inline uint32_t BUS_MESSAGE_SIZE(sd_bus_message *m) {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering return
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering sizeof(struct bus_header) +
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering ALIGN8(BUS_MESSAGE_FIELDS_SIZE(m)) +
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering BUS_MESSAGE_BODY_SIZE(m);
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering}
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstatic inline uint32_t BUS_MESSAGE_BODY_BEGIN(sd_bus_message *m) {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering return
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering sizeof(struct bus_header) +
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering ALIGN8(BUS_MESSAGE_FIELDS_SIZE(m));
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering}
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstatic inline void* BUS_MESSAGE_FIELDS(sd_bus_message *m) {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering return (uint8_t*) m->header + sizeof(struct bus_header);
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering}
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmekstatic inline bool BUS_MESSAGE_IS_GVARIANT(sd_bus_message *m) {
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek return m->header->version == 2;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering}
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringint bus_message_seal(sd_bus_message *m, uint64_t serial, usec_t timeout);
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringint bus_message_get_blob(sd_bus_message *m, void **buffer, size_t *sz);
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringint bus_message_read_strv_extend(sd_bus_message *m, char ***l);
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringint bus_message_from_header(
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering sd_bus *bus,
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek void *header,
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek size_t length,
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek int *fds,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering unsigned n_fds,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering const struct ucred *ucred,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering const char *label,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t extra,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering sd_bus_message **ret);
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringint bus_message_from_malloc(
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler sd_bus *bus,
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett void *buffer,
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett size_t length,
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler int *fds,
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett unsigned n_fds,
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett const struct ucred *ucred,
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett const char *label,
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poettering sd_bus_message **ret);
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettint bus_message_get_arg(sd_bus_message *m, unsigned i, const char **str, char ***strv);
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächlerint bus_message_append_ap(sd_bus_message *m, const char *types, va_list ap);
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett
da927ba997d68401563b927f92e6e40e021a8e5cMichal Schmidtint bus_message_parse_fields(sd_bus_message *m);
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poettering
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poetteringbool bus_header_is_complete(struct bus_header *h, size_t size);
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poetteringint bus_header_message_size(struct bus_header *h, size_t *sum);
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poettering
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poetteringstruct bus_body_part *message_append_part(sd_bus_message *m);
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett#define MESSAGE_FOREACH_PART(part, i, m) \
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett for ((i) = 0, (part) = &(m)->body; (i) < (m)->n_body_parts; (i)++, (part) = (part)->next)
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächlerint bus_body_part_map(struct bus_body_part *part);
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächlervoid bus_body_part_unmap(struct bus_body_part *part);
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächlerint bus_message_to_errno(sd_bus_message *m);
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis Tikhomirov
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis Tikhomirovint bus_message_new_synthetic_error(sd_bus *bus, uint64_t serial, const sd_bus_error *e, sd_bus_message **m);
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis Tikhomirov
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächlerint bus_message_remarshal(sd_bus *bus, sd_bus_message **m);
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler
0c9d8f1d4b5018199cb5a9b57580dc1480a7f915Jani Nikulaint bus_message_append_sender(sd_bus_message *m, const char *sender);
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis Tikhomirov