diff options
author | Markus Armbruster | 2017-03-30 19:43:15 +0200 |
---|---|---|
committer | Max Reitz | 2017-04-03 17:11:39 +0200 |
commit | 216411b83967ae19e3c9c520e13ceb8bb383890c (patch) | |
tree | 6b6a983a5e3aeadcf39ed6180287607ff3478d3b /include/qemu | |
parent | qapi-schema: SocketAddressFlat variants 'vsock' and 'fd' (diff) | |
download | qemu-216411b83967ae19e3c9c520e13ceb8bb383890c.tar.gz qemu-216411b83967ae19e3c9c520e13ceb8bb383890c.tar.xz qemu-216411b83967ae19e3c9c520e13ceb8bb383890c.zip |
sockets: New helper socket_address_crumple()
SocketAddress is a simple union, and simple unions are awkward: they
have their variant members wrapped in a "data" object on the wire, and
require additional indirections in C. I intend to limit its use to
existing external interfaces. New ones should use SocketAddressFlat.
I further intend to convert all internal interfaces to
SocketAddressFlat. This helper should go away then.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1490895797-29094-8-git-send-email-armbru@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r-- | include/qemu/sockets.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index 5f1bab9b3e..7842f6d150 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -119,4 +119,15 @@ SocketAddress *socket_remote_address(int fd, Error **errp); */ char *socket_address_to_string(struct SocketAddress *addr, Error **errp); +/** + * socket_address_crumple: + * @addr_flat: the socket address to crumple + * + * Convert SocketAddressFlat to SocketAddress. Caller is responsible + * for freeing with qapi_free_SocketAddress(). + * + * Returns: the argument converted to SocketAddress. + */ +SocketAddress *socket_address_crumple(SocketAddressFlat *addr_flat); + #endif /* QEMU_SOCKETS_H */ |