dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / share / man / man3dns_sd / DNSServiceBrowse.3dns_sd
blobfe63d8e6fe20908040746a826fc12203cb258e74
1 '\" te
2 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH DNSSERVICEBROWSE 3DNS_SD "Aug 20, 2007"
7 .SH NAME
8 DNSServiceBrowse \- browse service instances with DNS
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-ldns_sd\fR [ \fIlibrary\fR ... ]
13 #include <dns_sd.h>
15 \fBDNSServiceErrorType\fR \fIDNSServiceBrowse\fR(\fBDNSServiceRef\fR *\fIsdRef\fR,
16      \fBDNSServiceFlags\fR \fIflags\fR, \fBuint32_t\fR \fIinterfaceIndex\fR,
17      \fBconst char\fR *\fIregtype\fR, \fBconst char\fR *\fIdomain\fR,
18      \fBDNSServiceServiceBrowseReply\fR \fIcallBack\fR, \fBvoid\fR *\fIcontext\fR);
19 .fi
21 .LP
22 .nf
23 \fBtypedef\fR \fIvoid\fR(*\fBDNSServiceBrowseReply\fR)(\fBDNSServiceRef\fR \fIsdRef\fR,
24      \fBDNSServiceFlags\fR \fIflags\fR, \fBuint32_t\fR \fIinterfaceIndex\fR,
25      \fBDNSServiceErrorType\fR \fIerrorCode\fR, \fBconst char\fR *\fIserviceName\fR,
26      \fBconst char\fR *\fIregtype\fR, \fBconst char\fR *\fIreplyDomain\fR,
27      \fBvoid\fR *\fIcontext\fR);
28 .fi
30 .SH DESCRIPTION
31 .sp
32 .LP
33 The \fBDNSServiceBrowse()\fR function is used to browse for service instances
34 of a particular service and protocol type. The \fIsdRef\fR argument points to
35 an uninitialized \fIDNSServiceRef\fR. If the call to \fBDNSServiceBrowse\fR
36 succeeds \fIsdRef\fR is initialized. The \fIflags\fR argument to
37 \fBDNSServiceBrowse()\fR is currently unused and reserved for future use. A
38 nonzero value to \fIinterfaceIndex\fR indicates \fBDNSServiceBrowse()\fR should
39 do a browse on all interfaces. Most applications will use an
40 \fIinterfaceIndex\fR value of \fB0\fR to perform a browse on all interfaces.
41 See the section "Constants for specifying an interface index" in
42 \fB<dns_sd.h>\fR for more details.
43 .sp
44 .LP
45 The callback function is invoked for every service instance found matching the
46 service type and protocol. The \fIcallback\fR argument points to a function of
47 type \fBDNSServiceBrowseReply\fR listed above. The \fBDNSServiceBrowse()\fR
48 call returns browse results asynchronously. The service browse call can be
49 terminated by applications with a call to \fBDNSServiceRefDeallocate()\fR.
50 .sp
51 .LP
52 The \fIregtype\fR parameter is used to specify the service type and protocol
53 (e.g. \fB_ftp\fR.\fB_tcp\fR). The protocol type must be \fBTCP\fR or \fBUDP\fR.
54 The \fIdomain\fR argument to \fBDNSServiceBrowse()\fR specifies the domain on
55 which to browse for services. Most applications will not specify a domain and
56 will perform a browse on the default domain(s). The \fIcontext\fR argument can
57 be \fINULL\fR and points to a value passed to the callback function.
58 .sp
59 .LP
60 The \fIsdRef\fR argument passed to the callback function is initialized by
61 \fBDNSServiceBrowse()\fR call. The possible values passed to \fIflags\fR in the
62 callback function are: \fBkDNSServiceFlagsMoreComing\fR and
63 \fBkDNSServiceFlagsAdd\fR. The \fBkDNSServiceFlagsMoreComing\fR value indicates
64 to a callback that at least one more result is immediately available. The
65 \fBkDNSServiceFlagsAdd\fR value indicates that a service instance was found.
66 The \fIerrorCode\fR argument will be \fBkDNSServiceErr_NoError\fR on success.
67 Otherwise, failure is indicated. The discovered service name is returned to the
68 \fIcallback\fR via the \fIserviceName\fR argument. The \fIregtype\fR argument
69 in the callback holds the service type of the found service instance. The
70 discovered service type can be different from the requested service type in the
71 browse request when the discovered service type has subtypes. The domain
72 argument to the callback holds the domain name of the discovered service
73 instance. The service type and the domain name must be stored and passed along
74 with the service name to resolve a service instance using
75 \fBDNSServiceResolve()\fR.
76 .SH RETURN VALUES
77 .sp
78 .LP
79 The \fBDNSServiceBrowse\fR function returns \fBkDNSServiceErr_NoError\fR on
80 success. Otherwise, an error code defined in \fB<dns_sd.h>\fR is returned to
81 indicate an error has occurred. When an error is returned by
82 \fBDNSServiceBrowse\fR, the callback function is not invoked and the
83 \fIDNSServiceRef\fR argument is not initialized.
84 .SH ATTRIBUTES
85 .sp
86 .LP
87 See \fBattributes\fR(5) for description of the following attributes:
88 .sp
90 .sp
91 .TS
92 box;
93 c | c
94 l | l .
95 ATTRIBUTE TYPE  ATTRIBUTE VALUE
97 Interface Stability     Committed
99 MT-Level        Safe
102 .SH SEE ALSO
105 \fBDNSServiceRefDeallocate\fR(3DNS_SD), \fBDNSServiceResolve\fR(3DNS_SD),
106 \fBattributes\fR(5)