From 14f8d9beb7ef14b0aab5512345e09109bdd8cb0c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 28 Jun 2005 22:09:17 +0000 Subject: * recreate DNS query in simple protocol on host or domain name changes * C++ compatibility git-svn-id: file:///home/lennart/svn/public/avahi/trunk@151 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-core/core.h | 10 ++++++++++ avahi-core/dns.c | 4 ++-- avahi-core/log.h | 5 +++++ avahi-core/probe-sched.c | 6 +++--- avahi-core/server.c | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) (limited to 'avahi-core') diff --git a/avahi-core/core.h b/avahi-core/core.h index 02e1db9..06eb07a 100644 --- a/avahi-core/core.h +++ b/avahi-core/core.h @@ -25,6 +25,10 @@ #include #include +#include + +AVAHI_C_DECL_BEGIN + /** An mDNS responder object */ typedef struct AvahiServer AvahiServer; @@ -34,10 +38,14 @@ typedef struct AvahiEntry AvahiEntry; /** A group of locally registered DNS RRs */ typedef struct AvahiEntryGroup AvahiEntryGroup; +AVAHI_C_DECL_END + #include #include #include +AVAHI_C_DECL_BEGIN + /** States of a server object */ typedef enum { AVAHI_SERVER_INVALID = -1, /**< Invalid state (initial) */ @@ -376,4 +384,6 @@ typedef void (*AvahiDNSServerBrowserCallback)(AvahiDNSServerBrowser *b, AvahiIfI AvahiDNSServerBrowser *avahi_dns_server_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const gchar *domain, AvahiDNSServerType type, AvahiProtocol aprotocol, AvahiDNSServerBrowserCallback callback, gpointer userdata); void avahi_dns_server_browser_free(AvahiDNSServerBrowser *b); +AVAHI_C_DECL_END + #endif diff --git a/avahi-core/dns.c b/avahi-core/dns.c index 6a7fd58..5213e97 100644 --- a/avahi-core/dns.c +++ b/avahi-core/dns.c @@ -616,7 +616,7 @@ guint8* avahi_dns_packet_append_key(AvahiDnsPacket *p, AvahiKey *k, gboolean uni if (!(t = avahi_dns_packet_append_name(p, k->name)) || !avahi_dns_packet_append_uint16(p, k->type) || - !avahi_dns_packet_append_uint16(p, k->class | (unicast_response ? AVAHI_DNS_UNICAST_RESPONSE : 0))) { + !avahi_dns_packet_append_uint16(p, k->clazz | (unicast_response ? AVAHI_DNS_UNICAST_RESPONSE : 0))) { p->size = size; return NULL; } @@ -635,7 +635,7 @@ guint8* avahi_dns_packet_append_record(AvahiDnsPacket *p, AvahiRecord *r, gboole if (!(t = avahi_dns_packet_append_name(p, r->key->name)) || !avahi_dns_packet_append_uint16(p, r->key->type) || - !avahi_dns_packet_append_uint16(p, cache_flush ? (r->key->class | AVAHI_DNS_CACHE_FLUSH) : (r->key->class &~ AVAHI_DNS_CACHE_FLUSH)) || + !avahi_dns_packet_append_uint16(p, cache_flush ? (r->key->clazz | AVAHI_DNS_CACHE_FLUSH) : (r->key->clazz &~ AVAHI_DNS_CACHE_FLUSH)) || !avahi_dns_packet_append_uint32(p, (max_ttl && r->ttl > max_ttl) ? max_ttl : r->ttl) || !(l = avahi_dns_packet_append_uint16(p, 0))) goto fail; diff --git a/avahi-core/log.h b/avahi-core/log.h index e75b6c0..280b2da 100644 --- a/avahi-core/log.h +++ b/avahi-core/log.h @@ -24,6 +24,9 @@ #include #include +#include + +AVAHI_C_DECL_BEGIN #ifdef __GNUC__ #define AVAHI_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b))) @@ -74,4 +77,6 @@ void avahi_log_info(const gchar*format, ...) AVAHI_GCC_PRINTF_ATTR12; /** Shortcut for avahi_log(AVAHI_LOG_DEBUG, ...) */ void avahi_log_debug(const gchar*format, ...) AVAHI_GCC_PRINTF_ATTR12; +AVAHI_C_DECL_END + #endif diff --git a/avahi-core/probe-sched.c b/avahi-core/probe-sched.c index 26071d3..0e36bb4 100644 --- a/avahi-core/probe-sched.c +++ b/avahi-core/probe-sched.c @@ -171,7 +171,7 @@ static gboolean packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p return FALSE; /* Create the probe query */ - k = avahi_key_new(pj->record->key->name, pj->record->key->class, AVAHI_DNS_TYPE_ANY); + k = avahi_key_new(pj->record->key->name, pj->record->key->clazz, AVAHI_DNS_TYPE_ANY); b = !!avahi_dns_packet_append_key(p, k, FALSE); g_assert(b); @@ -184,7 +184,7 @@ static gboolean packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p continue; /* Does the record match the probe? */ - if (k->class != pj->record->key->class || !avahi_domain_equal(k->name, pj->record->key->name)) + if (k->clazz != pj->record->key->clazz || !avahi_domain_equal(k->name, pj->record->key->name)) continue; /* This job wouldn't fit in */ @@ -238,7 +238,7 @@ static void elapse_callback(AvahiTimeEvent *e, gpointer data) { p = avahi_dns_packet_new_query(size); - k = avahi_key_new(pj->record->key->name, pj->record->key->class, AVAHI_DNS_TYPE_ANY); + k = avahi_key_new(pj->record->key->name, pj->record->key->clazz, AVAHI_DNS_TYPE_ANY); b = avahi_dns_packet_append_key(p, k, FALSE) && avahi_dns_packet_append_record(p, pj->record, FALSE, 0); avahi_key_unref(k); diff --git a/avahi-core/server.c b/avahi-core/server.c index 668e098..b3ae039 100644 --- a/avahi-core/server.c +++ b/avahi-core/server.c @@ -135,7 +135,7 @@ void avahi_server_enumerate_aux_records(AvahiServer *s, AvahiInterface *i, Avahi g_assert(r); g_assert(callback); - if (r->key->class == AVAHI_DNS_CLASS_IN) { + if (r->key->clazz == AVAHI_DNS_CLASS_IN) { if (r->key->type == AVAHI_DNS_TYPE_PTR) { enum_aux_records(s, i, r->data.ptr.name, AVAHI_DNS_TYPE_SRV, callback, userdata); enum_aux_records(s, i, r->data.ptr.name, AVAHI_DNS_TYPE_TXT, callback, userdata); -- cgit