* move unicast DNS server registration/browsing routines to their own header dns...
authorLennart Poettering <lennart@poettering.net>
Mon, 17 Oct 2005 22:23:16 +0000 (22:23 +0000)
committerLennart Poettering <lennart@poettering.net>
Mon, 17 Oct 2005 22:23:16 +0000 (22:23 +0000)
* remove some unused functions
* unexport some functions
* other cleanups

git-svn-id: file:///home/lennart/svn/public/avahi/trunk@803 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

24 files changed:
avahi-core/announce.c
avahi-core/announce.h
avahi-core/avahi-test.c
avahi-core/browse.c
avahi-core/browse.h
avahi-core/cache.c
avahi-core/cache.h
avahi-core/conformance-test.c
avahi-core/dns-srv-rr.h [new file with mode: 0644]
avahi-core/entry.c
avahi-core/hashmap.c
avahi-core/hashmap.h
avahi-core/lookup.h
avahi-core/publish.h
avahi-core/server.c
avahi-core/server.h
avahi-core/timeeventq.c
avahi-core/timeeventq.h
avahi-core/util.c
avahi-core/util.h
avahi-core/wide-area.c
avahi-daemon/main.c
avahi-daemon/simple-protocol.c
docs/TODO

index f769e98..10002b8 100644 (file)
@@ -191,7 +191,7 @@ static void elapse_announce(AvahiTimeEvent *e, void *userdata) {
     next_state(userdata);
 }
 
-AvahiAnnouncer *avahi_get_announcer(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
+static AvahiAnnouncer *get_announcer(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
     AvahiAnnouncer *a;
     
     assert(s);
@@ -254,7 +254,7 @@ static void new_announcer(AvahiServer *s, AvahiInterface *i, AvahiEntry *e) {
         return;
 
     /* We don't want duplicate announcers */
-    if (avahi_get_announcer(s, e, i))
+    if (get_announcer(s, e, i))
         return;    
 
     if ((!(a = avahi_new(AvahiAnnouncer, 1)))) {
@@ -328,7 +328,7 @@ int avahi_entry_is_registered(AvahiServer *s, AvahiEntry *e, AvahiInterface *i)
     assert(i);
     assert(!e->dead);
 
-    if (!(a = avahi_get_announcer(s, e, i)))
+    if (!(a = get_announcer(s, e, i)))
         return 0;
     
     return
@@ -345,7 +345,7 @@ int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
     assert(i);
     assert(!e->dead);
 
-    if (!(a = avahi_get_announcer(s, e, i)))
+    if (!(a = get_announcer(s, e, i)))
         return 0;
 
 /*     avahi_log_debug("state: %i", a->state); */
@@ -362,7 +362,7 @@ void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInt
     assert(e);
     assert(i);
 
-    if (!(a = avahi_get_announcer(s, e, i)))
+    if (!(a = get_announcer(s, e, i)))
         return;
 
     if (a->state == AVAHI_PROBING && a->entry->group)
@@ -499,7 +499,7 @@ static void reannounce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i
     assert(e);
     assert(!e->dead);
 
-    if (!(a = avahi_get_announcer(m->server, e, i)))
+    if (!(a = get_announcer(m->server, e, i)))
         return;
 
     reannounce(a);
@@ -545,14 +545,3 @@ void avahi_goodbye_entry(AvahiServer *s, AvahiEntry *e, int send_goodbye, int re
             remove_announcer(s, e->announcers);
 }
 
-void avahi_goodbye_all(AvahiServer *s, int send_goodbye, int remove) {
-    AvahiEntry *e;
-    
-    assert(s);
-
-    for (e = s->entries; e; e = e->entries_next)
-        if (!e->dead)
-            avahi_goodbye_entry(s, e, send_goodbye, remove);
-
-}
-
index 71fd246..1994312 100644 (file)
@@ -65,9 +65,6 @@ int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i);
 
 void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye, int rem);
 void avahi_goodbye_entry(AvahiServer *s, AvahiEntry *e, int send_goodbye, int rem);
-void avahi_goodbye_all(AvahiServer *s, int send_goodbye, int rem);
-
-AvahiAnnouncer *avahi_get_announcer(AvahiServer *s, AvahiEntry *e, AvahiInterface *i);
 
 void avahi_reannounce_entry(AvahiServer *s, AvahiEntry *e);
 
index 94c34b9..51deaea 100644 (file)
@@ -39,6 +39,7 @@
 #include <avahi-core/log.h>
 #include <avahi-core/publish.h>
 #include <avahi-core/lookup.h>
+#include <avahi-core/dns-srv-rr.h>
 
 static AvahiSEntryGroup *group = NULL;
 static AvahiServer *server = NULL;
index 639a7cb..09bc0fa 100644 (file)
@@ -79,7 +79,6 @@ static void transport_flags_from_domain(AvahiServer *s, AvahiLookupFlags *flags,
         *flags |= AVAHI_LOOKUP_USE_WIDE_AREA;
 }
 
-
 static AvahiSRBLookup* lookup_new(
     AvahiSRecordBrowser *b,
     AvahiIfIndex interface,
@@ -180,6 +179,21 @@ static AvahiSRBLookup *lookup_find(
     return NULL;
 }
 
+static void browser_cancel(AvahiSRecordBrowser *b) {
+    assert(b);
+
+    if (b->root_lookup) {
+        lookup_unref(b->root_lookup);
+        b->root_lookup = NULL;
+    }
+
+    if (b->defer_time_event) {
+        avahi_time_event_free(b->defer_time_event);
+        b->defer_time_event = NULL;
+    }
+}
+
+
 static void lookup_wide_area_callback(
     AvahiWideAreaLookupEngine *e,
     AvahiBrowserEvent event,
@@ -469,7 +483,7 @@ static void defer_callback(AvahiTimeEvent *e, void *userdata) {
             b->flags & AVAHI_LOOKUP_USE_WIDE_AREA ? AVAHI_LOOKUP_RESULT_WIDE_AREA : AVAHI_LOOKUP_RESULT_MULTICAST,
             b->userdata);
         
-        avahi_s_record_browser_cancel(b);
+        browser_cancel(b);
         return;
     }
     
@@ -493,7 +507,7 @@ void avahi_s_record_browser_restart(AvahiSRecordBrowser *b) {
     assert(b);
     assert(!b->dead);
 
-    avahi_s_record_browser_cancel(b);
+    browser_cancel(b);
 
     /* Request a new iteration of the cache scanning */
     if (!b->defer_time_event) {
@@ -550,20 +564,6 @@ AvahiSRecordBrowser *avahi_s_record_browser_new(
     return b;
 }
 
-void avahi_s_record_browser_cancel(AvahiSRecordBrowser *b) {
-    assert(b);
-
-    if (b->root_lookup) {
-        lookup_unref(b->root_lookup);
-        b->root_lookup = NULL;
-    }
-
-    if (b->defer_time_event) {
-        avahi_time_event_free(b->defer_time_event);
-        b->defer_time_event = NULL;
-    }
-}
-
 void avahi_s_record_browser_free(AvahiSRecordBrowser *b) {
     assert(b);
     assert(!b->dead);
@@ -571,13 +571,13 @@ void avahi_s_record_browser_free(AvahiSRecordBrowser *b) {
     b->dead = 1;
     b->server->need_browser_cleanup = 1;
 
-    avahi_s_record_browser_cancel(b);
+    browser_cancel(b);
 }
 
 void avahi_s_record_browser_destroy(AvahiSRecordBrowser *b) {
     assert(b);
 
-    avahi_s_record_browser_cancel(b);
+    browser_cancel(b);
     
     AVAHI_LLIST_REMOVE(AvahiSRecordBrowser, browser, b->server->record_browsers, b);
 
index a340c7f..61ceca7 100644 (file)
@@ -58,6 +58,5 @@ void avahi_browser_cleanup(AvahiServer *server);
 
 void avahi_s_record_browser_destroy(AvahiSRecordBrowser *b);
 void avahi_s_record_browser_restart(AvahiSRecordBrowser *b);
-void avahi_s_record_browser_cancel(AvahiSRecordBrowser *b);
 
 #endif
index 23e9036..ef7293d 100644 (file)
@@ -101,7 +101,7 @@ void avahi_cache_free(AvahiCache *c) {
     avahi_free(c);
 }
 
-AvahiCacheEntry *avahi_cache_lookup_key(AvahiCache *c, AvahiKey *k) {
+static AvahiCacheEntry *lookup_key(AvahiCache *c, AvahiKey *k) {
     assert(c);
     assert(k);
 
@@ -131,7 +131,7 @@ void* avahi_cache_walk(AvahiCache *c, AvahiKey *pattern, AvahiCacheWalkCallback
     } else {
         AvahiCacheEntry *e, *n;
 
-        for (e = avahi_cache_lookup_key(c, pattern); e; e = n) {
+        for (e = lookup_key(c, pattern); e; e = n) {
             n = e->by_key_next;
                 
             if ((ret = cb(c, pattern, e, userdata)))
@@ -153,7 +153,7 @@ static void* lookup_record_callback(AvahiCache *c, AvahiKey *pattern, AvahiCache
     return NULL;
 }
 
-AvahiCacheEntry *avahi_cache_lookup_record(AvahiCache *c, AvahiRecord *r) {
+static AvahiCacheEntry *lookup_record(AvahiCache *c, AvahiRecord *r) {
     assert(c);
     assert(r);
 
@@ -279,7 +279,7 @@ void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const Av
 
         AvahiCacheEntry *e;
 
-        if ((e = avahi_cache_lookup_record(c, r)))
+        if ((e = lookup_record(c, r)))
             expire_in_one_second(c, e, AVAHI_CACHE_GOODBYE_FINAL);
 
     } else {
@@ -290,7 +290,7 @@ void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const Av
 
         /* This is an update request */
 
-        if ((first = avahi_cache_lookup_key(c, r->key))) {
+        if ((first = lookup_key(c, r->key))) {
             
             if (cache_flush) {
 
@@ -480,7 +480,7 @@ void avahi_cache_stop_poof(AvahiCache *c, AvahiRecord *record, const AvahiAddres
     assert(record);
     assert(a);
 
-    if (!(e = avahi_cache_lookup_record(c, record)))
+    if (!(e = lookup_record(c, record)))
         return;
 
     /* This function is called for each response suppression
index bd1cd6c..3d71e50 100644 (file)
@@ -77,9 +77,6 @@ struct AvahiCache {
 AvahiCache *avahi_cache_new(AvahiServer *server, AvahiInterface *interface);
 void avahi_cache_free(AvahiCache *c);
 
-AvahiCacheEntry *avahi_cache_lookup_key(AvahiCache *c, AvahiKey *k);
-AvahiCacheEntry *avahi_cache_lookup_record(AvahiCache *c, AvahiRecord *r);
-
 void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const AvahiAddress *a);
 
 int avahi_cache_dump(AvahiCache *c, AvahiDumpCallback callback, void* userdata);
index 6e8e00e..4445fb5 100644 (file)
 #include <avahi-common/simple-watch.h>
 #include <avahi-common/timeval.h>
 
-#include "core.h"
-#include "log.h"
-#include "lookup.h"
+#include <avahi-core/core.h>
+#include <avahi-core/log.h>
+#include <avahi-core/lookup.h>
+#include <avahi-core/publish.h>
 
 static char *name = NULL;
 static AvahiSEntryGroup *group = NULL;
diff --git a/avahi-core/dns-srv-rr.h b/avahi-core/dns-srv-rr.h
new file mode 100644 (file)
index 0000000..6111ff6
--- /dev/null
@@ -0,0 +1,107 @@
+#ifndef foodnssrvhfoo
+#define foodnssrvhfoo
+
+/* $Id$ */
+
+/***
+  This file is part of avahi.
+  avahi is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation; either version 2.1 of the
+  License, or (at your option) any later version.
+  avahi is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+  Public License for more details.
+  You should have received a copy of the GNU Lesser General Public
+  License along with avahi; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+  USA.
+***/
+
+/** \file avahi-core/dns-srv-rr.h Functions for announcing and browsing for unicast DNS servers via mDNS */
+
+/** A domain service browser object. Use this to browse for
+ * conventional unicast DNS servers which may be used to resolve
+ * conventional domain names */
+typedef struct AvahiSDNSServerBrowser AvahiSDNSServerBrowser;
+
+#include <avahi-common/cdecl.h>
+#include <avahi-common/defs.h>
+#include <avahi-core/core.h>
+#include <avahi-core/publish.h>
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+AVAHI_C_DECL_BEGIN
+#endif
+
+/** The type of DNS server */
+typedef enum {
+    AVAHI_DNS_SERVER_RESOLVE,         /**< Unicast DNS servers for normal resolves (_domain._udp)*/
+    AVAHI_DNS_SERVER_UPDATE,           /**< Unicast DNS servers for updates (_dns-update._udp)*/
+    AVAHI_DNS_SERVER_MAX
+} AvahiDNSServerType;
+
+/** Publish the specified unicast DNS server address via mDNS. You may
+ * browse for records create this way wit
+ * avahi_s_dns_server_browser_new(). */
+int avahi_server_add_dns_server_address(
+    AvahiServer *s,
+    AvahiSEntryGroup *g,
+    AvahiIfIndex interface,
+    AvahiProtocol protocol,
+    AvahiPublishFlags flags,
+    const char *domain,
+    AvahiDNSServerType type,
+    const AvahiAddress *address,
+    uint16_t port /** should be 53 */);
+
+/** Similar to avahi_server_add_dns_server_address(), but specify a
+host name instead of an address. The specified host name should be
+resolvable via mDNS */
+int avahi_server_add_dns_server_name(
+    AvahiServer *s,
+    AvahiSEntryGroup *g,
+    AvahiIfIndex interface,
+    AvahiProtocol protocol,
+    AvahiPublishFlags flags,
+    const char *domain,
+    AvahiDNSServerType type,
+    const char *name,
+    uint16_t port /** should be 53 */);
+
+/** Callback prototype for AvahiSDNSServerBrowser events */
+typedef void (*AvahiSDNSServerBrowserCallback)(
+    AvahiSDNSServerBrowser *b,
+    AvahiIfIndex interface,
+    AvahiProtocol protocol,
+    AvahiBrowserEvent event,
+    const char *host_name,       /**< Host name of the DNS server, probably useless */
+    const AvahiAddress *a,        /**< Address of the DNS server */
+    uint16_t port,                 /**< Port number of the DNS servers, probably 53 */
+    AvahiLookupResultFlags flags,  /**< Lookup flags */
+    void* userdata);
+
+/** Create a new AvahiSDNSServerBrowser object */
+AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
+    AvahiServer *server,
+    AvahiIfIndex interface,
+    AvahiProtocol protocol,
+    const char *domain,
+    AvahiDNSServerType type,
+    AvahiProtocol aprotocol,  /**< Address protocol for the DNS server */ 
+    AvahiLookupFlags flags,                 /**< Lookup flags. */
+    AvahiSDNSServerBrowserCallback callback,
+    void* userdata);
+
+/** Free an AvahiSDNSServerBrowser object */
+void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *b);
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+AVAHI_C_DECL_END
+#endif
+
+#endif
index f89d613..74f44f1 100644 (file)
@@ -44,6 +44,7 @@
 #include "browse.h"
 #include "log.h"
 #include "util.h"
+#include "dns-srv-rr.h"
 
 void avahi_entry_free(AvahiServer*s, AvahiEntry *e) {
     AvahiEntry *t;
index 24a1249..07bd707 100644 (file)
@@ -124,20 +124,6 @@ void* avahi_hashmap_lookup(AvahiHashmap *m, const void *key) {
     return e->value;
 }
 
-void* avahi_hashmap_steal(AvahiHashmap *m, const void *key) {
-    Entry *e;
-    void *v;
-    
-    assert(m);
-
-    if (!(e = entry_get(m, key)))
-        return NULL;
-
-    v = e->value;
-    entry_free(m, e, 1);
-    return v;
-}
-
 int avahi_hashmap_insert(AvahiHashmap *m, void *key, void *value) {
     unsigned idx;
     Entry *e;
index f546dfc..120cf30 100644 (file)
@@ -36,7 +36,6 @@ AvahiHashmap* avahi_hashmap_new(AvahiHashFunc hash_func, AvahiEqualFunc equal_fu
 
 void avahi_hashmap_free(AvahiHashmap *m);
 void* avahi_hashmap_lookup(AvahiHashmap *m, const void *key);
-void* avahi_hashmap_steal(AvahiHashmap *m, const void *key);
 int avahi_hashmap_insert(AvahiHashmap *m, void *key, void *value);
 int avahi_hashmap_replace(AvahiHashmap *m, void *key, void *value);
 void avahi_hashmap_remove(AvahiHashmap *m, const void *key);
index 153fb67..f66a086 100644 (file)
 /** \example core-browse-services.c Example how to browse for DNS-SD
  * services using an embedded mDNS stack. */
 
-#include <avahi-common/cdecl.h>
-#include <avahi-common/defs.h>
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-AVAHI_C_DECL_BEGIN
-#endif
-
 /** A browsing object for arbitrary RRs */
 typedef struct AvahiSRecordBrowser AvahiSRecordBrowser;
 
@@ -55,23 +48,14 @@ typedef struct AvahiSServiceBrowser AvahiSServiceBrowser;
 /** A DNS-SD service resolver.  Use this to retrieve addres, port and TXT data for a DNS-SD service */
 typedef struct AvahiSServiceResolver AvahiSServiceResolver;
 
-/** A domain service browser object. Use this to browse for
- * conventional unicast DNS servers which may be used to resolve
- * conventional domain names */
-typedef struct AvahiSDNSServerBrowser AvahiSDNSServerBrowser;
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-AVAHI_C_DECL_END
-#endif
-
+#include <avahi-common/cdecl.h>
+#include <avahi-common/defs.h>
 #include <avahi-core/core.h>
-#include <avahi-core/publish.h>
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
 AVAHI_C_DECL_BEGIN
 #endif
 
-
 /** Callback prototype for AvahiSRecordBrowser events */
 typedef void (*AvahiSRecordBrowserCallback)(
     AvahiSRecordBrowser *b,          /**< The AvahiSRecordBrowser object that is emitting this callback */
@@ -250,33 +234,6 @@ AvahiSServiceResolver *avahi_s_service_resolver_new(
 /** Free an AvahiSServiceResolver object */
 void avahi_s_service_resolver_free(AvahiSServiceResolver *r);
 
-/** Callback prototype for AvahiSDNSServerBrowser events */
-typedef void (*AvahiSDNSServerBrowserCallback)(
-    AvahiSDNSServerBrowser *b,
-    AvahiIfIndex interface,
-    AvahiProtocol protocol,
-    AvahiBrowserEvent event,
-    const char *host_name,       /**< Host name of the DNS server, probably useless */
-    const AvahiAddress *a,        /**< Address of the DNS server */
-    uint16_t port,                 /**< Port number of the DNS servers, probably 53 */
-    AvahiLookupResultFlags flags,  /**< Lookup flags */
-    void* userdata);
-
-/** Create a new AvahiSDNSServerBrowser object */
-AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
-    AvahiServer *server,
-    AvahiIfIndex interface,
-    AvahiProtocol protocol,
-    const char *domain,
-    AvahiDNSServerType type,
-    AvahiProtocol aprotocol,  /**< Address protocol for the DNS server */ 
-    AvahiLookupFlags flags,                 /**< Lookup flags. */
-    AvahiSDNSServerBrowserCallback callback,
-    void* userdata);
-
-/** Free an AvahiSDNSServerBrowser object */
-void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *b);
-
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
 AVAHI_C_DECL_END
 #endif
index a5b3025..a059a4b 100644 (file)
  * service using an embedded mDNS stack. It behaves like a network
  * printer registering both an IPP and a BSD LPR service. */
 
-#include <avahi-common/cdecl.h>
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-AVAHI_C_DECL_BEGIN
-#endif
-
 /** A group of locally registered DNS RRs */
 typedef struct AvahiSEntryGroup AvahiSEntryGroup;
 
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-AVAHI_C_DECL_END
-#endif
-
+#include <avahi-common/cdecl.h>
 #include <avahi-core/core.h>
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -206,42 +197,6 @@ int avahi_server_update_service_txt(
     const char *domain,   
     ...) AVAHI_GCC_SENTINEL;
 
-/** The type of DNS server */
-typedef enum {
-    AVAHI_DNS_SERVER_RESOLVE,         /**< Unicast DNS servers for normal resolves (_domain._udp)*/
-    AVAHI_DNS_SERVER_UPDATE,           /**< Unicast DNS servers for updates (_dns-update._udp)*/
-    AVAHI_DNS_SERVER_MAX
-} AvahiDNSServerType;
-
-/** Publish the specified unicast DNS server address via mDNS. You may
- * browse for records create this way wit
- * avahi_s_dns_server_browser_new(). */
-int avahi_server_add_dns_server_address(
-    AvahiServer *s,
-    AvahiSEntryGroup *g,
-    AvahiIfIndex interface,
-    AvahiProtocol protocol,
-    AvahiPublishFlags flags,
-    const char *domain,
-    AvahiDNSServerType type,
-    const AvahiAddress *address,
-    uint16_t port /** should be 53 */);
-
-/** Similar to avahi_server_add_dns_server_address(), but specify a
-host name instead of an address. The specified host name should be
-resolvable via mDNS */
-int avahi_server_add_dns_server_name(
-    AvahiServer *s,
-    AvahiSEntryGroup *g,
-    AvahiIfIndex interface,
-    AvahiProtocol protocol,
-    AvahiPublishFlags flags,
-    const char *domain,
-    AvahiDNSServerType type,
-    const char *name,
-    uint16_t port /** should be 53 */);
-
-
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
 AVAHI_C_DECL_END
 #endif
index 40d437e..2252fde 100644 (file)
@@ -44,6 +44,7 @@
 #include "browse.h"
 #include "log.h"
 #include "util.h"
+#include "dns-srv-rr.h"
 
 static void enum_aux_records(AvahiServer *s, AvahiInterface *i, const char *name, uint16_t type, void (*callback)(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata), void* userdata) {
     AvahiKey *k;
@@ -1075,19 +1076,13 @@ void avahi_server_decrease_host_rr_pending(AvahiServer *s) {
         server_set_state(s, AVAHI_SERVER_RUNNING);
 }
 
-void avahi_server_increase_host_rr_pending(AvahiServer *s) {
-    assert(s);
-
-    s->n_host_rr_pending ++;
-}
-
 void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
     assert(s);
     assert(g);
 
     if (state == AVAHI_ENTRY_GROUP_REGISTERING &&
         s->state == AVAHI_SERVER_REGISTERING)
-        avahi_server_increase_host_rr_pending(s);
+        s->n_host_rr_pending ++;
     
     else if (state == AVAHI_ENTRY_GROUP_COLLISION &&
         (s->state == AVAHI_SERVER_REGISTERING || s->state == AVAHI_SERVER_RUNNING)) {
@@ -1178,7 +1173,7 @@ static void register_stuff(AvahiServer *s) {
     assert(s);
 
     server_set_state(s, AVAHI_SERVER_REGISTERING);
-    s->n_host_rr_pending ++;  /** Make sure that the state isn't changed tp AVAHI_SERVER_RUNNING too early */
+    s->n_host_rr_pending ++; /** Make sure that the state isn't changed tp AVAHI_SERVER_RUNNING too early */
 
     register_hinfo(s);
     register_browse_domain(s);
index 8b3b9da..7181b3c 100644 (file)
   USA.
 ***/
 
-#include <avahi-common/llist.h>
-#include <avahi-common/watch.h>
-
 /** A locally registered DNS resource record */
 typedef struct AvahiEntry AvahiEntry;
 
+#include <avahi-common/llist.h>
+#include <avahi-common/watch.h>
+
 #include "core.h"
 #include "iface.h"
 #include "prioq.h"
@@ -39,6 +39,7 @@ typedef struct AvahiEntry AvahiEntry;
 #include "hashmap.h"
 #include "wide-area.h"
 #include "multicast-lookup.h"
+#include "dns-srv-rr.h"
 
 #define AVAHI_MAX_LEGACY_UNICAST_REFLECT_SLOTS 100
 
@@ -176,7 +177,6 @@ void avahi_server_enumerate_aux_records(AvahiServer *s, AvahiInterface *i, Avahi
 void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void *userdata);
 
 void avahi_server_decrease_host_rr_pending(AvahiServer *s);
-void avahi_server_increase_host_rr_pending(AvahiServer *s);
 
 int avahi_server_set_errno(AvahiServer *s, int error);
 
index a259ba6..e8782c9 100644 (file)
@@ -59,11 +59,17 @@ static int compare(const void* _a, const void* _b) {
     return avahi_timeval_compare(&a->last_run, &b->last_run);
 }
 
+static AvahiTimeEvent* time_event_queue_root(AvahiTimeEventQueue *q) {
+    assert(q);
+
+    return q->prioq->root ? q->prioq->root->data : NULL;
+}
+
 static void update_timeout(AvahiTimeEventQueue *q) {
     AvahiTimeEvent *e;
     assert(q);
 
-    if ((e = avahi_time_event_queue_root(q)))
+    if ((e = time_event_queue_root(q)))
         q->poll_api->timeout_update(q->timeout, &e->expiry);
     else
         q->poll_api->timeout_update(q->timeout, NULL);
@@ -73,7 +79,7 @@ static void expiration_event(AvahiTimeout *timeout, void *userdata) {
     AvahiTimeEventQueue *q = userdata;
     AvahiTimeEvent *e;
 
-    if ((e = avahi_time_event_queue_root(q))) {
+    if ((e = time_event_queue_root(q))) {
         struct timeval now;
 
         gettimeofday(&now, NULL);
@@ -145,7 +151,7 @@ void avahi_time_event_queue_free(AvahiTimeEventQueue *q) {
     
     assert(q);
 
-    while ((e = avahi_time_event_queue_root(q)))
+    while ((e = time_event_queue_root(q)))
         avahi_time_event_free(e);
     avahi_prio_queue_free(q->prioq);
 
@@ -219,16 +225,3 @@ void avahi_time_event_update(AvahiTimeEvent *e, const struct timeval *timeval) {
     update_timeout(e->queue);
 }
 
-AvahiTimeEvent* avahi_time_event_queue_root(AvahiTimeEventQueue *q) {
-    assert(q);
-
-    return q->prioq->root ? q->prioq->root->data : NULL;
-}
-
-AvahiTimeEvent* avahi_time_event_next(AvahiTimeEvent *e) {
-    assert(e);
-
-    return e->node->next->data;
-}
-
-
index 5705eb9..cdfa5e6 100644 (file)
@@ -45,7 +45,4 @@ AvahiTimeEvent* avahi_time_event_new(
 void avahi_time_event_free(AvahiTimeEvent *e);
 void avahi_time_event_update(AvahiTimeEvent *e, const struct timeval *timeval);
 
-AvahiTimeEvent* avahi_time_event_queue_root(AvahiTimeEventQueue *q);
-AvahiTimeEvent* avahi_time_event_next(AvahiTimeEvent *e);
-
 #endif
index ef54be1..41229c5 100644 (file)
@@ -92,17 +92,6 @@ char *avahi_format_mac_address(const uint8_t* mac, size_t size) {
     return r;
 }
 
-char *avahi_strdown(char *s) {
-    char *c;
-    
-    assert(s);
-
-    for (c = s; *c; c++)
-        *c = (char) tolower(*c);
-
-    return s;
-}
-
 char *avahi_strup(char *s) {
     char *c;
     assert(s);
index 1a07363..aa38693 100644 (file)
@@ -35,9 +35,6 @@ char *avahi_format_mac_address(const uint8_t* mac, size_t size);
 /** Change every character in the string to upper case (ASCII), return a pointer to the string */
 char *avahi_strup(char *s);
 
-/** Change every character in the string to lower case (ASCII), return a pointer to the string */
-char *avahi_strdown(char *s);
-
 AVAHI_C_DECL_END
 
 #endif
index 2c5f8c1..f32c403 100644 (file)
@@ -657,11 +657,9 @@ void avahi_wide_area_clear_cache(AvahiWideAreaLookupEngine *e) {
     assert(e->cache_n_entries == 0);
 }
 
-
 void avahi_wide_area_set_servers(AvahiWideAreaLookupEngine *e, const AvahiAddress *a, unsigned n) {
     assert(e);
 
-    
     if (a) {
         for (e->n_dns_servers = 0; n > 0 && e->n_dns_servers < AVAHI_MAX_WIDE_AREA_SERVERS; a++, n--) 
             if ((a->proto == AVAHI_PROTO_INET && e->fd_ipv4 >= 0) || (a->proto == AVAHI_PROTO_INET6 && e->fd_ipv6 >= 0))
index 0cc9b43..31bca77 100644 (file)
 #include <avahi-common/simple-watch.h>
 #include <avahi-common/error.h>
 #include <avahi-common/alternative.h>
+
 #include <avahi-core/core.h>
 #include <avahi-core/publish.h>
+#include <avahi-core/dns-srv-rr.h>
 #include <avahi-core/log.h>
 
 #include "main.h"
index aa81cd7..6c6f125 100644 (file)
 #include <avahi-common/llist.h>
 #include <avahi-common/malloc.h>
 #include <avahi-common/error.h>
+
 #include <avahi-core/log.h>
 #include <avahi-core/lookup.h>
+#include <avahi-core/dns-srv-rr.h>
 
 #include "simple-protocol.h"
 #include "main.h"
index 2578825..6fe526f 100644 (file)
--- a/docs/TODO
+++ b/docs/TODO
@@ -6,7 +6,9 @@ for 0.6:
 * add support for subtypes in static services
 * drop partially created created entries on failure
 * Add static host configuration like static services [lathiat]
-* wrap avahi_server_add_record() via DBUS and in avahi-client  [lathiat]
+* wrap avahi_server_add_record() via DBUS and in avahi-client [lathiat]
+* remove AVAHI_PUBLISH_IS_PROXY
+* replace avahi_server_is_service_local() by AVAHI_PUBLISH flag
 
 later:
 * implement avahi-utils in C