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