From 482dab2076282ef1195564fa60dd25c1ffb77682 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Fri, 31 Jan 2003 03:49:42 +0000 Subject: 2003-01-31 Havoc Pennington * doc/dbus-specification.sgml: fully specify the header. Add flags and major protocol version, and change header/body len to unsigned. * dbus/dbus-message-builder.c (append_saved_length): append length as uint32 * dbus/dbus-message.c (dbus_message_create_header): change header length and body length to unsigned. Add the new fields from the spec (_dbus_message_loader_return_buffer): unsigned header/body len --- doc/dbus-specification.sgml | 105 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/dbus-specification.sgml b/doc/dbus-specification.sgml index 632575b0..b8d80bb8 100644 --- a/doc/dbus-specification.sgml +++ b/doc/dbus-specification.sgml @@ -83,7 +83,95 @@ Header Encoding - [document the required header fields and how they are encoded] + Following the mandatory fields, there are zero or more named fields (see + ), and then nul bytes + padding the header such that its total length in bytes is a multiple of + 8. + + + The header MUST begin with the following mandatory fields in the following + order: + + + + + Size + Description + + + + + 1 byte + Endianness flag; ASCII 'l' for little-endian + or ASCII 'B' for big-endian. + + + 1 byte + Bitwise OR of flags. Unknown flags + MUST be ignored. Currently-defined flags are described below. + + + + 1 byte + Major protocol version of the sending application. If + the major protocol version of the receiving application does not + match, the applications will not be able to communicate and the + D-BUS connection MUST be disconnected. The major protocol + version for this version of the specification is 0. + + + + 1 byte + A nul byte, reserved for future use. + Any value for this byte MUST be accepted. + + + + 4 bytes + An unsigned 32-bit integer in the + message's byte order, indicating the total length in bytes of + the header including named fields and any alignment padding. + MUST be a multiple of 8. + + + + 4 bytes + An unsigned 32-bit integer in the + message's byte order, indicating the total length in bytes of + the message body. + + + + 4 bytes + The message's serial number, a signed 32-bit integer in + the message's byte order. Applications MUST NOT reuse the same + serial number for different messages more often than 32-bit + integer wraparound. Serial numbers must be greater than + zero. + + + + + + + + Flags that can appear in the second byte of the header: + + + + + Hex value + Description + + + + + 0x1 + This message is an error reply. + + + + @@ -100,7 +188,22 @@ invent their own header fields; only changes to this specification may introduce new header fields. + + + Header Alignment Padding + + To allow implementations to keep the header and the body in a single + buffer while keeping data types aligned, the total length of the header + must be a multiple of 8 bytes. To achieve this, the header MUST be padded + with nul bytes to align its total length on an 8-byte boundary. + The minimum number of padding bytes MUST be used. Because all possible + named fields use at least 8 bytes, implementations can distinguish + padding (which must be less than 8 bytes) from additional named fields + (which must be at least 8 bytes). + + + Message Arguments -- cgit