コード例 #1
0
ファイル: browse.c プロジェクト: Antares84/asuswrt-merlin
static int lookup_start(AvahiSRBLookup *l) {

    assert(l);

    assert((!(l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) && !(l->flags & AVAHI_LOOKUP_USE_LLMNR)) ||
           (!(l->flags & AVAHI_LOOKUP_USE_LLMNR) && !(l->flags & AVAHI_LOOKUP_USE_MULTICAST)) ||
           (!(l->flags & AVAHI_LOOKUP_USE_MULTICAST) && !(l->flags & AVAHI_LOOKUP_USE_WIDE_AREA)));

    assert(!l->wide_area && !l->multicast && !l->llmnr);

    if (l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) {
        /* Wide Area */
        if (!(l->wide_area = avahi_wide_area_lookup_new(l->record_browser->server->wide_area.wide_area_lookup_engine, l->key, lookup_wide_area_callback, l)))
            return -1;
    } else if (l->flags & AVAHI_LOOKUP_USE_MULTICAST) {
        /* Multicast */
        if (!(l->multicast = avahi_multicast_lookup_new(l->record_browser->server->mdns.multicast_lookup_engine, l->interface, l->protocol, l->key, lookup_multicast_callback, l)))
            return -1;
    } else {
        /* LLMNR */
        assert(l->flags & AVAHI_LOOKUP_USE_LLMNR);
        if (!(l->llmnr = avahi_llmnr_lookup_new(l->record_browser->server->llmnr.llmnr_lookup_engine, l->interface, l->protocol, l->key, lookup_llmnr_callback, l)))
            return -1;
    }

    return 0;
}
コード例 #2
0
ファイル: browse.c プロジェクト: Dessperado/avahi
static int lookup_start(AvahiSRBLookup *l) {
    assert(l);

    assert(!(l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) != !(l->flags & AVAHI_LOOKUP_USE_MULTICAST));
    assert(!l->wide_area && !l->multicast);

    if (l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) {

        if (!(l->wide_area = avahi_wide_area_lookup_new(l->record_browser->server->wide_area_lookup_engine, l->key, lookup_wide_area_callback, l)))
            return -1;

    } else {
        assert(l->flags & AVAHI_LOOKUP_USE_MULTICAST);

        if (!(l->multicast = avahi_multicast_lookup_new(l->record_browser->server->multicast_lookup_engine, l->interface, l->protocol, l->key, lookup_multicast_callback, l)))
            return -1;
    }

    return 0;
}