From bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 26 Apr 2017 09:36:41 +0200 Subject: sockets: Limit SocketAddressLegacy to external interfaces SocketAddressLegacy 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. SocketAddress is the equivalent flat union. Convert all users of SocketAddressLegacy to SocketAddress, except for existing external interfaces. See also commit fce5d53..9445673 and 85a82e8..c5f1ae3. Signed-off-by: Markus Armbruster Message-Id: <1493192202-3184-7-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake [Minor editing accident fixed, commit message and a comment tweaked] Signed-off-by: Markus Armbruster --- include/io/dns-resolver.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'include/io/dns-resolver.h') diff --git a/include/io/dns-resolver.h b/include/io/dns-resolver.h index aac46cadea..2f69c08c13 100644 --- a/include/io/dns-resolver.h +++ b/include/io/dns-resolver.h @@ -40,15 +40,15 @@ typedef struct QIODNSResolverClass QIODNSResolverClass; * QIODNSResolver: * * The QIODNSResolver class provides a framework for doing - * DNS resolution on SocketAddressLegacy objects, independently + * DNS resolution on SocketAddress objects, independently * of socket creation. * * * Resolving addresses synchronously * - * int mylisten(SocketAddressLegacy *addr, Error **errp) { + * int mylisten(SocketAddress *addr, Error **errp) { * QIODNSResolver *resolver = qio_dns_resolver_get_instance(); - * SocketAddressLegacy **rawaddrs = NULL; + * SocketAddress **rawaddrs = NULL; * size_t nrawaddrs = 0; * Error *err = NULL; * QIOChannel **socks = NULL; @@ -69,7 +69,7 @@ typedef struct QIODNSResolverClass QIODNSResolverClass; * socks = g_renew(QIOChannelSocket *, socks, nsocks + 1); * socks[nsocks++] = sock; * } - * qapi_free_SocketAddressLegacy(rawaddrs[i]); + * qapi_free_SocketAddress(rawaddrs[i]); * } * g_free(rawaddrs); * @@ -95,7 +95,7 @@ typedef struct QIODNSResolverClass QIODNSResolverClass; * MyListenData *data = opaque; * QIODNSResolver *resolver = * QIO_DNS_RESOLVER(qio_task_get_source(task); - * SocketAddressLegacy **rawaddrs = NULL; + * SocketAddress **rawaddrs = NULL; * size_t nrawaddrs = 0; * Error *err = NULL; * @@ -116,7 +116,7 @@ typedef struct QIODNSResolverClass QIODNSResolverClass; * socks = g_renew(QIOChannelSocket *, socks, nsocks + 1); * socks[nsocks++] = sock; * } - * qapi_free_SocketAddressLegacy(rawaddrs[i]); + * qapi_free_SocketAddress(rawaddrs[i]); * } * g_free(rawaddrs); * @@ -127,7 +127,7 @@ typedef struct QIODNSResolverClass QIODNSResolverClass; * } * } * - * void mylisten(SocketAddressLegacy *addr, MyListenData *data) { + * void mylisten(SocketAddress *addr, MyListenData *data) { * QIODNSResolver *resolver = qio_dns_resolver_get_instance(); * qio_dns_resolver_lookup_async(dns, addr, * mylistenresult, data, NULL); @@ -177,9 +177,9 @@ QIODNSResolver *qio_dns_resolver_get_instance(void); * Returns: 0 if resolution was successful, -1 on error */ int qio_dns_resolver_lookup_sync(QIODNSResolver *resolver, - SocketAddressLegacy *addr, + SocketAddress *addr, size_t *naddrs, - SocketAddressLegacy ***addrs, + SocketAddress ***addrs, Error **errp); /** @@ -201,7 +201,7 @@ int qio_dns_resolver_lookup_sync(QIODNSResolver *resolver, * of the caller will not be blocked. */ void qio_dns_resolver_lookup_async(QIODNSResolver *resolver, - SocketAddressLegacy *addr, + SocketAddress *addr, QIOTaskFunc func, gpointer opaque, GDestroyNotify notify); @@ -223,6 +223,6 @@ void qio_dns_resolver_lookup_async(QIODNSResolver *resolver, void qio_dns_resolver_lookup_result(QIODNSResolver *resolver, QIOTask *task, size_t *naddrs, - SocketAddressLegacy ***addrs); + SocketAddress ***addrs); #endif /* QIO_DNS_RESOLVER_H */ -- cgit v1.2.3