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