DBus wire message format question

Holger Schröder schroder at kde.org
Sat Jun 13 06:28:10 PDT 2009


Hi list,

i try to understand the dbus wire message format. this is an example
message which i logged with wireshark when connecting to a local
dbus-daemon via tcp. this is with dbus version 1.2.4.

i already understand most of it, but the padding
of the variants after the bytes is not clear to me.

000000D9  6c 01 00 01 00 00 00 00  01 00 00 00 6e 00 00 00 l....... ....n...
000000E9  01 01 6f 00 15 00 00 00  2f 6f 72 67 2f 66 72 65 ..o..... /org/fre
000000F9  65 64 65 73 6b 74 6f 70  2f 44 42 75 73 00 00 00 edesktop /DBus...
00000109  06 01 73 00 14 00 00 00  6f 72 67 2e 66 72 65 65 ..s..... org.free
00000119  64 65 73 6b 74 6f 70 2e  44 42 75 73 00 00 00 00 desktop. DBus....
00000129  02 01 73 00 14 00 00 00  6f 72 67 2e 66 72 65 65 ..s..... org.free
00000139  64 65 73 6b 74 6f 70 2e  44 42 75 73 00 00 00 00 desktop. DBus....
00000149  03 01 73 00 05 00 00 00  48 65 6c 6c 6f 00 00 00 ..s..... Hello...

the D-Bus Specification Version 0.12 says:

signature of message header: yyyyuua(yv), so te followin message is of type 
(yv) aka struct of byte, variant. the first byte in that snippet,
01 gives the PATH, and the third byte 6f seems to give the type of the
variant, which is o for Object Path.

000000E9  01                  // header field -> PATH
             01               // where does this come from ???
                6f            // 'o' for object path
                   00         // padding 
		      15 00 00 00  2f 6f 72 67 2f 66 72 65 ..o..... /org/fre
000000F9  65 64 65 73 6b 74 6f 70  2f 44 42 75 73 00 00 00 edesktop /DBus...


but what does the second byte 01 mean ? according to the spec, a variant is
aligned to 1, so the 6f for 'o' should already be at the second byte instead
of the third.


Can somebody tell me, if i interpret the spec in a wrong way, or if the
alignment of a variant is really 2 instead of 1 as stated in the spec ?


kind regards, Holger Schröder


More information about the dbus mailing list