These values have the following meanings:
that can appear in the second byte of the header are:
Flags that can appear in the third byte of the header:
Header Fields
The array at the end of the header contains header fields, where each field is a 1-byte field code followed by a field value. A header must contain the required header
fields for its message type, and zero or more of any optional header fields. Future versions of this protocol specification may add new fields. Implementations must
ignore fields they do not understand. Implementations must not invent their own header fields; only changes to this specification may introduce new header fields.
Again, if an implementation sees a header field code that it does not expect, it must ignore that field, as it will be part of a new (but compatible) version of this
specification. This also applies to known header fields appearing in unexpected messages, for example: if a signal has a reply serial it must be ignored even though it has
no meaning as of this version of the spec.
However, implementations must not send or accept known header fields with the wrong type stored in the field value. So for example a message with an INTERFACE
field of type UINT32 would be considered corrupt.
Here are the currently-defined header fields:
Valid Names
The various names in D-Bus messages have some restrictions.
There is a maximum name length of 255 which applies to bus names, interfaces, and members.
Value Description
1st BYTE
Endianness flag; ASCII 'l' for little-endian or ASCII 'B' for big-endian. Both header and body are in this endianness.
2nd BYTE
. Unknown types must be ignored. Currently-defined types are described below.
3rd BYTE
Bitwise OR of flags. Unknown flags must be ignored. Currently-defined flags are described below.
4th 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 1.
1st UINT32
Length in bytes of the message body, starting from the end of the header. The header ends after its alignment padding to an 8-boundary.
2nd UINT32
The serial of this message, used as a cookie by the sender to identify the reply corresponding to this request. This must not be zero.
ARRAY of STRUCT of
(BYTE,VARIANT)
An array of zero or more header fields where the byte is the field code, and the variant is the field value. The message type determines
which fields are required.
INVALID
0 This is an invalid type.
METHOD_CALL
1 Method call.
METHOD_RETURN
2 Method reply with returned data.
ERROR
3 Error reply. If the first argument exists and is a string, it is an error message.
SIGNAL
4 Signal emission.
Hex
value
NO_REPLY_EXPECTED
0x1
This message does not expect method return replies or error replies; the reply can be omitted as an optimization. However, it is
compliant with this specification to return the reply despite this flag and the only harm from doing so is extra network traffic.
NO_AUTO_START
0x2 The bus must not launch an owner for the destination name in response to this message.
Conventional
Name
Decimal
Code
Type Required In Description
INVALID
0 N/A not allowed Not a valid field name (error if it appears in a message)
PATH
1
OBJECT_PATH
METHOD_CALL,
SIGNAL
The object to send a call to, or the object a signal is emitted from. The special
path /org/freedesktop/DBus/Local is reserved; implementations should not send messages with this
path, and the reference implementation of the bus daemon will disconnect any application that attempts to
do so.
INTERFACE
2
STRING SIGNAL
The interface to invoke a method call on, or that a signal is emitted from. Optional for method calls,
required for signals. The special interface org.freedesktop.DBus.Local is reserved; implementations
should not send messages with this interface, and the reference implementation of the bus daemon will
disconnect any application that attempts to do so.
MEMBER
3
STRING
METHOD_CALL,
SIGNAL
The member, either the method name or signal name.
ERROR_NAME
4
STRING ERROR
The name of the error that occurred, for errors
REPLY_SERIAL
5
UINT32
ERROR,
METHOD_RETURN
The serial number of the message this message is a reply to. (The serial number is the second UINT32 in
the header.)
DESTINATION
6
STRING
optional
The name of the connection this message is intended for. Only used in combination with the message bus,
see the section called “Message Bus Specification”.
SENDER
7
STRING
optional
Unique name of the sending connection. The message bus fills in this field so it is reliable; the field is
only meaningful in combination with the message bus.
SIGNATURE
8
SIGNATURE
optional
The signature of the message body. If omitted, it is assumed to be the empty signature "" (i.e. the body
must be 0-length).
UNIX_FDS
9
UINT32
optional
The number of Unix file descriptors that accompany the message. If omitted, it is assumed that no Unix
file descriptors accompany the message. The actual file descriptors need to be transferred via platform
specific mechanism out-of-band. They must be sent at the same time as part of the message itself. They
may not be sent before the first byte of the message itself is transferred or after the last byte of the
message itself.
页码,
http://dbus.freedesktop.org/doc/dbus