-#include "subscribe.h"
-
-static void free_entry(AvahiServer*s, AvahiEntry *e) {
- AvahiEntry *t;
-
- g_assert(s);
- g_assert(e);
-
- avahi_goodbye_entry(s, e, TRUE);
-
- /* Remove from linked list */
- AVAHI_LLIST_REMOVE(AvahiEntry, entries, s->entries, e);
-
- /* Remove from hash table indexed by name */
- t = g_hash_table_lookup(s->entries_by_key, e->record->key);
- AVAHI_LLIST_REMOVE(AvahiEntry, by_key, t, e);
- if (t)
- g_hash_table_replace(s->entries_by_key, t->record->key, t);
- else
- g_hash_table_remove(s->entries_by_key, e->record->key);
-
- /* Remove from associated group */
- if (e->group)
- AVAHI_LLIST_REMOVE(AvahiEntry, by_group, e->group->entries, e);
-
- avahi_record_unref(e->record);
- g_free(e);
-}
-
-static void free_group(AvahiServer *s, AvahiEntryGroup *g) {
- g_assert(s);
- g_assert(g);
-
- while (g->entries)
- free_entry(s, g->entries);
-
- AVAHI_LLIST_REMOVE(AvahiEntryGroup, groups, s->groups, g);
- g_free(g);
-}
-
-static void cleanup_dead(AvahiServer *s) {
- AvahiEntryGroup *g, *ng;
- AvahiEntry *e, *ne;
- g_assert(s);
-
-
- if (s->need_group_cleanup) {
- for (g = s->groups; g; g = ng) {
- ng = g->groups_next;
-
- if (g->dead)
- free_group(s, g);
- }
-
- s->need_group_cleanup = FALSE;
- }
-
- if (s->need_entry_cleanup) {
- for (e = s->entries; e; e = ne) {
- ne = e->entries_next;
-
- if (e->dead)
- free_entry(s, e);
- }
+#include "browse.h"
+#include "log.h"
+#include "util.h"
+#include "dns-srv-rr.h"
+#include "addr-util.h"
+#include "domain-util.h"
+#include "rr-util.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) {
+ assert(s);
+ assert(i);
+ assert(name);
+ assert(callback);
+
+ if (type == AVAHI_DNS_TYPE_ANY) {
+ AvahiEntry *e;
+
+ for (e = s->entries; e; e = e->entries_next)
+ if (!e->dead &&
+ avahi_entry_is_registered(s, e, i) &&
+ e->record->key->clazz == AVAHI_DNS_CLASS_IN &&
+ avahi_domain_equal(name, e->record->key->name))
+ callback(s, e->record, e->flags & AVAHI_PUBLISH_UNIQUE, userdata);