X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd%2Fsd-bus%2Fbus-protocol.h;fp=src%2Flibsystemd%2Fsd-bus%2Fbus-protocol.h;h=183af89a63a07fa1892df0e7eb25a77d9f2ffd9c;hb=b381de4197157748ed96e469fcc372c23f842ae1;hp=6431dfbff847aea1232de15ca20203e2281f3a07;hpb=ee04388a54f0e045377eeaf33c17eb357fe12d69;p=elogind.git diff --git a/src/libsystemd/sd-bus/bus-protocol.h b/src/libsystemd/sd-bus/bus-protocol.h index 6431dfbff..183af89a6 100644 --- a/src/libsystemd/sd-bus/bus-protocol.h +++ b/src/libsystemd/sd-bus/bus-protocol.h @@ -23,21 +23,38 @@ #include +#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 */