xref: /titanic_44/usr/src/man/man3dns_sd/DNSServiceEnumerateDomains.3dns_sd (revision 528b7d8ba791f2da280ff1ddd45c61eb47a2744e)
te
Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
DNSSERVICEENUMERATEDOMAINS 3DNS_SD "Aug 20, 2007"
NAME
DNSServiceEnumerateDomains - enumerate recommended domains
SYNOPSIS

cc [ flag ... ] file ... -ldns_sd [ library ... ]
#include <dns_sd.h>

DNSServiceErrorType DNSServiceEnumerateDomains(DNSServiceRef *sdRef,
 DNSServiceFlags flags, uint32_t interfaceIndex,
 DNSServiceDomainEnumReply callBack, void *context);

typedef void(*DNSServiceDomainEnumReply)(DNSServiceRef sdRef,
 DNSServiceFlags flags, uint31_t interfaceIndex,
 DNSServiceErrorType errorCode, const char *replyDomain,
 void *context);
DESCRIPTION

The DNSServiceEnumerateDomains() function allows applications to determine recommended browsing and registration domains for performing service discovery DNS queries. The callback argument points to a function to be called to return results or if the asynchronous call to DNSServiceEnumerateDomains() fails. The callback function should point to a function of type DNSServiceDomainEnumReply listed above.

A pointer to an uninitialized DNSServiceRef, sdRef must be passed to DNSServiceEnumerateDomains(). If the call succeeds, sdRef is initialized and kDNSServiceErr_NoError is returned. The enumeration call runs indefinitely until the client terminates the call. The enumeration call must be terminated by passing the DNSServiceRef initialized by the enumeration call to DNSServiceRefDeallocate() when no more domains are to be found.

The value of flags is constructed by a bitwise-inclusive-OR of the flags used in DNSService functions and defined in <dns_sd.h>. Possible values for flags to the DNSServiceEnumerateDomains() call are: kDNSServiceFlagsBrowseDomains and kDNSServiceFlagsRegistrationDomains. The kDNSServiceFlagsBrowseDomains value is passed to enumerate domains recommended for browsing. The kDNSServiceFlagsRegistrationDomains value is passed to enumerate domains recommended for registration. Possible values of flags returned in the callback function are: kDNSServiceFlagsMoreComing, kDNSServiceFlagsAdd, and kDNSServiceFlagsDefault.

The interfaceIndex parameter to the enumeration call specifies the interface index searched for domains. Most applications pass 0 to enumerate domains on all interfaces. See the section "Constants for specifying an interface index" in <dns_sd.h> for more details. The context parameter can be NULL and is passed to the enumeration callback function. The interfaceIndex value passed to the callback specifies the interface on which the domain exists.

RETURN VALUES

The DNSServiceEnumerateDomains() function returns kDNSServiceErr_NoError on success. Otherwise, the function returns an error code defined in <dns_sd.h>. The callback is not invoked on error and the DNSServiceRef that is passed is not initialized. Upon a successful call to DNSServiceEnumerateDomains(), subsequent asynchronous errors are delivered to the callback.

ATTRIBUTES

See attributes(5) for description of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Committed
MT-Level Safe
SEE ALSO

DNSServiceRefDeallocate(3DNS_SD), attributes(5)