message: Add DBusVariant, a way to copy a single message item
authorSimon McVittie <smcv@collabora.com>
Fri, 2 Jun 2017 19:19:56 +0000 (20:19 +0100)
committerSimon McVittie <smcv@collabora.com>
Wed, 5 Jul 2017 15:22:54 +0000 (16:22 +0100)
commitaa5fdac60020d3596e3164a40977e90d8f7000c5
tree01f96ec5572fc2a917cfac0a13e6d0b3c1fc2c2e
parent3444ac400772eed47f19f91d04799363a6d87f4b
message: Add DBusVariant, a way to copy a single message item

For #100344, we will need a way to store the metadata from the
original method call, and copy them back into arbitrarily many
messages later. This would be easy in GDBus, which has GVariant
as a first-class object. However, libdbus doesn't have an object for
message items, only messages.

We could copy the message's content, but it will carry file descriptors,
which we don't want to copy. Instead, introduce an internal object
representing a message item in a small buffer. It is stored as a variant
(D-Bus type 'v') so that it naturally carries its own type.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101568
dbus/dbus-message-internal.h
dbus/dbus-message.c