9070 Remove wanboot from gate
[unleashed.git] / usr / src / man / man3dns_sd / DNSServiceRegister.3dns_sd
blobc385672c1fe34f31d441ffade9c575838ebc74f7
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 DNSSERVICEREGISTER 3DNS_SD "Aug 20, 2007"
7 .SH NAME
8 DNSServiceRegister \- register service 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 \fIDNSServiceRegister\fR(\fBDNSServiceRef\fR *\fIsdRef\fR,
16      \fBDNSServiceFlags\fR \fIflags\fR, \fBuint32_t\fR \fIinterfaceIndex\fR,
17      \fBconst char\fR *\fIname\fR, \fBconst char\fR *\fIregtype\fR,
18      \fBconst char\fR *\fIdomain\fR, \fBconst char\fR *\fIhost\fR,
19      \fBuint16_t\fR \fIport\fR, \fBuint16_t\fR *\fItxtLen\fR, \fBconst void\fR *\fItxtRecord\fR
20      \fBDNSServiceServiceRegisterReply\fR \fIcallBack\fR
21      \fBvoid\fR *\fIcontext\fR);
22 .fi
24 .LP
25 .nf
26 \fBtypedef\fR \fIvoid\fR(*\fBDNSServiceRegisterReply\fR)(\fBDNSServiceRef\fR \fIsdRef\fR,
27      \fBDNSServiceFlags\fR \fIflags\fR, \fBDNSServiceErrorType\fR \fIerrorCode\fR,
28      \fBconst char\fR *\fIname\fR, \fBconst char\fR *\fIregtype\fR,
29      \fBconst char\fR *\fIdomain\fR, \fBvoid\fR *\fIcontext\fR);
30 .fi
32 .SH DESCRIPTION
33 .sp
34 .LP
35 The \fBDNSServiceRegister\fR function is used by clients to advertise a service
36 that uses \fBDNS\fR. The service is registered with multicast \fBDNS\fR if the
37 domain name is \fB\&.local\fR or the interface requested is local only.
38 Otherwise, the service registration is attempted with the unicast \fBDNS\fR
39 server. The callback argument should point to a function of type
40 \fBDNSServiceRegisterReply\fR listed above.
41 .sp
42 .LP
43 The \fIsdRef\fR parameter points to an uninitialized \fBDNSServiceRef\fR
44 instance. If the \fBDNSServiceRegister()\fR call succeeds, \fIsdRef\fR is
45 initialized and \fBkDNSServiceErr_NoError\fR is returned. The service
46 registration remains active until the client terminates the registration by
47 passing the initialized \fIsdRef\fR to \fBDNSServiceRefDeallocate()\fR. The
48 \fIinterfaceIndex\fR when non-zero specifies the interface on which the service
49 should be registered. Most applications pass \fB0\fR to register the service on
50 all interfaces. See the section "Constants for specifying an interface index"
51 in \fB<dns_sd.h>\fR for more details. The \fIflags\fR parameter determines the
52 renaming behavior on a service name conflict. Most applications pass \fB0\fR to
53 allow auto-rename of the service name in case of a name conflict. Applications
54 can pass the flag \fBkDNSServiceFlagsNoAutoRename\fR defined in
55 \fB<dns_sd.h>\fR to disable auto-rename.
56 .sp
57 .LP
58 The \fIregtype\fR indicates the service type followed by the protocol,
59 separated by a dot, for example "\fB_ftp._tcp.\fR". The service type must be an
60 underscore that is followed by 1 to 14 characters that can be letters, digits,
61 or hyphens. The transport protocol must be \fB_tcp\fR or \fB_udp\fR. New
62 service types should be registered at
63 http://www.dns-sd.org/ServiceTypes.html\&. The \fIdomain\fR parameter specifies
64 the domain on which a service is advertised. Most applications leave the
65 \fIdomain\fR parameter \fINULL\fR to register the service in default domains.
66 The \fIhost\fR parameter specifies the \fBSRV\fR target host name. Most
67 applications do not specify the host parameter value. Instead, the default host
68 name of the machine is used. The port value on which the service accepts
69 connections must be passed in network byte order. A value of \fB0\fR for a port
70 is passed to register \fIplaceholder\fR services. Placeholder services are not
71 found when browsing, but other clients cannot register with the same name as
72 the placeholder service.
73 .sp
74 .LP
75 The \fItxtLen\fR parameter specifies the length of the passed \fItxtRecord\fR
76 in bytes. The value must be zero if the \fItxtRecord\fR passed is \fINULL\fR.
77 The \fItxtRecord\fR points to the \fBTXT\fR record rdata. A non-\fINULL\fR
78 \fItxtRecord\fR must be a properly formatted \fBDNS\fR\fBTXT\fR record. For
79 more details see the \fBDNSServiceRegister\fR call defined in
80 \fB<dns_sd.h>\fR\&. The callback argument points to a function to be called
81 when registration completes or when the call asynchronously fails. The client
82 can pass \fINULL\fR for the callback and not be notified of the registration
83 results or asynchronous errors. The client may not pass the \fBNoAutoRename\fR
84 flag if the callback is \fINULL\fR. The client can unregister the service at
85 any time via \fBDNSServiceRefDeallocate()\fR.
86 .sp
87 .LP
88 The callback function argument \fIsdRef\fR is initialized by
89 \fBDNSServiceRegister()\fR. The \fIflags\fR argument in the callback function
90 is currently unused and reserved for future use. The error code returned to the
91 callback is \fBkDNSServiceErr_NoError\fR on success. Otherwise, an error code
92 defined in \fB<dns_sd.h>\fR is returned to indicate an error condition such as
93 a name conflict in \fBkDNSServiceFlagsNoAutoRename\fR mode. The \fIname\fR
94 argument holds the registered service name and the \fIregtype\fR argument is
95 the registered service type passed to \fBDNSServiceRegister()\fR. The domain
96 argument returned in the callback indicates the domain on which the service was
97 registered.
98 .SH RETURN VALUES
99 .sp
101 The \fBDNSServiceRegister\fR function returns \fBkDNSServiceErr_NoError\fR on
102 success. Otherwise, an error code defined in \fB<dns_sd.h>\fR is returned. Upon
103 registration, any subsequent asynchronous errors are delivered to the callback.
104 .SH ATTRIBUTES
107 See \fBattributes\fR(5) for description of the following attributes:
112 box;
113 c | c
114 l | l .
115 ATTRIBUTE TYPE  ATTRIBUTE VALUE
117 Interface Stability     Committed
119 MT-Level        Safe
122 .SH SEE ALSO
125 \fBDNSServiceRefDeallocate\fR(3DNS_SD), \fBattributes\fR(5)