bus-message.h revision aa0d0ed6b87d41367fd6c4401472df7d45dd1b13
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#pragma once
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdbool.h>
#include <byteswap.h>
#include "macro.h"
#include "sd-bus.h"
#include "time-util.h"
#include "bus-creds.h"
#include "bus-protocol.h"
struct bus_container {
char enclosing;
bool need_offsets:1;
/* Indexes into the signature string */
unsigned index, saved_index;
char *signature;
/* dbus1: pointer to the array size value, if this is a value */
char *peeked_signature;
};
struct bus_body_part {
struct bus_body_part *next;
void *data;
void *mmap_begin;
int memfd;
bool free_this:1;
bool munmap_this:1;
bool sealed:1;
bool is_zero:1;
};
struct sd_bus_message {
unsigned n_ref;
const char *path;
const char *interface;
const char *member;
const char *destination;
const char *sender;
bool sealed:1;
bool dont_send:1;
bool allow_fds:1;
bool free_header:1;
bool free_kdbus:1;
bool free_fds:1;
bool release_kdbus:1;
bool poisoned:1;
/* The first and last bytes of the message */
struct bus_header *header;
void *footer;
/* How many bytes are accessible in the above pointers */
struct bus_body_part body;
struct bus_body_part *body_end;
unsigned n_body_parts;
struct bus_body_part *cached_rindex_part;
int *fds;
unsigned n_iovec;
char *peeked_signature;
/* If set replies to this message must carry the signature
* specified here to successfully seal. This is initialized
* from the vtable data */
const char *enforced_reply_signature;
char *destination_ptr;
unsigned n_header_offsets;
};
static inline bool BUS_MESSAGE_NEED_BSWAP(sd_bus_message *m) {
}
return BUS_MESSAGE_NEED_BSWAP(m) ? bswap_16(u) : u;
}
return BUS_MESSAGE_NEED_BSWAP(m) ? bswap_32(u) : u;
}
return BUS_MESSAGE_NEED_BSWAP(m) ? bswap_64(u) : u;
}
}
return
sizeof(struct bus_header) +
ALIGN8(m->fields_size) +
m->body_size;
}
return
sizeof(struct bus_header) +
ALIGN8(m->fields_size);
}
static inline void* BUS_MESSAGE_FIELDS(sd_bus_message *m) {
}
static inline bool BUS_MESSAGE_IS_GVARIANT(sd_bus_message *m) {
}
int bus_message_read_strv_extend(sd_bus_message *m, char ***l);
void *header,
void *footer,
int *fds,
unsigned n_fds,
const char *label,
sd_bus_message **ret);
void *buffer,
int *fds,
unsigned n_fds,
const char *label,
sd_bus_message **ret);
int bus_message_parse_fields(sd_bus_message *m);
#define MESSAGE_FOREACH_PART(part, i, m) \
int bus_message_to_errno(sd_bus_message *m);
int bus_message_new_synthetic_error(sd_bus *bus, uint64_t serial, const sd_bus_error *e, sd_bus_message **m);