summaryrefslogtreecommitdiffstats
path: root/avahi-core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-09-16 01:19:32 +0000
committerLennart Poettering <lennart@poettering.net>2005-09-16 01:19:32 +0000
commit907bf2598220828a50b22cc00395524bb74feb8e (patch)
treebf5d8cd4f8a41afd5ce662806e7b8d054131c042 /avahi-core
parentf558c2b609d2cc261d562e09e70fb2c69187e78f (diff)
Make AVAHI_PROTO_xxx well defined constants
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@595 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-core')
-rw-r--r--avahi-core/iface.c28
-rw-r--r--avahi-core/resolve-address.c4
-rw-r--r--avahi-core/resolve-host-name.c4
-rw-r--r--avahi-core/resolve-service.c4
-rw-r--r--avahi-core/server.c26
-rw-r--r--avahi-core/socket.c2
6 files changed, 34 insertions, 34 deletions
diff --git a/avahi-core/iface.c b/avahi-core/iface.c
index 38d9909..1692938 100644
--- a/avahi-core/iface.c
+++ b/avahi-core/iface.c
@@ -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)
diff --git a/avahi-core/resolve-address.c b/avahi-core/resolve-address.c
index 18c862c..d5fe743 100644
--- a/avahi-core/resolve-address.c
+++ b/avahi-core/resolve-address.c
@@ -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);
diff --git a/avahi-core/resolve-host-name.c b/avahi-core/resolve-host-name.c
index d9c3341..7bb5727 100644
--- a/avahi-core/resolve-host-name.c
+++ b/avahi-core/resolve-host-name.c
@@ -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;
diff --git a/avahi-core/resolve-service.c b/avahi-core/resolve-service.c
index 6dbca40..0ecd388 100644
--- a/avahi-core/resolve-service.c
+++ b/avahi-core/resolve-service.c
@@ -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;
diff --git a/avahi-core/server.c b/avahi-core/server.c
index 11deb24..c746287 100644
--- a/avahi-core/server.c
+++ b/avahi-core/server.c
@@ -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;
diff --git a/avahi-core/socket.c b/avahi-core/socket.c
index b2d6e6f..91cbf40 100644
--- a/avahi-core/socket.c
+++ b/avahi-core/socket.c
@@ -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) {