void avahi_entry_free(AvahiServer*s, AvahiEntry *e) {
    AvahiEntry *t;

    assert(s);
    assert(e);

    avahi_goodbye_entry(s, e, 1, 1);

    /* Remove from linked list */
    AVAHI_LLIST_REMOVE(AvahiEntry, entries, s->entries, e);

    /* Remove from hash table indexed by name */
    t = avahi_hashmap_lookup(s->entries_by_key, e->record->key);
    AVAHI_LLIST_REMOVE(AvahiEntry, by_key, t, e);
    if (t)
        avahi_hashmap_replace(s->entries_by_key, t->record->key, t);
    else
        avahi_hashmap_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);
    avahi_free(e);
}
示例#2
0
static void lookup_destroy(AvahiWideAreaLookup *l) {
    AvahiWideAreaLookup *t;
    assert(l);
    
    lookup_stop(l);

    t = avahi_hashmap_lookup(l->engine->lookups_by_key, l->key);
    AVAHI_LLIST_REMOVE(AvahiWideAreaLookup, by_key, t, l);
    if (t)
        avahi_hashmap_replace(l->engine->lookups_by_key, avahi_key_ref(l->key), t);
    else
        avahi_hashmap_remove(l->engine->lookups_by_key, l->key);

    AVAHI_LLIST_REMOVE(AvahiWideAreaLookup, lookups, l->engine->lookups, l);
    
    avahi_hashmap_remove(l->engine->lookups_by_id, &l->id);
    avahi_dns_packet_free(l->packet);

    if (l->key)
        avahi_key_unref(l->key);

    if (l->cname_key)
        avahi_key_unref(l->cname_key);
    
    avahi_free(l);
}
示例#3
0
static void remove_entry(AvahiCache *c, AvahiCacheEntry *e) {
    AvahiCacheEntry *t;

    assert(c);
    assert(e);

/*     avahi_log_debug("removing from cache: %p %p", c, e); */

    /* Remove from hash table */
    t = avahi_hashmap_lookup(c->hashmap, e->record->key);
    AVAHI_LLIST_REMOVE(AvahiCacheEntry, by_key, t, e);
    if (t)
        avahi_hashmap_replace(c->hashmap, t->record->key, t);
    else
        avahi_hashmap_remove(c->hashmap, e->record->key);

    /* Remove from linked list */
    AVAHI_LLIST_REMOVE(AvahiCacheEntry, entry, c->entries, e);

    if (e->time_event)
        avahi_time_event_free(e->time_event);

    avahi_multicast_lookup_engine_notify(c->server->mdns.multicast_lookup_engine, c->interface, e->record, AVAHI_BROWSER_REMOVE);

    avahi_record_unref(e->record);

    avahi_free(e);

    assert(c->n_entries-- >= 1);
}
示例#4
0
static void remove_announcer(AvahiServer *s, AvahiAnnouncer *a) {
    assert(s);
    assert(a);

    if (a->time_event)
        avahi_time_event_free(a->time_event);

    AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_interface, a->interface->announcers, a);
    AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_entry, a->entry->announcers, a);

    avahi_free(a);
}
示例#5
0
static void remove_verifier(AvahiServer *s, AvahiLLMNREntryVerify *ev) {
    assert(s);
    assert(ev);
    assert(ev->e->type == AVAHI_ENTRY_LLMNR);

    if (ev->lq)
        avahi_llmnr_query_scheduler_withdraw_by_id(ev->interface->llmnr.query_scheduler, ev->lq->post_id);

    AVAHI_LLIST_REMOVE(AvahiLLMNREntryVerify, by_interface, ev->interface->llmnr.verifiers, ev);
    AVAHI_LLIST_REMOVE(AvahiLLMNREntryVerify, by_entry, ev->e->proto.llmnr.verifiers, ev);

    avahi_free(ev);
}
static void job_free(AvahiProbeScheduler *s, AvahiProbeJob *pj) {
    assert(pj);

    if (pj->time_event)
        avahi_time_event_free(pj->time_event);

    if (pj->done)
        AVAHI_LLIST_REMOVE(AvahiProbeJob, jobs, s->history, pj);
    else
        AVAHI_LLIST_REMOVE(AvahiProbeJob, jobs, s->jobs, pj);

    avahi_record_unref(pj->record);
    avahi_free(pj);
}
示例#7
0
static void job_free(AvahiQueryScheduler *s, AvahiQueryJob *qj) {
    assert(s);
    assert(qj);

    if (qj->time_event)
        avahi_time_event_free(qj->time_event);

    if (qj->done)
        AVAHI_LLIST_REMOVE(AvahiQueryJob, jobs, s->history, qj);
    else
        AVAHI_LLIST_REMOVE(AvahiQueryJob, jobs, s->jobs, qj);

    avahi_key_unref(qj->key);
    avahi_free(qj);
}
示例#8
0
int avahi_domain_browser_free (AvahiDomainBrowser *b) {
    AvahiClient *client;
    int r = AVAHI_OK;

    assert(b);
    assert(b->ref >= 1);

    if (--(b->ref) >= 1)
        return AVAHI_OK;

    client = b->client;

    if (b->path && avahi_client_is_connected(b->client))
        r = avahi_client_simple_method_call(client, b->path, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "Free");

    AVAHI_LLIST_REMOVE(AvahiDomainBrowser, domain_browsers, client->domain_browsers, b);

    if (b->defer_timeout)
        b->client->poll_api->timeout_free(b->defer_timeout);

    avahi_string_list_free(b->static_browse_domains);
    avahi_free(b->path);
    avahi_free(b);

    return r;
}
示例#9
0
文件: browse.c 项目: Dessperado/avahi
static void lookup_unref(AvahiSRBLookup *l) {
    assert(l);
    assert(l->ref >= 1);

    if (--l->ref >= 1)
        return;

    AVAHI_LLIST_REMOVE(AvahiSRBLookup, lookups, l->record_browser->lookups, l);
    l->record_browser->n_lookups --;

    if (l->wide_area) {
        avahi_wide_area_lookup_free(l->wide_area);
        l->wide_area = NULL;
    }

    if (l->multicast) {
        avahi_multicast_lookup_free(l->multicast);
        l->multicast = NULL;
    }

    while (l->cname_lookups) {
        lookup_unref(l->cname_lookups->data);
        l->cname_lookups = avahi_rlist_remove_by_link(l->cname_lookups, l->cname_lookups);
    }

    avahi_key_unref(l->key);
    avahi_free(l);
}
示例#10
0
void avahi_s_service_resolver_free(AvahiSServiceResolver *r) {
    assert(r);

    AVAHI_LLIST_REMOVE(AvahiSServiceResolver, resolver, r->server->service_resolvers, r);

    if (r->time_event)
        avahi_time_event_free(r->time_event);
    
    if (r->record_browser_srv)
        avahi_s_record_browser_free(r->record_browser_srv);
    if (r->record_browser_txt)
        avahi_s_record_browser_free(r->record_browser_txt);
    if (r->record_browser_a)
        avahi_s_record_browser_free(r->record_browser_a);
    if (r->record_browser_aaaa)
        avahi_s_record_browser_free(r->record_browser_aaaa);

    if (r->srv_record)
        avahi_record_unref(r->srv_record);
    if (r->txt_record)
        avahi_record_unref(r->txt_record);
    if (r->address_record)
        avahi_record_unref(r->address_record);
    
    avahi_free(r->service_name);
    avahi_free(r->service_type);
    avahi_free(r->domain_name);
    avahi_free(r);
}
示例#11
0
static void destroy_timeout(AvahiTimeout *t) {
    assert(t);

    AVAHI_LLIST_REMOVE(AvahiTimeout, timeouts, t->simple_poll->timeouts, t);

    avahi_free(t);
}
示例#12
0
文件: hashmap.c 项目: JDsolution/ipnc
static void entry_free(AvahiHashmap *m, Entry *e, int stolen) {
    unsigned idx;
    assert(m);
    assert(e);

    idx = m->hash_func(e->key) % HASH_MAP_SIZE;

    AVAHI_LLIST_REMOVE(Entry, bucket, m->entries[idx], e);
    AVAHI_LLIST_REMOVE(Entry, entries, m->entries_list, e);

    if (m->key_free_func)
        m->key_free_func(e->key);
    if (m->value_free_func && !stolen)
        m->value_free_func(e->value);

    avahi_free(e);
}
示例#13
0
static void server_info_free(DNSServerInfo *i) {
    assert(i);

    avahi_free(i->address);

    AVAHI_LLIST_REMOVE(DNSServerInfo, servers, servers, i);
    avahi_free(i);
}
示例#14
0
static void job_free(AvahiResponseScheduler *s, AvahiResponseJob *rj) {
    assert(s);
    assert(rj);

    if (rj->time_event)
        avahi_time_event_free(rj->time_event);

    if (rj->state == AVAHI_SCHEDULED)
        AVAHI_LLIST_REMOVE(AvahiResponseJob, jobs, s->jobs, rj);
    else if (rj->state == AVAHI_DONE)
        AVAHI_LLIST_REMOVE(AvahiResponseJob, jobs, s->history, rj);
    else /* rj->state == AVAHI_SUPPRESSED */
        AVAHI_LLIST_REMOVE(AvahiResponseJob, jobs, s->suppressed, rj);

    avahi_record_unref(rj->record);
    avahi_free(rj);
}
示例#15
0
文件: announce.c 项目: rlbartle/avahi
static void remove_announcer(AvahiServer *s, AvahiAnnouncer *a) {
    AvahiEntry *e;

    assert(s);
    assert(a);
    e = a->entry;

    if (a->state == AVAHI_PROBING && e->group)
        e->group->n_probing--;

    if (a->time_event)
        avahi_time_event_free(a->time_event);

    AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_interface, a->interface->announcers, a);
    AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_entry, a->entry->announcers, a);

    avahi_free(a);
}
示例#16
0
void avahi_natpm_maplist_remove_all(void) {

    if (!initialised)
        return;

    while (list_head)
        AVAHI_LLIST_REMOVE(AvahiNatpmMap, map, list_head, list_head);

    map_count = 0;
}
示例#17
0
static void destroy_watch(AvahiWatch *w) {
    assert(w);

    if (w->pollfd_added)
        g_source_remove_poll(&w->glib_poll->source, &w->pollfd);

    AVAHI_LLIST_REMOVE(AvahiWatch, watches, w->glib_poll->watches, w);

    avahi_free(w);
}
示例#18
0
static void destroy_watch(AvahiWatch *w) {
    assert(w);

    remove_pollfd(w);
    AVAHI_LLIST_REMOVE(AvahiWatch, watches, w->simple_poll->watches, w);

    if (!w->dead)
        w->simple_poll->n_watches --;

    avahi_free(w);
}
示例#19
0
void avahi_llmnr_query_job_destroy(AvahiLLMNRQueryScheduler *s, AvahiLLMNRQueryJob *qj) {
    assert(s);
    assert(qj);

    /* Free lq */
    avahi_llmnr_query_destroy(qj->lq);

    /* Free dns packet and time_event */
    if (qj->p)
        avahi_dns_packet_free(qj->p);

    if(qj->time_event)
        avahi_time_event_free(qj->time_event);

    /* Remove from the lists */
    AVAHI_LLIST_REMOVE(AvahiLLMNRQueryJob, jobs_by_scheduler, s->jobs, qj);
    AVAHI_LLIST_REMOVE(AvahiLLMNRQueryJob, jobs_by_interface, s->i->llmnr.queryjobs, qj);

    avahi_free(qj);
}
示例#20
0
文件: browse.c 项目: Dessperado/avahi
void avahi_s_record_browser_destroy(AvahiSRecordBrowser *b) {
    assert(b);

    browser_cancel(b);

    AVAHI_LLIST_REMOVE(AvahiSRecordBrowser, browser, b->server->record_browsers, b);

    avahi_key_unref(b->key);

    avahi_free(b);
}
static void static_host_free(StaticHost *s) {
    assert(s);

    AVAHI_LLIST_REMOVE(StaticHost, hosts, hosts, s);

    avahi_s_entry_group_free (s->group);

    avahi_free(s->host);
    avahi_free(s->ip);
    
    avahi_free(s);
}
示例#22
0
static void cache_entry_free(AvahiWideAreaCacheEntry *c) {
    AvahiWideAreaCacheEntry *t;
    assert(c);

    if (c->time_event)
        avahi_time_event_free(c->time_event);

    AVAHI_LLIST_REMOVE(AvahiWideAreaCacheEntry, cache, c->engine->cache, c);

    t = avahi_hashmap_lookup(c->engine->cache_by_key, c->record->key);
    AVAHI_LLIST_REMOVE(AvahiWideAreaCacheEntry, by_key, t, c);
    if (t)
        avahi_hashmap_replace(c->engine->cache_by_key, avahi_key_ref(c->record->key), t);
    else
        avahi_hashmap_remove(c->engine->cache_by_key, c->record->key);

    c->engine->cache_n_entries --;

    avahi_record_unref(c->record);
    avahi_free(c);
}
void avahi_dbus_async_host_name_resolver_free(AsyncHostNameResolverInfo *i) {
    assert(i);

    if (i->host_name_resolver)
        avahi_s_host_name_resolver_free(i->host_name_resolver);
    dbus_connection_unregister_object_path(server->bus, i->path);
    AVAHI_LLIST_REMOVE(AsyncHostNameResolverInfo, async_host_name_resolvers, i->client->async_host_name_resolvers, i);

    i->client->n_objects--;
    assert(i->client->n_objects >= 0);

    avahi_free(i);
}
示例#24
0
void avahi_entry_group_free(AvahiServer *s, AvahiSEntryGroup *g) {
    assert(s);
    assert(g);

    while (g->entries)
        avahi_entry_free(s, g->entries);

    if (g->register_time_event)
        avahi_time_event_free(g->register_time_event);
    
    AVAHI_LLIST_REMOVE(AvahiSEntryGroup, groups, s->groups, g);
    avahi_free(g);
}
示例#25
0
void iface_done(void) {
    Address *a;
    
    if (fd >= 0) {
        close(fd);
        fd = -1;
    }

    while ((a = addresses)) {
        AVAHI_LLIST_REMOVE(Address, addresses, addresses, a);
        avahi_free(a);
    }
}
示例#26
0
static void job_mark_done(AvahiQueryScheduler *s, AvahiQueryJob *qj) {
    assert(s);
    assert(qj);

    assert(!qj->done);

    AVAHI_LLIST_REMOVE(AvahiQueryJob, jobs, s->jobs, qj);
    AVAHI_LLIST_PREPEND(AvahiQueryJob, jobs, s->history, qj);

    qj->done = 1;

    job_set_elapse_time(s, qj, AVAHI_QUERY_HISTORY_MSEC, 0);
    gettimeofday(&qj->delivery, NULL);
}
示例#27
0
static void remove_service(Config *c, ServiceInfo *i) {
    assert(c);
    assert(i);

    AVAHI_LLIST_REMOVE(ServiceInfo, info, services, i);

    if (i->resolver)
        avahi_service_resolver_free(i->resolver);

    avahi_free(i->name);
    avahi_free(i->type);
    avahi_free(i->domain);
    avahi_free(i);
}
示例#28
0
static void job_mark_done(AvahiProbeScheduler *s, AvahiProbeJob *pj) {
    assert(s);
    assert(pj);

    assert(!pj->done);

    AVAHI_LLIST_REMOVE(AvahiProbeJob, jobs, s->jobs, pj);
    AVAHI_LLIST_PREPEND(AvahiProbeJob, jobs, s->history, pj);

    pj->done = 1;

    job_set_elapse_time(s, pj, AVAHI_PROBE_HISTORY_MSEC, 0);
    gettimeofday(&pj->delivery, NULL);
}
示例#29
0
static void static_service_free(StaticService *s) {
    assert(s);

    AVAHI_LLIST_REMOVE(StaticService, services, s->group->services, s);

    avahi_free(s->type);
    avahi_free(s->host_name);
    avahi_free(s->domain_name);

    avahi_string_list_free(s->txt_records);
    avahi_string_list_free(s->subtypes);

    avahi_free(s);
}
void avahi_dbus_domain_browser_free(DomainBrowserInfo *i) {
    assert(i);

    if (i->domain_browser)
        avahi_s_domain_browser_free(i->domain_browser);
    dbus_connection_unregister_object_path(server->bus, i->path);
    avahi_free(i->path);
    AVAHI_LLIST_REMOVE(DomainBrowserInfo, domain_browsers, i->client->domain_browsers, i);

    i->client->n_objects--;
    assert(i->client->n_objects >= 0);

    avahi_free(i);
}