Function

CFNetServiceBrowserSearchForDomains

Searches for domains.

Declaration

Boolean CFNetServiceBrowserSearchForDomains(CFNetServiceBrowserRef browser, Boolean registrationDomains, CFStreamError *error);

Parameters

browser

The CFNetServiceBrowser, obtained by previously calling CFNetServiceBrowserCreate, that is to perform the search; cannot be NULL.

registrationDomains

TRUE to search for only registration domains; FALSE to search for domains that can be browsed for services. For this version of the CFNetServices API, the registration domain is the local domain maintained by the mDNS responder running on the same machine as the calling application.

error

A pointer to a CFStreamError structure, that, if an error occurs, will be set to the error and the error’s domain and passed to your callback function. Pass NULL if you don’t want to receive the error that may occur as a result of this particular call.

Return Value

TRUE if the search was started (asynchronous mode); FALSE if another search is already in progress for this CFNetServiceBrowser or if an error occurred.

Discussion

This function uses a CFNetServiceBrowser to search for domains. The search continues until the search is canceled by calling CFNetServiceBrowserStopSearch. If registrationDomains is TRUE, this function searches only for domains in which services can be registered. If registrationDomains is FALSE, this function searches for domains that can be browsed for services. When a domain is found, the callback function specified when the CFNetServiceBrowser was created is called and passed an instance of a CFStringRef containing the domain that was found.

In asynchronous mode, this function returns TRUE if the search was started. Otherwise, it returns FALSE.

In synchronous mode, this function blocks until the search is stopped by calling CFNetServiceBrowserStopSearch from another thread, in which case it returns FALSE, or until an error occurs.

Special Considerations

This function is thread safe.

For any one CFNetServiceBrowser, only one domain search or one service search can be in progress at the same time.

See Also

Network Services

CFNetServiceRef

An opaque reference representing a CFNetService.

CFNetServiceBrowserRef

An opaque reference representing a CFNetServiceBrowser.

CFNetServiceMonitorRef

An opaque reference for a service monitor.

CFNetServiceMonitorType

Record type specifier used to tell a service monitor the type of record changes to watch for.

CFNetServiceClientContext

A structure provided when a CFNetService is associated with a callback function or when a CFNetServiceBrowser is created.

CFNetServicesError

Error codes that may be returned by CFNetServices functions or passed to CFNetServices callback functions.

CFNetServiceBrowserInvalidate

Invalidates an instance of a Network Service browser object.

CFNetServiceBrowserScheduleWithRunLoop

Schedules a CFNetServiceBrowser on a run loop.

CFNetServiceBrowserCreate

Creates an instance of a Network Service browser object.

CFNetServiceBrowserGetTypeID

Gets the Core Foundation type identifier for the Network Service browser object.

CFNetServiceBrowserSearchForServices

Searches a domain for services of a specified type.

CFNetServiceBrowserStopSearch

Stops a search for domains or services.

CFNetServiceBrowserUnscheduleFromRunLoop

Unschedules a CFNetServiceBrowser from a run loop and mode.

CFNetServiceCancel

Cancels a service registration or a service resolution.

CFNetServiceCreate

Creates an instance of a Network Service object.

CFNetServiceCreateCopy

Creates a copy of a CFNetService object.

CFNetServiceCreateDictionaryWithTXTData

Uses TXT record data to create a dictionary.

CFNetServiceCreateTXTDataWithDictionary

Flattens a set of key/value pairs into a CFDataRef suitable for passing to CFNetServiceSetTXTData.

CFNetServiceGetAddressing

Gets the IP addressing from a CFNetService.

CFNetServiceGetDomain

Gets the domain from a CFNetService.

CFNetServiceGetName

Gets the name from a CFNetService.

CFNetServiceGetPortNumber

This function gets the port number from a CFNetService.

CFNetServiceGetTXTData

Queries a network service for the contents of its TXT records.

CFNetServiceGetTargetHost

Queries a CFNetService for its target hosts.

CFNetServiceGetType

Gets the type from a CFNetService.

CFNetServiceGetTypeID

Gets the Core Foundation type identifier for the Network Service object.

CFNetServiceMonitorCreate

Creates an instance of a NetServiceMonitor object that watches for record changes.

CFNetServiceMonitorGetTypeID

Gets the Core Foundation type identifier for all CFNetServiceMonitor instances.

CFNetServiceMonitorInvalidate

Invalidates an instance of a Network Service monitor object.

CFNetServiceMonitorScheduleWithRunLoop

Schedules a CFNetServiceMonitor on a run loop.

CFNetServiceMonitorStart

Starts monitoring.

CFNetServiceMonitorStop

Stops a CFNetServiceMonitor.

CFNetServiceMonitorUnscheduleFromRunLoop

Unschedules a CFNetServiceMonitor from a run loop.

CFNetServiceRegister

Makes a CFNetService available on the network.

Deprecated
CFNetServiceRegisterWithOptions

Makes a CFNetService available on the network.

CFNetServiceResolve

This function updates the specified CFNetService with the IP address or addresses associated with the service. Call CFNetServiceGetAddressing to get the addresses.

Deprecated
CFNetServiceResolveWithTimeout

Gets the IP address or addresses for a CFNetService.

CFNetServiceSetClient

Associates a callback function with a CFNetService or disassociates a callback function from a CFNetService.

CFNetServiceSetTXTData

Sets the TXT record for a CFNetService.

CFNetServiceUnscheduleFromRunLoop

Unschedules a CFNetService from a run loop.

CFNetServiceScheduleWithRunLoop

Schedules a CFNetService on a run loop.