From 4ff0807c04fcc239de52a793bceb88e7f3408f3f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 3 Jun 2005 12:45:47 +0000 Subject: * implement reflection (including legacy unicast reflection) * implement a history in the probe scheduler git-svn-id: file:///home/lennart/svn/public/avahi/trunk@92 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-core/address.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'avahi-core/address.c') diff --git a/avahi-core/address.c b/avahi-core/address.c index 34f8581..3484707 100644 --- a/avahi-core/address.c +++ b/avahi-core/address.c @@ -149,3 +149,18 @@ guint16 avahi_port_from_sockaddr(const struct sockaddr* sa) { else return ntohs(((struct sockaddr_in6*) sa)->sin6_port); } + +gboolean avahi_address_is_ipv4_in_ipv6(const AvahiAddress *a) { + static const guint8 ipv4_in_ipv6[] = { + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF }; + + g_assert(a); + + if (a->family != AF_INET6) + return FALSE; + + return memcmp(a->data.ipv6.address, ipv4_in_ipv6, sizeof(ipv4_in_ipv6)) == 0; +} + -- cgit