dbus_message_demarshal() and partial messages
Thiago Macieira
thiago at kde.org
Tue Aug 14 16:18:23 PDT 2007
Avery Pennarun wrote:
>I thought of that option, however, I can see value in staying 100% the
>same as the DBus protocol. For example, I can make the SSL part
>optional and when it's disabled, use standard DBus tools/library to
>debug my code.
>
>It seems odd that the dbus library provides almost, but not quite,
>enough API for me to implement the DBus protocol using its DBusMessage
>implementation.
>
>After more digging around, I've found
>_dbus_header_have_message_untrusted(). A slight variation on this
>function (a normal program has no need for most of the information it
>returns) would be great to add to the api.
>
>With something like that available, we unlock the real usefulness of
>dbus_message_demarshal().
Providing such a function would be quite easy.
All you need is a function that takes a buffer and its length and returns
the length of the first message in it.
Return values would be:
0 -> impossible to determine, buffer is too small
-1 -> error happened, message/buffer is corrupted
x>0 -> length of the message
Mind you that x can be smaller than, equal to or larger than the buffer
you already have. If it's smaller, you have to read more before you can
demarshall. If it's larger, then you have the beginning of the next
message already.
I can't come up with a name for it. It seems wrong to me to use
dbus_message_* because it doesn't actually operate on a message...
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20070815/f4b33b95/attachment.pgp
More information about the dbus
mailing list