Array alignment while marshalling data

marcin at saepia.net marcin at saepia.net
Mon May 23 18:46:57 UTC 2016


Hello,

I am writing an implementation of D-Bus Protocol in Elixir (
https://github.com/mspanc/dbux).

I am observing how other implementation marshall messages and I can't
understand the pattern according arrays.

In the docs it's stated that after array length content should be aligned
to the array element's padding.

But when I observe method call to Hello, it looks like the following:

6c:01:00:01: header start
00:00:00:00: body length
01:00:00:00: serial
*6d:00:00:00:* header fields start: array length
01: header type: 1
01:6f:00: variant signature (object_path)
15:00:00:00: string len
2f:6f:72:67:2f:66:72:65: 65:64:65:73 :6b:74:6f:70: 2f:44:42:75:
73:00:00:00: 03:01:73:00: string

and so on

the array length is not aligned to 8 bytes, but to 4 bytes. But type of
this array is struct, which according to the specification should always
align to 8 bytes.

What is the rationale behind this?

Thanks in advance,

Marcin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20160523/2d629082/attachment.html>


More information about the dbus mailing list