D-Bus 1.15.12
Data Fields
DBusHeader Struct Reference

Message header data and some cached details of it. More...

#include <dbus-marshal-header.h>

Data Fields

DBusString data
 Header network data, stored separately from body so we can independently realloc it.
 
DBusHeaderField fields [DBUS_HEADER_FIELD_LAST+1]
 Track the location of each field in header.
 
dbus_uint32_t padding: 3
 0-7 bytes of alignment in header, the distance from [B] to [C]
 
dbus_uint32_t byte_order: 8
 byte order of header (must always match the content of byte 0)
 

Detailed Description

Message header data and some cached details of it.

A message looks like this:

| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | <- index % 8
|-------|-------|-------|------|-----|-----|-----|-----|
| Order | Type | Flags | Vers | Body length |
| Serial | Fields array length [A]
[A] Code |Sig.len| Signature + \0 | Content...| <- first field
| Content ... | Pad to 8-byte boundary|
| Code |Sig.len| Signature + \0 | Content... | <- second field
...
| Code |Sig.len| Signature | Content... | <- last field
| Content ... [B] Padding to 8-byte boundary [C]
[C] Body ... |
...
| Body ... [D] <- no padding after natural length
dbus_uint32_t padding
0-7 bytes of alignment in header, the distance from [B] to [C]

Each field is a struct<byte,variant>. All structs have 8-byte alignment, so each field is preceded by 0-7 bytes of padding to an 8-byte boundary (for the first field it happens to be 0 bytes). The overall header is followed by 0-7 bytes of padding to align the body.

Key to content, with variable name references for _dbus_header_load():

Order: byte order, currently 'l' or 'B' (byte_order) Type: message type such as DBUS_MESSAGE_TYPE_METHOD_CALL Flags: message flags such as DBUS_HEADER_FLAG_NO_REPLY_EXPECTED Vers: D-Bus wire protocol version, currently always 1 Body length: Distance from [C] to [D] Serial: Message serial number Fields array length: Distance from [A] to [B] (fields_array_len)

To understand _dbus_header_load():

[A] is FIRST_FIELD_OFFSET. header_len is from 0 to [C]. padding_start is [B]. padding_len is the padding from [B] to [C].

Definition at line 89 of file dbus-marshal-header.h.

Field Documentation

◆ byte_order

dbus_uint32_t DBusHeader::byte_order

byte order of header (must always match the content of byte 0)

Definition at line 108 of file dbus-marshal-header.h.

◆ data

DBusString DBusHeader::data

Header network data, stored separately from body so we can independently realloc it.

Its length includes up to 8 bytes of padding to align the body to an 8-byte boundary.

In a steady state, this has length [C]. During editing, it is temporarily extended to have the maximum possible padding.

Definition at line 91 of file dbus-marshal-header.h.

Referenced by _dbus_header_byteswap(), _dbus_header_copy(), _dbus_header_create(), _dbus_header_free(), _dbus_header_get_byte_order(), _dbus_header_get_field_basic(), _dbus_header_get_field_raw(), _dbus_header_get_flag(), _dbus_header_get_message_type(), _dbus_header_get_serial(), _dbus_header_init(), _dbus_header_load(), _dbus_header_reinit(), _dbus_header_remove_unknown_fields(), _dbus_header_set_field_basic(), _dbus_header_set_serial(), _dbus_header_toggle_flag(), _dbus_header_update_lengths(), _dbus_message_add_counter_link(), _dbus_message_get_network_data(), and dbus_message_marshal().

◆ fields

DBusHeaderField DBusHeader::fields[DBUS_HEADER_FIELD_LAST+1]

Track the location of each field in header.

Definition at line 102 of file dbus-marshal-header.h.

Referenced by _dbus_header_get_field_basic(), _dbus_header_get_field_raw(), and _dbus_header_load().

◆ padding

dbus_uint32_t DBusHeader::padding

0-7 bytes of alignment in header, the distance from [B] to [C]

Definition at line 106 of file dbus-marshal-header.h.

Referenced by _dbus_header_create(), _dbus_header_load(), and _dbus_header_reinit().


The documentation for this struct was generated from the following file: