bus-message.h revision 42c4ebcbd4cbd7b27667eb8081ee4dc46f9ece17
/*-*- 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 "kdbus.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_header {
/* Note that what the bus spec calls "serial" we'll call
"cookie" instead, because we don't want to imply that the
cookie was in any way monotonically increasing. */
} _packed_;
struct bus_body_part {
struct bus_body_part *next;
void *data;
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;
struct bus_header *header;
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_containers;
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;
unsigned n_header_offsets;
};
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;
}
/* Note that we return the serial converted to a 64bit value here */
}
}
}
return
sizeof(struct bus_header) +
}
return
sizeof(struct bus_header) +
}
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,
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);
const char* bus_message_get_arg(sd_bus_message *m, unsigned i);
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);