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 mDNS 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 mDNS 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/DNSServiceDiscovery/DNSServiceDiscovery.h . 46*48a54d36SAndroid Build Coastguard WorkerNote that this Mach-based API, first introduced in Mac OS X 10.2, 47*48a54d36SAndroid Build Coastguard Workeris now deprecated in favour of the newer 48*48a54d36SAndroid Build Coastguard Worker.Pa /usr/include/dns_sd.h 49*48a54d36SAndroid Build Coastguard WorkerAPI, which is built on Unix Domain Sockets and is supported on 50*48a54d36SAndroid Build Coastguard Workermultiple platforms. 51*48a54d36SAndroid Build Coastguard WorkerThe command-line tool to exercise the cross-platform 52*48a54d36SAndroid Build Coastguard Worker.Pa dns_sd.h 53*48a54d36SAndroid Build Coastguard WorkerAPI is 54*48a54d36SAndroid Build Coastguard Worker.Xr dns-sd 1 . 55*48a54d36SAndroid Build Coastguard Worker.Pp 56*48a54d36SAndroid Build Coastguard WorkerThe 57*48a54d36SAndroid Build Coastguard Worker.Nm 58*48a54d36SAndroid Build Coastguard Workercommand is primarily intended for interactive use. 59*48a54d36SAndroid Build Coastguard WorkerBecause its command-line arguments and output format are subject to change, 60*48a54d36SAndroid Build Coastguard Workerinvoking it from a shell script will generally be fragile. Additionally, 61*48a54d36SAndroid Build Coastguard Workerthe asynchronous nature of DNS Service Discovery does 62*48a54d36SAndroid Build Coastguard Workernot lend itself easily to script-oriented programming. For example, 63*48a54d36SAndroid Build Coastguard Workercalls like "browse" never complete; the action of performing a "browse" 64*48a54d36SAndroid Build Coastguard Workersets in motion machinery to notify the client whenever instances of 65*48a54d36SAndroid Build Coastguard Workerthat service type appear or disappear from the network. These 66*48a54d36SAndroid Build Coastguard Workernotifications continue to be delivered indefinitely, for minutes, 67*48a54d36SAndroid Build Coastguard Workerhours, or even days, as services come and go, until the client 68*48a54d36SAndroid Build Coastguard Workerexplicitly terminates the call. This style of asynchronous interaction 69*48a54d36SAndroid Build Coastguard Workerworks best with applications that are either multi-threaded, or use a 70*48a54d36SAndroid Build Coastguard Workermain event-handling loop to receive keystrokes, network data, and other 71*48a54d36SAndroid Build Coastguard Workerasynchronous event notifications as they happen. 72*48a54d36SAndroid Build Coastguard Worker.br 73*48a54d36SAndroid Build Coastguard WorkerIf you wish to perform DNS Service Discovery operations from a 74*48a54d36SAndroid Build Coastguard Workerscripting language, then the best way to do this is not to execute the 75*48a54d36SAndroid Build Coastguard Worker.Nm 76*48a54d36SAndroid Build Coastguard Workercommand and then attempt to decipher the textual output, but instead to 77*48a54d36SAndroid Build Coastguard Workerdirectly call the DNS-SD APIs using a binding for your chosen language. 78*48a54d36SAndroid Build Coastguard Worker.br 79*48a54d36SAndroid Build Coastguard WorkerFor example, if you are programming in Ruby, then you can 80*48a54d36SAndroid Build Coastguard Workerdirectly call DNS-SD APIs using the dnssd package documented at 81*48a54d36SAndroid Build Coastguard Worker.Pa <http://rubyforge.org/projects/dnssd/> . 82*48a54d36SAndroid Build Coastguard Worker.br 83*48a54d36SAndroid Build Coastguard WorkerSimilar bindings for other languages are also in development. 84*48a54d36SAndroid Build Coastguard Worker.Pp 85*48a54d36SAndroid Build Coastguard Worker.Bl -tag -width R 86*48a54d36SAndroid Build Coastguard Worker.It Nm Fl R Ar name type domain port Op Ar key=value ... 87*48a54d36SAndroid Build Coastguard Workerregister (advertise) a service in the specified 88*48a54d36SAndroid Build Coastguard Worker.Ar domain 89*48a54d36SAndroid Build Coastguard Workerwith the given 90*48a54d36SAndroid Build Coastguard Worker.Ar name 91*48a54d36SAndroid Build Coastguard Workerand 92*48a54d36SAndroid Build Coastguard Worker.Ar type 93*48a54d36SAndroid Build Coastguard Workeras listening (on the current machine) on 94*48a54d36SAndroid Build Coastguard Worker.Ar port. 95*48a54d36SAndroid Build Coastguard Worker.Pp 96*48a54d36SAndroid Build Coastguard Worker.Ar name 97*48a54d36SAndroid Build Coastguard Workercan be arbitrary unicode text, containing any legal unicode characters 98*48a54d36SAndroid Build Coastguard Worker(including dots, spaces, slashes, colons, etc. without restriction), 99*48a54d36SAndroid Build Coastguard Workerup to 63 UTF-8 bytes long. 100*48a54d36SAndroid Build Coastguard Worker.Ar type 101*48a54d36SAndroid Build Coastguard Workermust be of the form "_app-proto._tcp" or "_app-proto._udp", where 102*48a54d36SAndroid Build Coastguard Worker"app-proto" is an application protocol name registered at 103*48a54d36SAndroid Build Coastguard Worker.Pa http://www.dns-sd.org/ServiceTypes.html . 104*48a54d36SAndroid Build Coastguard Worker.Pp 105*48a54d36SAndroid Build Coastguard Worker.Ar domain 106*48a54d36SAndroid Build Coastguard Workeris the domain in which to register the service. 107*48a54d36SAndroid Build Coastguard WorkerIn current implementations, only the local multicast domain "local" is 108*48a54d36SAndroid Build Coastguard Workersupported. In the future, registering will be supported in any arbitrary 109*48a54d36SAndroid Build Coastguard Workerdomain that has a working DNS Update server [RFC 2136]. The 110*48a54d36SAndroid Build Coastguard Worker.Ar domain 111*48a54d36SAndroid Build Coastguard Worker"." is a synonym for "pick a sensible default" which today 112*48a54d36SAndroid Build Coastguard Workermeans "local". 113*48a54d36SAndroid Build Coastguard Worker.Pp 114*48a54d36SAndroid Build Coastguard Worker.Ar port 115*48a54d36SAndroid Build Coastguard Workeris a number from 0 to 65535, and is the TCP or UDP port number upon 116*48a54d36SAndroid Build Coastguard Workerwhich the service is listening. 117*48a54d36SAndroid Build Coastguard Worker.Pp 118*48a54d36SAndroid Build Coastguard WorkerAdditional attributes of the service may optionally be described by 119*48a54d36SAndroid Build Coastguard Workerkey/value pairs, which are stored in the advertised service's DNS TXT 120*48a54d36SAndroid Build Coastguard Workerrecord. Allowable keys and values are listed with the service 121*48a54d36SAndroid Build Coastguard Workerregistration at 122*48a54d36SAndroid Build Coastguard Worker.Pa http://www.dns-sd.org/ServiceTypes.html . 123*48a54d36SAndroid Build Coastguard Worker.It Nm Fl B Ar type domain 124*48a54d36SAndroid Build Coastguard Workerbrowse for instances of service 125*48a54d36SAndroid Build Coastguard Worker.Ar type 126*48a54d36SAndroid Build Coastguard Workerin 127*48a54d36SAndroid Build Coastguard Worker.Ar domain . 128*48a54d36SAndroid Build Coastguard Worker.Pp 129*48a54d36SAndroid Build Coastguard WorkerFor valid 130*48a54d36SAndroid Build Coastguard Worker.Ar type Ns s 131*48a54d36SAndroid Build Coastguard Workersee 132*48a54d36SAndroid Build Coastguard Worker.Pa http://www.dns-sd.org/ServiceTypes.html 133*48a54d36SAndroid Build Coastguard Workeras described above. Omitting the 134*48a54d36SAndroid Build Coastguard Worker.Ar domain 135*48a54d36SAndroid Build Coastguard Workeror using "." means "pick a sensible default." 136*48a54d36SAndroid Build Coastguard Worker.It Nm Fl L Ar name type domain 137*48a54d36SAndroid Build Coastguard Workerlook up and display the information necessary to contact and use the 138*48a54d36SAndroid Build Coastguard Workernamed service: the hostname of the machine where that service is 139*48a54d36SAndroid Build Coastguard Workeravailable, the port number on which the service is listening, and (if 140*48a54d36SAndroid Build Coastguard Workerpresent) TXT record attributes describing properties of the service. 141*48a54d36SAndroid Build Coastguard Worker.Pp 142*48a54d36SAndroid Build Coastguard WorkerNote that in a typical application, browsing happens rarely, while lookup 143*48a54d36SAndroid Build Coastguard Worker(or "resolving") happens every time the service is used. For example, a 144*48a54d36SAndroid Build Coastguard Workeruser browses the network to pick a default printer fairly rarely, but once 145*48a54d36SAndroid Build Coastguard Workera default printer has been picked, that named service is resolved to its 146*48a54d36SAndroid Build Coastguard Workercurrent IP address and port number every time the user presses Cmd-P to 147*48a54d36SAndroid Build Coastguard Workerprint. 148*48a54d36SAndroid Build Coastguard Worker.El 149*48a54d36SAndroid Build Coastguard Worker.Sh EXAMPLES 150*48a54d36SAndroid Build Coastguard Worker.Pp 151*48a54d36SAndroid Build Coastguard WorkerTo advertise the existence of LPR printing service on port 515 on this 152*48a54d36SAndroid Build Coastguard Workermachine, such that it will be discovered by the Mac OS X printing software 153*48a54d36SAndroid Build Coastguard Workerand other DNS-SD compatible printing clients, use: 154*48a54d36SAndroid Build Coastguard Worker.Pp 155*48a54d36SAndroid Build Coastguard Worker.Dl Nm Fl R Ns \ \&"My Test\&" _printer._tcp. \&. 515 pdl=application/postscript 156*48a54d36SAndroid Build Coastguard Worker.Pp 157*48a54d36SAndroid Build Coastguard WorkerFor this registration to be useful, you need to actually have LPR service 158*48a54d36SAndroid Build Coastguard Workeravailable on port 515. Advertising a service that does not exist is not 159*48a54d36SAndroid Build Coastguard Workervery useful, and will be confusing and annoying to other people on the 160*48a54d36SAndroid Build Coastguard Workernetwork. 161*48a54d36SAndroid Build Coastguard Worker.Pp 162*48a54d36SAndroid Build Coastguard WorkerSimilarly, to advertise a web page being served by an HTTP 163*48a54d36SAndroid Build Coastguard Workerserver on port 80 on this machine, such that it will show up in the 164*48a54d36SAndroid Build Coastguard WorkerBonjour list in Safari and other DNS-SD compatible Web clients, use: 165*48a54d36SAndroid Build Coastguard Worker.Pp 166*48a54d36SAndroid Build Coastguard Worker.Dl Nm Fl R Ns \ \&"My Test\&" _http._tcp \&. 80 path=/path-to-page.html 167*48a54d36SAndroid Build Coastguard Worker.Pp 168*48a54d36SAndroid Build Coastguard WorkerTo find the advertised web pages on the local network (the same list that 169*48a54d36SAndroid Build Coastguard WorkerSafari shows), use: 170*48a54d36SAndroid Build Coastguard Worker.Pp 171*48a54d36SAndroid Build Coastguard Worker.Dl Nm Fl B Ns \ _http._tcp 172*48a54d36SAndroid Build Coastguard Worker.Pp 173*48a54d36SAndroid Build Coastguard WorkerWhile that command is running, in another window, try the 174*48a54d36SAndroid Build Coastguard Worker.Nm Fl R 175*48a54d36SAndroid Build Coastguard Workerexample given above to advertise a web page, and you should see the 176*48a54d36SAndroid Build Coastguard Worker"Add" event reported to the 177*48a54d36SAndroid Build Coastguard Worker.Nm Fl B 178*48a54d36SAndroid Build Coastguard Workerwindow. Now press Ctrl-C in the 179*48a54d36SAndroid Build Coastguard Worker.Nm Fl R 180*48a54d36SAndroid Build Coastguard Workerwindow and you should see the "Remove" event reported to the 181*48a54d36SAndroid Build Coastguard Worker.Nm Fl B 182*48a54d36SAndroid Build Coastguard Workerwindow. 183*48a54d36SAndroid Build Coastguard Worker.Pp 184*48a54d36SAndroid Build Coastguard Worker.Sh FILES 185*48a54d36SAndroid Build Coastguard Worker.Pa /usr/bin/mDNS \" Pathname 186*48a54d36SAndroid Build Coastguard Worker.\" 187*48a54d36SAndroid Build Coastguard Worker.Sh SEE ALSO 188*48a54d36SAndroid Build Coastguard Worker.Xr dns-sd 1 189*48a54d36SAndroid Build Coastguard Worker.Xr mDNSResponder 8 190*48a54d36SAndroid Build Coastguard Worker.\" 191*48a54d36SAndroid Build Coastguard Worker.Sh BUGS 192*48a54d36SAndroid Build Coastguard Worker.Nm 193*48a54d36SAndroid Build Coastguard Workerbugs are tracked in Apple Radar component "mDNSResponder". 194*48a54d36SAndroid Build Coastguard Worker.\" 195*48a54d36SAndroid Build Coastguard Worker.Sh HISTORY 196*48a54d36SAndroid Build Coastguard WorkerThe 197*48a54d36SAndroid Build Coastguard Worker.Nm 198*48a54d36SAndroid Build Coastguard Workercommand first appeared in Mac OS X 10.3 (Panther). 199