Logo Search packages:      
Sourcecode: avahi version File versions  Download package

AvahiSRecordBrowser* avahi_s_record_browser_new ( AvahiServer server,
AvahiIfIndex  interface,
AvahiProtocol  protocol,
AvahiKey key,
AvahiLookupFlags  flags,
AvahiSRecordBrowserCallback  callback,
void *  userdata 
)

Create a new browsing object for arbitrary RRs

Parameters:
server  The server object to which attach this query
interface  Logical OS interface number where to look for the records, or AVAHI_IF_UNSPEC to look on interfaces
protocol  Protocol number to use when looking for the record, or AVAHI_PROTO_UNSPEC to look on all protocols
key  The search key
flags  Lookup flags. Must have set either AVAHI_LOOKUP_FORCE_WIDE_AREA or AVAHI_LOOKUP_FORCE_MULTICAST, since domain based detection is not available here.
callback  The callback to call on browsing events
userdata  Arbitrary use suppliable data which is passed to the callback

Definition at line 522 of file browse.c.

References AVAHI_ERR_INVALID_FLAGS, AVAHI_ERR_INVALID_INTERFACE, AVAHI_ERR_INVALID_KEY, AVAHI_ERR_INVALID_PROTOCOL, AVAHI_ERR_IS_PATTERN, AVAHI_ERR_NO_MEMORY, AVAHI_LLIST_HEAD_INIT, and AVAHI_LLIST_PREPEND.

                    {

    AvahiSRecordBrowser *b;

    assert(server);
    assert(key);
    assert(callback);

    AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
    AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
    AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !avahi_key_is_pattern(key), AVAHI_ERR_IS_PATTERN);
    AVAHI_CHECK_VALIDITY_RETURN_NULL(server, avahi_key_is_valid(key), AVAHI_ERR_INVALID_KEY);
    AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
    AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !(flags & AVAHI_LOOKUP_USE_WIDE_AREA) || !(flags & AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);

    if (!(b = avahi_new(AvahiSRecordBrowser, 1))) {
        avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
        return NULL;
    }

    b->dead = 0;
    b->server = server;
    b->interface = interface;
    b->protocol = protocol;
    b->key = avahi_key_ref(key);
    b->flags = flags;
    b->callback = callback;
    b->userdata = userdata;
    b->n_lookups = 0;
    AVAHI_LLIST_HEAD_INIT(AvahiSRBLookup, b->lookups);
    b->root_lookup = NULL;

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

    /* The currently cached entries are scanned a bit later, and than we will start querying, too */
    b->defer_time_event = avahi_time_event_new(server->time_event_queue, NULL, defer_callback, b);
    assert(b->defer_time_event);

    return b;
}


Generated by  Doxygen 1.6.0   Back to index