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