#include <net/if.h>
#include <stdio.h>
+#include <avahi-common/error.h>
#include <avahi-common/malloc.h>
#include "iface.h"
AvahiHwInterface *hw;
struct rtattr *a = NULL;
size_t l;
-
+
if (ifinfomsg->ifi_family != AF_UNSPEC)
return;
m->list = LIST_ADDR;
} else {
m->list = LIST_DONE;
- avahi_log_debug("Enumeration complete");
+ avahi_log_debug("Network interface enumeration completed");
}
} else if (n->nlmsg_type == NLMSG_ERROR && (n->nlmsg_seq == m->query_link_seq || n->nlmsg_seq == m->query_addr_seq)) {
return 0;
}
+
+int avahi_interface_has_address(AvahiInterfaceMonitor *m, AvahiIfIndex iface, const AvahiAddress *a) {
+ AvahiInterface *i;
+ AvahiInterfaceAddress *j;
+
+ assert(m);
+ assert(iface != AVAHI_IF_UNSPEC);
+ assert(a);
+
+ if (!(i = avahi_interface_monitor_get_interface(m, iface, a->family)))
+ return 0;
+
+ for (j = i->addresses; j; j = j->address_next)
+ if (avahi_address_cmp(a, &j->address) == 0)
+ return 1;
+
+ return 0;
+}