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