Re: Wire format examples
Robert Middleton <[email protected]> Thu, 17 Oct 2024 11:17:17 -0400
| Newsgroups | gmane.comp.freedesktop.dbus |
|---|---|
| Message-ID | <CAKpcJVaLSNr6HLRY5Gffc=qsvnbfVhaSc-nfJ3oJA2ej2GW1LQ@mail.gmail.com> |
--0000000000004417a40624adaf33 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable The easiest thing that I have found to do is to run dbus-monitor =E2=80=94p= cap, that will let you view the bus data in wireshark and export packets. In my experience, the parsing itself is not too hard, the fact that you can have nested objects and varied lengths of data is what really trips me up. -Robert Middleton On Thu, Oct 17, 2024 at 10:54=E2=80=AFAM Simon McVittie <smcv-ZGY8ohtN/[email protected]= > wrote: > On Thu, 17 Oct 2024 at 09:09:20 -0400, Link Dupont wrote: > > I=E2=80=99m experimenting with writing a client library from scratch > > (rather than building on libdbus or using bindings to bridge to an > > existing library). I=E2=80=99ve been reading about the Type System[1] a= nd the > > Marshaling Wire Format[2]. There are a few examples in the specificatio= n, > > but in order to verify my marshal/unmarshal logic, I=E2=80=99d like som= e > > more real-world examples of signatures, marshaled message bodies and > > the primitive types they are expected to unmarshal into. Does anyone > > know of a collection of more thorough wire format examples? Or a means > > through which I could generate my own? > > The reference implementation (dbus, the same project that contains libdbu= s) > has a few raw messages in test/data/valid-messages, although currently on= ly > a very small set. The *.hex files contain annotated hexdumps explaining t= he > format in more detail. > > I think there's a merge request open where I added some more, but it got > stalled by discussion of whether the cases I was testing were API > guarantees > or implementation details. > > You can generate a marshalled message most conveniently by calling > dbus_message_marshal() from libdbus or g_dbus_message_to_blob() from GLib= . > > smcv > --0000000000004417a40624adaf33 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div><div dir=3D"auto">The easiest thing that I have found to do is to run = dbus-monitor =E2=80=94pcap, that will let you view the bus data in wireshar= k and export packets.</div></div><div dir=3D"auto"><br></div><div dir=3D"au= to">In my experience, the parsing itself is not too hard, the fact that you= can have nested objects and varied lengths of data is what really trips me= up.</div><div><div dir=3D"auto"><br></div><div dir=3D"auto">-Robert Middle= ton</div><div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmai= l_attr">On Thu, Oct 17, 2024 at 10:54=E2=80=AFAM Simon McVittie <<a href= =3D"mailto:smcv-ZGY8ohtN/[email protected]" target=3D"_blank">smcv-ZGY8ohtN/[email protected]</a>>= wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8= ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, 17 Oct 2024 at 09:0= 9:20 -0400, Link Dupont wrote:<br> > I=E2=80=99m experimenting with writing a client library from scratch<b= r> > (rather than building on libdbus or using bindings to bridge to an<br> > existing library). I=E2=80=99ve been reading about the Type System[1] = and the<br> > Marshaling Wire Format[2]. There are a few examples in the specificati= on,<br> > but in order to verify my marshal/unmarshal logic, I=E2=80=99d like so= me<br> > more real-world examples of signatures, marshaled message bodies and<b= r> > the primitive types they are expected to unmarshal into. Does anyone<b= r> > know of a collection of more thorough wire format examples? Or a means= <br> > through which I could generate my own?<br> <br> The reference implementation (dbus, the same project that contains libdbus)= <br> has a few raw messages in test/data/valid-messages, although currently only= <br> a very small set. The *.hex files contain annotated hexdumps explaining the= <br> format in more detail.<br> <br> I think there's a merge request open where I added some more, but it go= t<br> stalled by discussion of whether the cases I was testing were API guarantee= s<br> or implementation details.<br> <br> You can generate a marshalled message most conveniently by calling<br> dbus_message_marshal() from libdbus or g_dbus_message_to_blob() from GLib.<= br> <br> =C2=A0 =C2=A0 smcv<br> </blockquote></div></div> </div> --0000000000004417a40624adaf33--