Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/getaddrinfo/getaddrinfo.1
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
svn:keywords | null | FreeBSD=%H \ No newline at end of property |
svn:mime-type | null | text/plain \ No newline at end of property |
.\" $NetBSD: getaddrinfo.1,v 1.5 2014/04/22 06:02:06 wiz Exp $ | |||||
.\" | |||||
.\" Copyright (c) 2013 The NetBSD Foundation, Inc. | |||||
.\" All rights reserved. | |||||
.\" | |||||
.\" This documentation is derived from text contributed to The NetBSD | |||||
.\" Foundation by Taylor R. Campbell. | |||||
.\" | |||||
.\" Redistribution and use in source and binary forms, with or without | |||||
.\" modification, are permitted provided that the following conditions | |||||
.\" are met: | |||||
.\" 1. Redistributions of source code must retain the above copyright | |||||
.\" notice, this list of conditions and the following disclaimer. | |||||
.\" 2. Redistributions in binary form must reproduce the above copyright | |||||
.\" notice, this list of conditions and the following disclaimer in the | |||||
.\" documentation and/or other materials provided with the distribution. | |||||
.\" | |||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |||||
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |||||
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |||||
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |||||
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |||||
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |||||
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |||||
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||||
.\" POSSIBILITY OF SUCH DAMAGE. | |||||
.\" | |||||
.Dd April 22, 2014 | |||||
.Dt GETADDRINFO 1 | |||||
.Os | |||||
.Sh NAME | |||||
.Nm getaddrinfo | |||||
.Nd resolve names to socket addresses | |||||
.Sh SYNOPSIS | |||||
.Nm | |||||
.Op Fl cNnP | |||||
.Op Fl f Ar family | |||||
.Op Fl p Ar protocol | |||||
.Op Fl s Ar service Ns Op Ns / Ns Ar protocol | |||||
.Op Fl t Ar socktype | |||||
.Op Ar hostname | |||||
.Sh DESCRIPTION | |||||
The | |||||
.Nm | |||||
utility resolves host and service names to socket addresses with | |||||
.Xr getaddrinfo 3 | |||||
wblock: (For this and following comments, I realize you didn't write this, but will comment on areas… | |||||
Done Inline ActionsNo, it uses getaddrinfo(3). This utility prints information that you can obtain with getaddrinfo(3) function in a user-friendly format. ae: No, it uses getaddrinfo(3). This utility prints information that you can obtain with… | |||||
Done Inline ActionsThat's a much better description! utility resolves host and service names to socket addresses with .Xr getaddrinfo 3 and prints them to standard output in a user-friendly format. wblock: That's a much better description!
```utility resolves host and service names to socket… | |||||
Not Done Inline ActionsYes. I didn't write this. Thanks for the review comments, have taken care all of them! lohithbsd_gmail.com: Yes. I didn't write this. Thanks for the review comments, have taken care all of them! | |||||
and prints them to standard output in a user-friendly format. | |||||
.Pp | |||||
The output is a sequence of lines with space-separated fields: | |||||
Done Inline Actions"formats" can be read as a noun, so clarify. routine, then formats them and prints them to standard output. wblock: "formats" can be read as a noun, so clarify.
```routine, then formats them and prints them to… | |||||
.Pp | |||||
.Dl socket-type address-family protocol [af-specific data ...] | |||||
Done Inline Actionss/lines of/lines with/ wblock: s/lines of/lines with/ | |||||
.Pp | |||||
For the | |||||
.Dq inet | |||||
and | |||||
.Dq inet6 | |||||
address families, the af-specific data are the IP/IPv6 address and port | |||||
number. | |||||
.Pp | |||||
Depending on the settings in | |||||
.Xr nsswitch.conf 5 , | |||||
.Nm | |||||
Done Inline ActionsThis whole sentence is redundant and weird. (Some lines in replacement might be too long and need wrapping because of Phabricator's phabulousness.) Depending on the settings in .Xr nsswitch.conf 5 , .Nm might query DNS for answers. However, it is not intended to be a general-purpose DNS query utility. Use .Xr drill 1 for that. wblock: This whole sentence is redundant and weird. (Some lines in replacement might be too long and… | |||||
might query DNS for answers. | |||||
However, it is not intended to be a general-purpose DNS query utility. | |||||
Use | |||||
.Xr drill 1 | |||||
for that. | |||||
.Pp | |||||
These options are available: | |||||
.Bl -tag -width Ds | |||||
.It Fl c | |||||
Look up a canonical name as if with the | |||||
Done Inline Actionss/The following/These/ wblock: s/The following/These/ | |||||
.Dv AI_CANONNAME | |||||
flag to | |||||
.Xr getaddrinfo 3 | |||||
and print it on the first line before the socket addresses. | |||||
.It Fl f Ar family | |||||
Specify an address family. | |||||
Address families are named like the | |||||
.Dv AF_... | |||||
constants for address family numbers in the | |||||
.Aq Pa sys/socket.h | |||||
header file but without the | |||||
.Dv AF_ | |||||
prefix and lowercase. | |||||
For example, | |||||
.Dq inet | |||||
corresponds with | |||||
.Dv AF_INET . | |||||
.It Fl N | |||||
Treat the service as numeric and do not attempt service name | |||||
resolution, as if with the | |||||
.Dv AI_NUMERICSERV | |||||
flag to | |||||
.Xr getaddrinfo 3 . | |||||
.It Fl n | |||||
Treat the hostname as a numeric address and do not attempt name | |||||
resolution, as if with the | |||||
.Dv AI_NUMERICHOST | |||||
flag to | |||||
.Xr getaddrinfo 3 . | |||||
.It Fl P | |||||
Return socket addresses intended for use with | |||||
.Xr bind 2 , | |||||
as if with the | |||||
.Dv AI_PASSIVE | |||||
flag to | |||||
.Xr getaddrinfo 3 . | |||||
By default, the socket addresses are intended for use with | |||||
.Xr connect 2 , | |||||
.Xr sendto 2 , | |||||
or | |||||
.Xr sendmsg 2 . | |||||
.It Fl p Ar protocol | |||||
Specify a protocol. | |||||
Protocols are numeric or symbolic as listed in | |||||
.Xr protocols 5 . | |||||
.It Fl s Ar service Ns Op Ns / Ns Ar protocol | |||||
Specify a service to look up. | |||||
Done Inline ActionsProtocols are numeric or symbolic as listed in wblock: ```Protocols are numeric or symbolic as listed in``` | |||||
Services are symbolic or numeric with an optional | |||||
protocol suffix as listed in | |||||
.Xr services 5 . | |||||
If a service is not specified, a hostname is required. | |||||
Done Inline ActionsServices are symbolic or numeric with an optional wblock: ```Services are symbolic or numeric with an optional``` | |||||
.It Fl t Ar socktype | |||||
Specify a socket type. | |||||
Socket types are named like the | |||||
Done Inline ActionsNegative logic. If a service is not specified, a hostname is required. wblock: Negative logic.
```If a service is not specified, a hostname is required.``` | |||||
.Dv SOCK_... | |||||
constants for socket type numbers in the | |||||
.Aq Pa sys/socket.h | |||||
header file but without the | |||||
.Dv SOCK_ | |||||
prefix and lowercase. | |||||
For example, | |||||
.Dq dgram | |||||
corresponds with | |||||
.Dv SOCK_DGRAM . | |||||
.El | |||||
.Sh EXIT STATUS | |||||
.Ex -std getaddrinfo | |||||
.Sh EXAMPLES | |||||
Look up | |||||
.Dq www.NetBSD.org : | |||||
.Bd -literal -offset indent | |||||
$ getaddrinfo www.NetBSD.org | |||||
dgram inet6 udp 2001:4f8:3:7:2e0:81ff:fe52:9ab6 0 | |||||
dgram inet udp 149.20.53.67 0 | |||||
stream inet6 tcp 2001:4f8:3:7:2e0:81ff:fe52:9ab6 0 | |||||
stream inet tcp 149.20.53.67 0 | |||||
.Ed | |||||
.Pp | |||||
The port number here is zero because no service was specified. | |||||
.Pp | |||||
Look up | |||||
.Dq morden.NetBSD.org | |||||
for stream sockets on port 80, and show the canonical name: | |||||
.Bd -literal -offset indent | |||||
$ getaddrinfo -c -t stream -s 80 morden.NetBSD.org | |||||
canonname ftp.NetBSD.org | |||||
stream inet6 tcp 2001:470:1f05:3d::21 80 | |||||
stream inet tcp 199.233.217.249 80 | |||||
.Ed | |||||
.Sh SEE ALSO | |||||
.Xr drill 1 , | |||||
.Xr getent 1 , | |||||
.Xr getaddrinfo 3 , | |||||
.Xr getnameinfo 3 , | |||||
.Xr resolver 3 , | |||||
.Xr hosts 5 , | |||||
.Xr nsswitch.conf 5 , | |||||
.Xr protocols 5 , | |||||
.Xr resolv.conf 5 , | |||||
.Xr services 5 | |||||
.Sh HISTORY | |||||
The | |||||
.Nm | |||||
command first appeared in | |||||
.Nx 7.0 . |
(For this and following comments, I realize you didn't write this, but will comment on areas that are questionable anyway. It might be nice to relay these upstream even if this does not go in contrib.)
Does "as if" mean it does not use getaddrinfo(1), just is a workalike? This should state clearly exactly what the situation is.