demarshalling messages
Havoc Pennington
hp at redhat.com
Fri Mar 23 06:03:32 PDT 2007
Hi,
Dafydd Harries wrote:
>
> - get the marshalled form of the DBusMessage so that I can encapsulate it for
> the network transport I'm using
>
> - take a marshalled message from a network transport I have and turn it into
> a DBusMessage object so that I can send it to my local clients
>
OK, I think I see now. You want to be able to serialize DBusMessage so
you can put it over xmpp. As Thiago says, there is no API for that right
now.
The simplest approach would be a two-function API to convert a
DBusMessage to/from a byte array. The downside to this approach is that
you could not use DBusConnection, so might end up reinventing a lot of
that machinery - there is a lot of stuff in there, including e.g. some
default method handlers.
The hard/complicated but possibly better approach would be to allow apps
to provide a DBusTransport (currently a private API), which would
involve cleaning up and opaque-ifying that private API. Then you would
provide a DBusTransport that wraps your xmpp connection.
The bad hack approach, perhaps, would be to create a DBusConnection
around a socketpair() pipe, and serialize/unserialize messages by
pushing them into the pipe then reading the other end. Unfortunately I
think the pipe transport is only compiled into the --enable-tests
version of dbus, not the production build. But for OLPC you could do
your own build.
It's messy any way you look at it, probably.
Havoc
More information about the dbus
mailing list