diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-05-10 20:11:18 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-05-10 20:11:18 +0000 |
commit | 602a2b6481587b7da2594db39151ec9380f276df (patch) | |
tree | cf41933a1abc3dd0a79e1d18146ceaf9ec99f5b7 /avahi-core/iface.c | |
parent | c650dc3616bd6cd55c5ebbe84cf80d7e042aac45 (diff) |
* abstract MTU stuff for packet generation
* unicast response support
* legacy unicast support
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@66 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-core/iface.c')
-rw-r--r-- | avahi-core/iface.c | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/avahi-core/iface.c b/avahi-core/iface.c index 13ffcef..9ac4493 100644 --- a/avahi-core/iface.c +++ b/avahi-core/iface.c @@ -472,43 +472,62 @@ AvahiHwInterface* avahi_interface_monitor_get_hw_interface(AvahiInterfaceMonitor } -void avahi_interface_send_packet(AvahiInterface *i, AvahiDnsPacket *p) { +void avahi_interface_send_packet_unicast(AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, guint16 port) { g_assert(i); g_assert(p); + char t[64]; - if (avahi_interface_relevant(i)) { - g_message("sending on '%s.%i'", i->hardware->name, i->protocol); + if (!avahi_interface_relevant(i)) + return; + + g_assert(!a || a->family == i->protocol); - if (i->protocol == AF_INET && i->monitor->server->fd_ipv4 >= 0) - avahi_send_dns_packet_ipv4(i->monitor->server->fd_ipv4, i->hardware->index, p); - else if (i->protocol == AF_INET6 && i->monitor->server->fd_ipv6 >= 0) - avahi_send_dns_packet_ipv6(i->monitor->server->fd_ipv6, i->hardware->index, p); - } + if (a) + g_message("unicast sending on '%s.%i' to %s:%u", i->hardware->name, i->protocol, avahi_address_snprint(t, sizeof(t), a), port); + else + g_message("multicast sending on '%s.%i'", i->hardware->name, i->protocol); + + if (i->protocol == AF_INET && i->monitor->server->fd_ipv4 >= 0) + avahi_send_dns_packet_ipv4(i->monitor->server->fd_ipv4, i->hardware->index, p, a ? &a->data.ipv4 : NULL, port); + else if (i->protocol == AF_INET6 && i->monitor->server->fd_ipv6 >= 0) + avahi_send_dns_packet_ipv6(i->monitor->server->fd_ipv6, i->hardware->index, p, a ? &a->data.ipv6 : NULL, port); +} + +void avahi_interface_send_packet(AvahiInterface *i, AvahiDnsPacket *p) { + g_assert(i); + g_assert(p); + + avahi_interface_send_packet_unicast(i, p, NULL, 0); } -void avahi_interface_post_query(AvahiInterface *i, AvahiKey *key, gboolean immediately) { +gboolean avahi_interface_post_query(AvahiInterface *i, AvahiKey *key, gboolean immediately) { g_assert(i); g_assert(key); if (avahi_interface_relevant(i)) - avahi_packet_scheduler_post_query(i->scheduler, key, immediately); -} + return avahi_packet_scheduler_post_query(i->scheduler, key, immediately); + return FALSE; +} -void avahi_interface_post_response(AvahiInterface *i, const AvahiAddress *a, AvahiRecord *record, gboolean flush_cache, gboolean immediately) { +gboolean avahi_interface_post_response(AvahiInterface *i, const AvahiAddress *a, AvahiRecord *record, gboolean flush_cache, gboolean immediately) { g_assert(i); g_assert(record); if (avahi_interface_relevant(i)) - avahi_packet_scheduler_post_response(i->scheduler, a, record, flush_cache, immediately); + return avahi_packet_scheduler_post_response(i->scheduler, a, record, flush_cache, immediately); + + return FALSE; } -void avahi_interface_post_probe(AvahiInterface *i, AvahiRecord *record, gboolean immediately) { +gboolean avahi_interface_post_probe(AvahiInterface *i, AvahiRecord *record, gboolean immediately) { g_assert(i); g_assert(record); if (avahi_interface_relevant(i)) - avahi_packet_scheduler_post_probe(i->scheduler, record, immediately); + return avahi_packet_scheduler_post_probe(i->scheduler, record, immediately); + + return FALSE; } void avahi_dump_caches(AvahiInterfaceMonitor *m, FILE *f) { |