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