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