]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSShared/dns-sd.1
mDNSResponder-107.4.tar.gz
[apple/mdnsresponder.git] / mDNSShared / dns-sd.1
1 .\" Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved.
2 .\"
3 .\" @APPLE_LICENSE_HEADER_START@
4 .\"
5 .\" This file contains Original Code and/or Modifications of Original Code
6 .\" as defined in and that are subject to the Apple Public Source License
7 .\" Version 2.0 (the 'License'). You may not use this file except in
8 .\" compliance with the License. Please obtain a copy of the License at
9 .\" http://www.opensource.apple.com/apsl/ and read it before using this
10 .\" file.
11 .\"
12 .\" The Original Code and all software distributed under the License are
13 .\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 .\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 .\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 .\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
17 .\" Please see the License for the specific language governing rights and
18 .\" limitations under the License.
19 .\"
20 .\" @APPLE_LICENSE_HEADER_END@
21 .\"
22 .\" $Log: dns-sd.1,v $
23 .\" Revision 1.4 2005/02/16 02:29:32 cheshire
24 .\" Update terminology
25 .\"
26 .\" Revision 1.3 2005/02/10 22:35:28 cheshire
27 .\" <rdar://problem/3727944> Update name
28 .\"
29 .\" Revision 1.2 2004/09/24 18:33:05 cheshire
30 .\" <rdar://problem/3561780> Update man pages to clarify that mDNS and dns-sd are not intended for script use
31 .\"
32 .\" Revision 1.1 2004/09/22 22:46:25 cheshire
33 .\" Man page for dns-sd command-line tool
34 .\"
35 .\"
36 .\"
37 .Dd April 2004 \" Date
38 .Dt dns-sd 1 \" Document Title
39 .Os Darwin \" Operating System
40 .\"
41 .Sh NAME
42 .Nm dns-sd
43 .Nd Multicast DNS (mDNS) & DNS Service Discovery (DNS-SD) Test Tool \" For whatis
44 .\"
45 .Sh SYNOPSIS
46 .Nm Fl R Ar name type domain port Op Ar key=value ...
47 .Pp
48 .Nm Fl B Ar type domain
49 .Pp
50 .Nm Fl L Ar name type domain
51 .\"
52 .Sh DESCRIPTION
53 The
54 .Nm
55 command is a network diagnostic tool, much like
56 .Xr ping 8
57 or
58 .Xr traceroute 8 .
59 However, unlike those tools, most of its functionality is not implemented in the
60 .Nm
61 executable itself, but in library code that is available to any application.
62 The library API that
63 .Nm
64 uses is documented in
65 .Pa /usr/include/dns_sd.h .
66 The
67 .Nm
68 command replaces the older
69 .Xr mDNS 1
70 command.
71 .Pp
72 The
73 .Nm
74 command is primarily intended for interactive use.
75 Because its command-line arguments and output format are subject to change,
76 invoking it from a shell script will generally be fragile. Additionally,
77 the asynchronous nature of DNS Service Discovery does
78 not lend itself easily to script-oriented programming. For example,
79 calls like "browse" never complete; the action of performing a "browse"
80 sets in motion machinery to notify the client whenever instances of
81 that service type appear or disappear from the network. These
82 notifications continue to be delivered indefinitely, for minutes,
83 hours, or even days, as services come and go, until the client
84 explicitly terminates the call. This style of asynchronous interaction
85 works best with applications that are either multi-threaded, or use a
86 main event-handling loop to receive keystrokes, network data, and other
87 asynchronous event notifications as they happen.
88 .br
89 If you wish to perform DNS Service Discovery operations from a
90 scripting language, then the best way to do this is not to execute the
91 .Nm
92 command and then attempt to decipher the textual output, but instead to
93 directly call the DNS-SD APIs using a binding for your chosen language.
94 .br
95 For example, if you are programming in Ruby, then you can
96 directly call DNS-SD APIs using the dnssd package documented at
97 .Pa <http://rubyforge.org/projects/dnssd/> .
98 .br
99 Similar bindings for other languages are also in development.
100 .Pp
101 .Bl -tag -width R
102 .It Nm Fl R Ar name type domain port Op Ar key=value ...
103 register (advertise) a service in the specified
104 .Ar domain
105 with the given
106 .Ar name
107 and
108 .Ar type
109 as listening (on the current machine) on
110 .Ar port.
111 .Pp
112 .Ar name
113 can be arbitrary unicode text, containing any legal unicode characters
114 (including dots, spaces, slashes, colons, etc. without restriction),
115 up to 63 UTF-8 bytes long.
116 .Ar type
117 must be of the form "_app-proto._tcp" or "_app-proto._udp", where
118 "app-proto" is an application protocol name registered at
119 .Pa http://www.dns-sd.org/ServiceTypes.html .
120 .Pp
121 .Ar domain
122 is the domain in which to register the service.
123 In current implementations, only the local multicast domain "local" is
124 supported. In the future, registering will be supported in any arbitrary
125 domain that has a working DNS Update server [RFC 2136]. The
126 .Ar domain
127 "." is a synonym for "pick a sensible default" which today
128 means "local".
129 .Pp
130 .Ar port
131 is a number from 0 to 65535, and is the TCP or UDP port number upon
132 which the service is listening.
133 .Pp
134 Additional attributes of the service may optionally be described by
135 key/value pairs, which are stored in the advertised service's DNS TXT
136 record. Allowable keys and values are listed with the service
137 registration at
138 .Pa http://www.dns-sd.org/ServiceTypes.html .
139 .It Nm Fl B Ar type domain
140 browse for instances of service
141 .Ar type
142 in
143 .Ar domain .
144 .Pp
145 For valid
146 .Ar type Ns s
147 see
148 .Pa http://www.dns-sd.org/ServiceTypes.html
149 as described above. Omitting the
150 .Ar domain
151 or using "." means "pick a sensible default."
152 .It Nm Fl L Ar name type domain
153 look up and display the information necessary to contact and use the
154 named service: the hostname of the machine where that service is
155 available, the port number on which the service is listening, and (if
156 present) TXT record attributes describing properties of the service.
157 .Pp
158 Note that in a typical application, browsing happens rarely, while lookup
159 (or "resolving") happens every time the service is used. For example, a
160 user browses the network to pick a default printer fairly rarely, but once
161 a default printer has been picked, that named service is resolved to its
162 current IP address and port number every time the user presses Cmd-P to
163 print.
164 .El
165 .Sh EXAMPLES
166 .Pp
167 To advertise the existence of LPR printing service on port 515 on this
168 machine, such that it will be discovered by the Mac OS X printing software
169 and other DNS-SD compatible printing clients, use:
170 .Pp
171 .Dl Nm Fl R Ns \ \&"My Test\&" _printer._tcp. \&. 515 pdl=application/postscript
172 .Pp
173 For this registration to be useful, you need to actually have LPR service
174 available on port 515. Advertising a service that does not exist is not
175 very useful, and will be confusing and annoying to other people on the
176 network.
177 .Pp
178 Similarly, to advertise a web page being served by an HTTP
179 server on port 80 on this machine, such that it will show up in the
180 Bonjour list in Safari and other DNS-SD compatible Web clients, use:
181 .Pp
182 .Dl Nm Fl R Ns \ \&"My Test\&" _http._tcp \&. 80 path=/path-to-page.html
183 .Pp
184 To find the advertised web pages on the local network (the same list that
185 Safari shows), use:
186 .Pp
187 .Dl Nm Fl B Ns \ _http._tcp
188 .Pp
189 While that command is running, in another window, try the
190 .Nm Fl R
191 example given above to advertise a web page, and you should see the
192 "Add" event reported to the
193 .Nm Fl B
194 window. Now press Ctrl-C in the
195 .Nm Fl R
196 window and you should see the "Remove" event reported to the
197 .Nm Fl B
198 window.
199 .Pp
200 .Sh FILES
201 .Pa /usr/bin/dns-sd \" Pathname
202 .\"
203 .Sh SEE ALSO
204 .Xr mDNS 1
205 .Xr mDNSResponder 8
206 .\"
207 .Sh BUGS
208 .Nm
209 bugs are tracked in Apple Radar component "mDNSResponder".
210 .\"
211 .Sh HISTORY
212 The
213 .Nm
214 command first appeared in Mac OS X 10.3 (Panther).