- g_free(s);
-}
-
-void avahi_server_add(
- AvahiServer *s,
- AvahiEntryGroup *g,
- gint interface,
- guchar protocol,
- AvahiEntryFlags flags,
- AvahiRecord *r) {
-
- AvahiEntry *e, *t;
- g_assert(s);
- g_assert(r);
-
- g_assert(r->key->type != AVAHI_DNS_TYPE_ANY);
-
- e = g_new(AvahiEntry, 1);
- e->server = s;
- e->record = avahi_record_ref(r);
- e->group = g;
- e->interface = interface;
- e->protocol = protocol;
- e->flags = flags;
- e->dead = FALSE;
-
- AVAHI_LLIST_HEAD_INIT(AvahiAnnouncement, e->announcements);
-
- AVAHI_LLIST_PREPEND(AvahiEntry, entries, s->entries, e);
-
- /* Insert into hash table indexed by name */
- t = g_hash_table_lookup(s->entries_by_key, e->record->key);
- AVAHI_LLIST_PREPEND(AvahiEntry, by_key, t, e);
- g_hash_table_replace(s->entries_by_key, e->record->key, t);
-
- /* Insert into group list */
- if (g)
- AVAHI_LLIST_PREPEND(AvahiEntry, by_group, g->entries, e);
-
- avahi_announce_entry(s, e);
-}
-const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiEntryGroup *g, void **state) {
- AvahiEntry **e = (AvahiEntry**) state;
- g_assert(s);
- g_assert(e);
-
- if (!*e)
- *e = g ? g->entries : s->entries;
-
- while (*e && (*e)->dead)
- *e = g ? (*e)->by_group_next : (*e)->entries_next;
-
- if (!*e)
- return NULL;
-
- return avahi_record_ref((*e)->record);