diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-01-26 21:48:08 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-01-26 21:52:07 +0100 |
commit | b381de4197157748ed96e469fcc372c23f842ae1 (patch) | |
tree | 5f5fa7cc7a4a703c294d92b9501772857a286fdb /src/libsystemd/sd-bus/bus-protocol.h | |
parent | ee04388a54f0e045377eeaf33c17eb357fe12d69 (diff) |
sd-bus: change serialization of kdbus messages to qualify in their entirety as gvariant objects
Previously, we only minimally altered the dbus1 framing for kdbus, and
while the header and its fields where compliant Gvariant objects, and so
was the body, the entire message together was not.
As result of discussions with Ryan Lortie this is now changed, so that
the messages in there entirely are fully compliant GVariants. This
follows the framing description described here:
https://wiki.gnome.org/Projects/GLib/GDBus/Version2
Note that this change changes the framing of *all* messages sent via
kdbus, this means you have to reboot your kdbus system, after compiling
and installing this new version.
Diffstat (limited to 'src/libsystemd/sd-bus/bus-protocol.h')
-rw-r--r-- | src/libsystemd/sd-bus/bus-protocol.h | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/libsystemd/sd-bus/bus-protocol.h b/src/libsystemd/sd-bus/bus-protocol.h index 6431dfbff8..183af89a63 100644 --- a/src/libsystemd/sd-bus/bus-protocol.h +++ b/src/libsystemd/sd-bus/bus-protocol.h @@ -23,21 +23,38 @@ #include <endian.h> +#include "macro.h" + /* Packet header */ -struct bus_header { +struct _packed_ bus_header { + /* The first four fields are identical for dbus1, and dbus2 */ uint8_t endian; uint8_t type; uint8_t flags; uint8_t version; - uint32_t body_size; - - /* 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. */ - uint32_t serial; - uint32_t fields_size; -} _packed_; + + union _packed_ { + /* dbus1: Used for SOCK_STREAM connections */ + struct _packed_ { + uint32_t body_size; + + /* 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. */ + uint32_t serial; + uint32_t fields_size; + } dbus1; + + /* dbus2: Used for kdbus connections */ + struct _packed_ { + uint32_t _reserved; + uint64_t cookie; + } dbus2; + + /* Note that both header versions have the same size! */ + }; +}; /* Endianness */ |