]> git.meshlink.io Git - catta/commitdiff
Make AVAHI_PROTO_xxx well defined constants
authorLennart Poettering <lennart@poettering.net>
Fri, 16 Sep 2005 01:19:32 +0000 (01:19 +0000)
committerLennart Poettering <lennart@poettering.net>
Fri, 16 Sep 2005 01:19:32 +0000 (01:19 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@595 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-common/address.c
avahi-common/address.h
avahi-core/iface.c
avahi-core/resolve-address.c
avahi-core/resolve-host-name.c
avahi-core/resolve-service.c
avahi-core/server.c
avahi-core/socket.c
avahi-daemon/dbus-protocol.c

index 50224edbc1277788425779876ebc72dd6efd85f0..8c4dd38f3a1c331a8e81ca685c790cff8157e314 100644 (file)
@@ -35,9 +35,9 @@
 size_t avahi_address_get_size(const AvahiAddress *a) {
     assert(a);
 
-    if (a->family == AVAHI_PROTO_INET)
+    if (a->proto == AVAHI_PROTO_INET)
         return 4;
-    else if (a->family == AVAHI_PROTO_INET6)
+    else if (a->proto == AVAHI_PROTO_INET6)
         return 16;
 
     return 0;
@@ -47,7 +47,7 @@ int avahi_address_cmp(const AvahiAddress *a, const AvahiAddress *b) {
     assert(a);
     assert(b);
     
-    if (a->family != b->family)
+    if (a->proto != b->proto)
         return -1;
 
     return memcmp(a->data.data, b->data.data, avahi_address_get_size(a));
@@ -58,7 +58,7 @@ char *avahi_address_snprint(char *s, size_t length, const AvahiAddress *a) {
     assert(length);
     assert(a);
     
-    return (char*) inet_ntop(a->family, a->data.data, s, length);
+    return (char*) inet_ntop(avahi_proto_to_af(a->proto), a->data.data, s, length);
 }
 
 char* avahi_reverse_lookup_name_ipv4(const AvahiIPv4Address *a) {
@@ -114,23 +114,23 @@ char *avahi_reverse_lookup_name_ipv6_int(const AvahiIPv6Address *a) {
     return reverse_lookup_name_ipv6(a, "ip6.int");
 }
 
-AvahiAddress *avahi_address_parse(const char *s, AvahiProtocol family, AvahiAddress *ret_addr) {
+AvahiAddress *avahi_address_parse(const char *s, AvahiProtocol proto, AvahiAddress *ret_addr) {
     assert(ret_addr);
     assert(s);
 
-    if (family == AVAHI_PROTO_UNSPEC) {
+    if (proto == AVAHI_PROTO_UNSPEC) {
         if (inet_pton(AF_INET, s, ret_addr->data.data) <= 0) {
             if (inet_pton(AF_INET6, s, ret_addr->data.data) <= 0)
                 return NULL;
             else
-                ret_addr->family = AVAHI_PROTO_INET6;
+                ret_addr->proto = AVAHI_PROTO_INET6;
         } else
-            ret_addr->family = AVAHI_PROTO_INET;
+            ret_addr->proto = AVAHI_PROTO_INET;
     } else {
-        if (inet_pton(family, s, ret_addr->data.data) <= 0)
+        if (inet_pton(avahi_proto_to_af(proto), s, ret_addr->data.data) <= 0)
             return NULL;
         
-        ret_addr->family = family;
+        ret_addr->proto = proto;
     }
     
     return ret_addr;
@@ -142,7 +142,7 @@ AvahiAddress *avahi_address_from_sockaddr(const struct sockaddr* sa, AvahiAddres
 
     assert(sa->sa_family == AF_INET || sa->sa_family == AF_INET6);
 
-    ret_addr->family = sa->sa_family;
+    ret_addr->proto = avahi_af_to_proto(sa->sa_family);
 
     if (sa->sa_family == AF_INET)
         memcpy(&ret_addr->data.ipv4, &((const struct sockaddr_in*) sa)->sin_addr, sizeof(ret_addr->data.ipv4));
@@ -173,9 +173,38 @@ int avahi_address_is_ipv4_in_ipv6(const AvahiAddress *a) {
     
     assert(a);
 
-    if (a->family != AVAHI_PROTO_INET6)
+    if (a->proto != AVAHI_PROTO_INET6)
         return 0;
 
     return memcmp(a->data.ipv6.address, ipv4_in_ipv6, sizeof(ipv4_in_ipv6)) == 0;
 }
 
+int avahi_proto_to_af(AvahiProtocol proto) {
+    if (proto == AVAHI_PROTO_INET)
+        return AF_INET;
+    if (proto == AVAHI_PROTO_INET6)
+        return AF_INET6;
+
+    assert(proto == AVAHI_PROTO_UNSPEC);
+    return AF_UNSPEC;
+}
+
+AvahiProtocol avahi_af_to_proto(int af) {
+    if (af == AF_INET)
+        return AVAHI_PROTO_INET;
+    if (af == AF_INET6)
+        return AVAHI_PROTO_INET6;
+
+    assert(af == AF_UNSPEC);
+    return AVAHI_PROTO_UNSPEC;
+}
+
+const char* avahi_proto_to_string(AvahiProtocol proto) {
+    if (proto == AVAHI_PROTO_INET)
+        return "IPv4";
+    if (proto == AVAHI_PROTO_INET6)
+        return "IPv6";
+
+    assert(proto == AVAHI_PROTO_UNSPEC);
+    return "UNSPEC";
+}
index 60495a327c71ab1c594e6c09e8c539f565c13332..c5e529713bfc430ecf5cabbd405be2f07fb2f505 100644 (file)
 AVAHI_C_DECL_BEGIN
 
 /** Protocol family specification, takes the values AVAHI_INET, AVAHI_INET6, AVAHI_UNSPEC */
-typedef unsigned char AvahiProtocol;
+typedef char AvahiProtocol;
 
 /** Numeric network interface index. Takes OS dependent values and the special constant AVAHI_IF_UNSPEC  */
 typedef int AvahiIfIndex;
 
 /** Values for AvahiProtocol */
 enum {
-    AVAHI_PROTO_INET = AF_INET,     /**< IPv4 */
-    AVAHI_PROTO_INET6 = AF_INET6,   /**< IPv6 */
-    AVAHI_PROTO_UNSPEC = AF_UNSPEC  /**< Unspecified/all protocol(s) */
+    AVAHI_PROTO_INET = 0,     /**< IPv4 */
+    AVAHI_PROTO_INET6 = 1,   /**< IPv6 */
+    AVAHI_PROTO_UNSPEC = -1  /**< Unspecified/all protocol(s) */
 };
 
 /** Special values for AvahiIfIndex */
@@ -61,7 +61,7 @@ typedef struct {
 
 /** Protocol (address family) independent address structure */
 typedef struct {
-    AvahiProtocol family; /**< Address family */
+    AvahiProtocol proto; /**< Address family */
 
     union {
         AvahiIPv6Address ipv6;  /** Address when IPv6 */
@@ -103,6 +103,15 @@ char* avahi_reverse_lookup_name_ipv6_int(const AvahiIPv6Address *a);
  * encapsulated IPv4 address, returns 1 if yes, 0 otherwise */
 int avahi_address_is_ipv4_in_ipv6(const AvahiAddress *a);
 
+/** Map AVAHI_PROTO_xxx constants to Unix AF_xxx constants */
+int avahi_proto_to_af(AvahiProtocol proto);
+
+/** Map Unix AF_xxx constants to AVAHI_PROTO_xxx constants */
+AvahiProtocol avahi_af_to_proto(int af);
+
+/** Return a textual representation of the specified protocol number. i.e. "IPv4", "IPv6" or "UNSPEC" */
+const char* avahi_proto_to_string(AvahiProtocol proto);
+
 AVAHI_C_DECL_END
 
 #endif
index 38d9909cb28c6d91a7490676b14712a7e6a2b569..1692938e6c5aab60d3f0c6c072e8312c9dee099a 100644 (file)
@@ -243,7 +243,7 @@ static int netlink_list_items(AvahiNetlink *nl, uint16_t type, unsigned *ret_seq
     n = (struct nlmsghdr*) req;
     n->nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg));
     n->nlmsg_type = type;
-    n->nlmsg_flags = NLM_F_ROOT/*|NLM_F_MATCH*/|NLM_F_REQUEST;
+    n->nlmsg_flags = NLM_F_ROOT|NLM_F_REQUEST;
     n->nlmsg_pid = 0;
 
     gen = NLMSG_DATA(n);
@@ -307,7 +307,7 @@ static void check_interface_relevant(AvahiInterfaceMonitor *m, AvahiInterface *i
     b = avahi_interface_relevant(i);
 
     if (m->list == LIST_DONE && b && !i->announcing) {
-        avahi_log_info("New relevant interface %s.%i.", i->hardware->name, i->protocol);
+        avahi_log_info("New relevant interface %s.%s.", i->hardware->name, avahi_proto_to_string(i->protocol));
 
         if (i->protocol == AVAHI_PROTO_INET)
             avahi_mdns_mcast_join_ipv4(m->server->fd_ipv4, i->hardware->index);
@@ -318,7 +318,7 @@ static void check_interface_relevant(AvahiInterfaceMonitor *m, AvahiInterface *i
         avahi_announce_interface(m->server, i);
         avahi_browser_new_interface(m->server, i);
     } else if (!b && i->announcing) {
-        avahi_log_info("Interface %s.%i no longer relevant.", i->hardware->name, i->protocol);
+        avahi_log_info("Interface %s.%s no longer relevant.", i->hardware->name, avahi_proto_to_string(i->protocol));
 
         if (i->protocol == AVAHI_PROTO_INET)
             avahi_mdns_mcast_leave_ipv4(m->server->fd_ipv4, i->hardware->index);
@@ -450,13 +450,13 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
         AvahiAddress raddr;
         int raddr_valid = 0;
 
-        if (ifaddrmsg->ifa_family != AVAHI_PROTO_INET && ifaddrmsg->ifa_family != AVAHI_PROTO_INET6)
+        if (ifaddrmsg->ifa_family != AF_INET && ifaddrmsg->ifa_family != AF_INET6)
             return;
 
-        if (!(i = (AvahiInterface*) avahi_interface_monitor_get_interface(m, (AvahiIfIndex) ifaddrmsg->ifa_index, (AvahiProtocol) ifaddrmsg->ifa_family)))
+        if (!(i = (AvahiInterface*) avahi_interface_monitor_get_interface(m, (AvahiIfIndex) ifaddrmsg->ifa_index, avahi_af_to_proto(ifaddrmsg->ifa_family))))
             return;
 
-        raddr.family = (AvahiProtocol) ifaddrmsg->ifa_family;
+        raddr.proto = avahi_af_to_proto(ifaddrmsg->ifa_family);
 
         l = NLMSG_PAYLOAD(n, sizeof(struct ifaddrmsg));
         a = IFA_RTA(ifaddrmsg);
@@ -465,8 +465,8 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
 
             switch(a->rta_type) {
                 case IFA_ADDRESS:
-                    if ((raddr.family == AVAHI_PROTO_INET6 && RTA_PAYLOAD(a) != 16) ||
-                        (raddr.family == AVAHI_PROTO_INET && RTA_PAYLOAD(a) != 4))
+                    if ((raddr.proto == AVAHI_PROTO_INET6 && RTA_PAYLOAD(a) != 16) ||
+                        (raddr.proto == AVAHI_PROTO_INET && RTA_PAYLOAD(a) != 4))
                         return;
 
                     memcpy(raddr.data.data, RTA_DATA(a), RTA_PAYLOAD(a));
@@ -630,7 +630,7 @@ void avahi_interface_send_packet_unicast(AvahiInterface *i, AvahiDnsPacket *p, c
     if (!avahi_interface_relevant(i))
         return;
     
-    assert(!a || a->family == i->protocol);
+    assert(!a || a->proto == i->protocol);
 
 /*     if (a) */
 /*         avahi_log_debug("unicast sending on '%s.%i' to %s:%u", i->hardware->name, i->protocol, avahi_address_snprint(t, sizeof(t), a), port); */
@@ -687,7 +687,7 @@ int avahi_dump_caches(AvahiInterfaceMonitor *m, AvahiDumpCallback callback, void
     for (i = m->interfaces; i; i = i->interface_next) {
         if (avahi_interface_relevant(i)) {
             char ln[256];
-            snprintf(ln, sizeof(ln), ";;; INTERFACE %s.%i ;;;", i->hardware->name, i->protocol);
+            snprintf(ln, sizeof(ln), ";;; INTERFACE %s.%s ;;;", i->hardware->name, avahi_proto_to_string(i->protocol));
             callback(ln, userdata);
             if (avahi_cache_dump(i->cache, callback, userdata) < 0)
                 return -1;
@@ -825,12 +825,12 @@ int avahi_interface_address_on_link(AvahiInterface *i, const AvahiAddress *a) {
     assert(i);
     assert(a);
 
-    if (a->family != i->protocol)
+    if (a->proto != i->protocol)
         return 0;
 
     for (ia = i->addresses; ia; ia = ia->address_next) {
 
-        if (a->family == AVAHI_PROTO_INET) {
+        if (a->proto == AVAHI_PROTO_INET) {
             uint32_t m;
             
             m = ~(((uint32_t) -1) >> ia->prefix_len);
@@ -840,7 +840,7 @@ int avahi_interface_address_on_link(AvahiInterface *i, const AvahiAddress *a) {
         } else {
             unsigned j;
             unsigned char pl;
-            assert(a->family == AVAHI_PROTO_INET6);
+            assert(a->proto == AVAHI_PROTO_INET6);
 
             pl = ia->prefix_len;
             
@@ -875,7 +875,7 @@ int avahi_interface_has_address(AvahiInterfaceMonitor *m, AvahiIfIndex iface, co
     assert(iface != AVAHI_IF_UNSPEC);
     assert(a);
 
-    if (!(i = avahi_interface_monitor_get_interface(m, iface, a->family)))
+    if (!(i = avahi_interface_monitor_get_interface(m, iface, a->proto)))
         return 0;
 
     for (j = i->addresses; j; j = j->address_next)
index 18c862c1cc9639a987080f40c7cfa756f5700439..d5fe74374107cb2c0ae1a4284b7ac894b32d0ed5 100644 (file)
@@ -141,9 +141,9 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(AvahiServer *server, AvahiIf
     assert(address);
     assert(callback);
 
-    assert(address->family == AVAHI_PROTO_INET || address->family == AVAHI_PROTO_INET6);
+    assert(address->proto == AVAHI_PROTO_INET || address->proto == AVAHI_PROTO_INET6);
 
-    if (address->family == AVAHI_PROTO_INET)
+    if (address->proto == AVAHI_PROTO_INET)
         n = avahi_reverse_lookup_name_ipv4(&address->data.ipv4);
     else 
         n = avahi_reverse_lookup_name_ipv6_arpa(&address->data.ipv6);
index d9c334126bfd48766c06ef2c7736f7cbcd6db5d3..7bb5727bb4d6dc7e324ffbbbf37f8315921b1466 100644 (file)
@@ -72,12 +72,12 @@ static void finish(AvahiSHostNameResolver *r, AvahiResolverEvent event) {
     
         switch (r->address_record->key->type) {
             case AVAHI_DNS_TYPE_A:
-                a.family = AVAHI_PROTO_INET;
+                a.proto = AVAHI_PROTO_INET;
                 a.data.ipv4 = r->address_record->data.a.address;
                 break;
                 
             case AVAHI_DNS_TYPE_AAAA:
-                a.family = AVAHI_PROTO_INET6;
+                a.proto = AVAHI_PROTO_INET6;
                 a.data.ipv6 = r->address_record->data.aaaa.address;
                 break;
                 
index 6dbca40ee2726df25f5a78bc982973b383b6563a..0ecd388bda8681248fd4acc3981c639a55a9f07f 100644 (file)
@@ -84,12 +84,12 @@ static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
         
         switch (r->address_record->key->type) {
             case AVAHI_DNS_TYPE_A:
-                a.family = AVAHI_PROTO_INET;
+                a.proto = AVAHI_PROTO_INET;
                 a.data.ipv4 = r->address_record->data.a.address;
                 break;
                 
             case AVAHI_DNS_TYPE_AAAA:
-                a.family = AVAHI_PROTO_INET6;
+                a.proto = AVAHI_PROTO_INET6;
                 a.data.ipv6 = r->address_record->data.aaaa.address;
                 break;
                 
index 11deb249d9f2a4ebd2e88d561f2680f5822583e1..c74628757e24854e78dfd1e1d72b2cdb0fb54424 100644 (file)
@@ -814,7 +814,7 @@ static void reflect_legacy_unicast_query_packet(AvahiServer *s, AvahiDnsPacket *
     assert(i);
     assert(a);
     assert(port > 0);
-    assert(i->protocol == a->family);
+    assert(i->protocol == a->proto);
     
     if (!s->config.enable_reflector)
         return;
@@ -902,7 +902,7 @@ static int is_mdns_mcast_address(const AvahiAddress *a) {
     AvahiAddress b;
     assert(a);
 
-    avahi_address_parse(a->family == AVAHI_PROTO_INET ? AVAHI_IPV4_MCAST_GROUP : AVAHI_IPV6_MCAST_GROUP, a->family, &b);
+    avahi_address_parse(a->proto == AVAHI_PROTO_INET ? AVAHI_IPV4_MCAST_GROUP : AVAHI_IPV6_MCAST_GROUP, a->proto, &b);
     return avahi_address_cmp(a, &b) == 0;
 }
 
@@ -930,7 +930,7 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const struct sock
     assert(dest);
     assert(iface > 0);
 
-    if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, sa->sa_family)) ||
+    if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, avahi_af_to_proto(sa->sa_family))) ||
         !avahi_interface_relevant(i)) {
         avahi_log_warn("Recieved packet from invalid interface.");
         return;
@@ -1024,7 +1024,7 @@ static void dispatch_legacy_unicast_packet(AvahiServer *s, AvahiDnsPacket *p, co
     assert(sa);
     assert(iface > 0);
 
-    if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, sa->sa_family)) ||
+    if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, avahi_af_to_proto(sa->sa_family))) ||
         !avahi_interface_relevant(i)) {
         avahi_log_warn("Recieved packet from invalid interface.");
         return;
@@ -1049,7 +1049,7 @@ static void dispatch_legacy_unicast_packet(AvahiServer *s, AvahiDnsPacket *p, co
         return;
     }
 
-    if (!(j = avahi_interface_monitor_get_interface(s->monitor, slot->interface, slot->address.family)) ||
+    if (!(j = avahi_interface_monitor_get_interface(s->monitor, slot->interface, slot->address.proto)) ||
         !avahi_interface_relevant(j))
         return;
 
@@ -1078,27 +1078,27 @@ static void socket_event(AvahiWatch *w, int fd, AvahiWatchEvent events, void *us
     if (events & AVAHI_WATCH_IN) {
     
         if (fd == s->fd_ipv4) {
-            dest.family = AVAHI_PROTO_INET;
+            dest.proto = AVAHI_PROTO_INET;
             if ((p = avahi_recv_dns_packet_ipv4(s->fd_ipv4, &sa, &dest.data.ipv4, &iface, &ttl))) {
                 dispatch_packet(s, p, (struct sockaddr*) &sa, &dest, iface, ttl);
                 avahi_dns_packet_free(p);
             }
         } else if (fd == s->fd_ipv6) {
-            dest.family = AVAHI_PROTO_INET6;
+            dest.proto = AVAHI_PROTO_INET6;
 
             if ((p = avahi_recv_dns_packet_ipv6(s->fd_ipv6, &sa6, &dest.data.ipv6, &iface, &ttl))) {
                 dispatch_packet(s, p, (struct sockaddr*) &sa6, &dest, iface, ttl);
                 avahi_dns_packet_free(p);
             }
         } else if (fd == s->fd_legacy_unicast_ipv4) {
-            dest.family = AVAHI_PROTO_INET;
+            dest.proto = AVAHI_PROTO_INET;
             
             if ((p = avahi_recv_dns_packet_ipv4(s->fd_legacy_unicast_ipv4, &sa, &dest.data.ipv4, &iface, &ttl))) {
                 dispatch_legacy_unicast_packet(s, p, (struct sockaddr*) &sa, iface, ttl);
                 avahi_dns_packet_free(p);
             }
         } else if (fd == s->fd_legacy_unicast_ipv6) {
-            dest.family = AVAHI_PROTO_INET6;
+            dest.proto = AVAHI_PROTO_INET6;
             
             if ((p = avahi_recv_dns_packet_ipv6(s->fd_legacy_unicast_ipv6, &sa6, &dest.data.ipv6, &iface, &ttl))) {
                 dispatch_legacy_unicast_packet(s, p, (struct sockaddr*) &sa6, iface, ttl);
@@ -1686,7 +1686,7 @@ int avahi_server_add_address(
         goto fail;
     }
     
-    if (a->family == AVAHI_PROTO_INET) {
+    if (a->proto == AVAHI_PROTO_INET) {
         char *reverse;
         AvahiRecord  *r;
 
@@ -1714,7 +1714,7 @@ int avahi_server_add_address(
         char *reverse;
         AvahiRecord *r;
 
-        assert(a->family == AVAHI_PROTO_INET6);
+        assert(a->proto == AVAHI_PROTO_INET6);
             
         if (!(r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA, AVAHI_DEFAULT_TTL_HOST_NAME))) {
             ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
@@ -2064,7 +2064,7 @@ int avahi_server_add_dns_server_address(
     assert(s);
     assert(address);
     assert(type == AVAHI_DNS_SERVER_UPDATE || type == AVAHI_DNS_SERVER_RESOLVE);
-    assert(address->family == AVAHI_PROTO_INET || address->family == AVAHI_PROTO_INET6);
+    assert(address->proto == AVAHI_PROTO_INET || address->proto == AVAHI_PROTO_INET6);
 
     if (port == 0)
         return avahi_server_set_errno(s, AVAHI_ERR_INVALID_PORT);
@@ -2072,7 +2072,7 @@ int avahi_server_add_dns_server_address(
     if (domain && !avahi_is_valid_domain_name(domain))
         return avahi_server_set_errno(s, AVAHI_ERR_INVALID_DOMAIN_NAME);
 
-    if (address->family == AVAHI_PROTO_INET) {
+    if (address->proto == AVAHI_PROTO_INET) {
         hexstring(n+3, sizeof(n)-3, &address->data, 4);
         r = avahi_record_new_full(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A, AVAHI_DEFAULT_TTL_HOST_NAME);
         r->data.a.address = address->data.ipv4;
index b2d6e6fb08e098ecbb304416fbe331497b6be9e8..91cbf40a0962276b67b5dd9b43812c0aaabc1b9e 100644 (file)
@@ -397,7 +397,7 @@ int avahi_send_dns_packet_ipv4(int fd, int interface, AvahiDnsPacket *p, const A
     msg.msg_controllen = sizeof(cmsg_data);
     msg.msg_flags = 0;
 
-    return sendmsg_loop(fd, &msg, 0 /*MSG_DONTROUTE*/);
+    return sendmsg_loop(fd, &msg, 0);
 }
 
 int avahi_send_dns_packet_ipv6(int fd, int interface, AvahiDnsPacket *p, const AvahiIPv6Address *a, uint16_t port) {
index 1e69916d3969c8d4cf0ad57284c7bea7b939c292..d817038403669aee4b75282dbab14cafcec6f7c2 100644 (file)
@@ -877,7 +877,7 @@ static void sync_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfI
 
         i_interface = (int32_t) interface;
         i_protocol = (int32_t) protocol;
-        i_aprotocol = (int32_t) a->family;
+        i_aprotocol = (int32_t) a->proto;
         
         reply = dbus_message_new_method_return(i->message);
         dbus_message_append_args(
@@ -917,7 +917,7 @@ static void sync_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfInde
 
         i_interface = (int32_t) interface;
         i_protocol = (int32_t) protocol;
-        i_aprotocol = (int32_t) address->family;
+        i_aprotocol = (int32_t) address->proto;
         
         reply = dbus_message_new_method_return(i->message);
         dbus_message_append_args(
@@ -1201,7 +1201,7 @@ static void sync_service_resolver_callback(
 
         i_interface = (int32_t) interface;
         i_protocol = (int32_t) protocol;
-        i_aprotocol = (int32_t) a->family;
+        i_aprotocol = (int32_t) a->proto;
 
         reply = dbus_message_new_method_return(i->message);
         dbus_message_append_args(
@@ -1247,7 +1247,7 @@ static void async_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfInd
 
         i_interface = (int32_t) interface;
         i_protocol = (int32_t) protocol;
-        i_aprotocol = (int32_t) address->family;
+        i_aprotocol = (int32_t) address->proto;
         
         reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, "Found");
         dbus_message_append_args(
@@ -1331,7 +1331,7 @@ static void async_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIf
 
         i_interface = (int32_t) interface;
         i_protocol = (int32_t) protocol;
-        i_aprotocol = (int32_t) a->family;
+        i_aprotocol = (int32_t) a->proto;
         
         reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, "Found");
         dbus_message_append_args(
@@ -1429,7 +1429,7 @@ static void async_service_resolver_callback(
 
         i_interface = (int32_t) interface;
         i_protocol = (int32_t) protocol;
-        i_aprotocol = (int32_t) a->family;
+        i_aprotocol = (int32_t) a->proto;
 
         reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, "Found");
         dbus_message_append_args(