| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: getaddrinfo.1,v 1.1 2013/09/30 06:19:22 riastradh Exp $ | | 1 | .\" $NetBSD: getaddrinfo.1,v 1.2 2013/09/30 08:13:59 wiz Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2013 The NetBSD Foundation, Inc. | | 3 | .\" Copyright (c) 2013 The NetBSD Foundation, Inc. |
4 | .\" All rights reserved. | | 4 | .\" All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" This documentation is derived from text contributed to The NetBSD | | 6 | .\" This documentation is derived from text contributed to The NetBSD |
7 | .\" Foundation by Taylor R. Campbell. | | 7 | .\" Foundation by Taylor R. Campbell. |
8 | .\" | | 8 | .\" |
9 | .\" Redistribution and use in source and binary forms, with or without | | 9 | .\" Redistribution and use in source and binary forms, with or without |
10 | .\" modification, are permitted provided that the following conditions | | 10 | .\" modification, are permitted provided that the following conditions |
11 | .\" are met: | | 11 | .\" are met: |
12 | .\" 1. Redistributions of source code must retain the above copyright | | 12 | .\" 1. Redistributions of source code must retain the above copyright |
13 | .\" notice, this list of conditions and the following disclaimer. | | 13 | .\" notice, this list of conditions and the following disclaimer. |
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 14 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| @@ -17,39 +17,39 @@ | | | @@ -17,39 +17,39 @@ |
17 | .\" | | 17 | .\" |
18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | .\" POSSIBILITY OF SUCH DAMAGE. | | 28 | .\" POSSIBILITY OF SUCH DAMAGE. |
29 | .\" | | 29 | .\" |
30 | .Dd April 25, 2013 | | 30 | .Dd September 30, 2013 |
31 | .Dt GETADDRINFO 1 | | 31 | .Dt GETADDRINFO 1 |
32 | .Os | | 32 | .Os |
33 | .Sh NAME | | 33 | .Sh NAME |
34 | .Nm getaddrinfo | | 34 | .Nm getaddrinfo |
35 | .Nd resolve names to socket addresses | | 35 | .Nd resolve names to socket addresses |
36 | .Sh SYNOPSIS | | 36 | .Sh SYNOPSIS |
37 | .Nm | | 37 | .Nm |
38 | .Op Fl cnNP | | 38 | .Op Fl cNnP |
39 | .Op Fl f Ar family | | 39 | .Op Fl f Ar family |
40 | .Op Fl p Ar protocol | | 40 | .Op Fl p Ar protocol |
41 | .Op Fl t Ar socktype | | | |
42 | .Op Fl s Ar service | | 41 | .Op Fl s Ar service |
| | | 42 | .Op Fl t Ar socktype |
43 | .Op Ar hostname | | 43 | .Op Ar hostname |
44 | .Sh DESCRIPTION | | 44 | .Sh DESCRIPTION |
45 | The | | 45 | The |
46 | .Nm | | 46 | .Nm |
47 | utility resolves host and service names to socket addresses as if with | | 47 | utility resolves host and service names to socket addresses as if with |
48 | the | | 48 | the |
49 | .Xr getaddrinfo 3 | | 49 | .Xr getaddrinfo 3 |
50 | routine and formats them to standard output. | | 50 | routine and formats them to standard output. |
51 | .Pp | | 51 | .Pp |
52 | The output is a sequence of lines of space-separated fields: | | 52 | The output is a sequence of lines of space-separated fields: |
53 | .Dl socket-type address-family protocol [af-specific data ...] | | 53 | .Dl socket-type address-family protocol [af-specific data ...] |
54 | .Pp | | 54 | .Pp |
55 | For the internet family, the address-family-specific data are the | | 55 | For the internet family, the address-family-specific data are the |
| @@ -76,75 +76,73 @@ and print it on the first line before th | | | @@ -76,75 +76,73 @@ and print it on the first line before th |
76 | .It Fl f Ar family | | 76 | .It Fl f Ar family |
77 | Specify an address family. | | 77 | Specify an address family. |
78 | Address families are named like the | | 78 | Address families are named like the |
79 | .Dv AF_... | | 79 | .Dv AF_... |
80 | constants for address family numbers in the | | 80 | constants for address family numbers in the |
81 | .Aq Pa sys/socket.h | | 81 | .Aq Pa sys/socket.h |
82 | header file but without the | | 82 | header file but without the |
83 | .Dv AF_ | | 83 | .Dv AF_ |
84 | prefix and lowercase. | | 84 | prefix and lowercase. |
85 | For example, | | 85 | For example, |
86 | .Dq inet | | 86 | .Dq inet |
87 | corresponds with | | 87 | corresponds with |
88 | .Dv AF_INET . | | 88 | .Dv AF_INET . |
89 | .It Fl n | | | |
90 | Treat the hostname as a numeric address and do not attempt name | | | |
91 | resolution, as if with the | | | |
92 | .Dv AI_NUMERICHOST | | | |
93 | flag to | | | |
94 | .Xr getaddrinfo 3 . | | | |
95 | .It Fl N | | 89 | .It Fl N |
96 | Treat the service as numeric and do not attempt service name | | 90 | Treat the service as numeric and do not attempt service name |
97 | resolution, as if with the | | 91 | resolution, as if with the |
98 | .Dv AI_NUMERICSERV | | 92 | .Dv AI_NUMERICSERV |
99 | flag to | | 93 | flag to |
100 | .Xr getaddrinfo 3 . | | 94 | .Xr getaddrinfo 3 . |
101 | .It Fl s Ar service | | 95 | .It Fl n |
102 | Specify a service to look up. | | 96 | Treat the hostname as a numeric address and do not attempt name |
103 | If no service is specified, a hostname must be specified. | | 97 | resolution, as if with the |
104 | .It Fl p Ar protocol | | 98 | .Dv AI_NUMERICHOST |
105 | Specify a protocol. | | 99 | flag to |
106 | Protocols may be numeric, or symbolic as listed in | | 100 | .Xr getaddrinfo 3 . |
107 | .Xr protocols 5 . | | | |
108 | .It Fl P | | 101 | .It Fl P |
109 | Return socket addresses intended for use with | | 102 | Return socket addresses intended for use with |
110 | .Xr bind 2 , | | 103 | .Xr bind 2 , |
111 | as if with the | | 104 | as if with the |
112 | .Dv AI_PASSIVE | | 105 | .Dv AI_PASSIVE |
113 | flag to | | 106 | flag to |
114 | .Xr getaddrinfo 3 . | | 107 | .Xr getaddrinfo 3 . |
115 | By default, the socket addresses are intended for use with | | 108 | By default, the socket addresses are intended for use with |
116 | .Xr connect 2 , | | 109 | .Xr connect 2 , |
117 | .Xr sendto 2 , | | 110 | .Xr sendto 2 , |
118 | or | | 111 | or |
119 | .Xr sendmsg 2 . | | 112 | .Xr sendmsg 2 . |
| | | 113 | .It Fl p Ar protocol |
| | | 114 | Specify a protocol. |
| | | 115 | Protocols may be numeric, or symbolic as listed in |
| | | 116 | .Xr protocols 5 . |
| | | 117 | .It Fl s Ar service |
| | | 118 | Specify a service to look up. |
| | | 119 | If no service is specified, a hostname must be specified. |
120 | .It Fl t Ar socktype | | 120 | .It Fl t Ar socktype |
121 | Specify a socket type. | | 121 | Specify a socket type. |
122 | Socket types are named like the | | 122 | Socket types are named like the |
123 | .Dv SOCK_... | | 123 | .Dv SOCK_... |
124 | constants for socket type numbers in the | | 124 | constants for socket type numbers in the |
125 | .Aq Pa sys/socket.h | | 125 | .Aq Pa sys/socket.h |
126 | header file but without the | | 126 | header file but without the |
127 | .Dv SOCK_ | | 127 | .Dv SOCK_ |
128 | prefix and lowercase. | | 128 | prefix and lowercase. |
129 | For example, | | 129 | For example, |
130 | .Dq dgram | | 130 | .Dq dgram |
131 | corresponds with | | 131 | corresponds with |
132 | .Dv SOCK_DGRAM . | | 132 | .Dv SOCK_DGRAM . |
133 | .El | | 133 | .El |
134 | .Pp | | 134 | .Sh EXIT STATUS |
135 | The | | 135 | .Ex -std getaddrinfo |
136 | .Nm | | | |
137 | utility exits 0 on success, and \*[Gt]0 if an error occurs. | | | |
138 | .Sh EXAMPLES | | 136 | .Sh EXAMPLES |
139 | Look up | | 137 | Look up |
140 | .Dq www.NetBSD.org : | | 138 | .Dq www.NetBSD.org : |
141 | .Bd -literal -offset indent | | 139 | .Bd -literal -offset indent |
142 | $ getaddrinfo www.NetBSD.org | | 140 | $ getaddrinfo www.NetBSD.org |
143 | dgram inet6 udp 2001:4f8:3:7:2e0:81ff:fe52:9ab6 0 | | 141 | dgram inet6 udp 2001:4f8:3:7:2e0:81ff:fe52:9ab6 0 |
144 | dgram inet udp 149.20.53.67 0 | | 142 | dgram inet udp 149.20.53.67 0 |
145 | stream inet6 tcp 2001:4f8:3:7:2e0:81ff:fe52:9ab6 0 | | 143 | stream inet6 tcp 2001:4f8:3:7:2e0:81ff:fe52:9ab6 0 |
146 | stream inet tcp 149.20.53.67 0 | | 144 | stream inet tcp 149.20.53.67 0 |
147 | .Ed | | 145 | .Ed |
148 | The unspecified service manifested as a port number of zero. | | 146 | The unspecified service manifested as a port number of zero. |
149 | .Pp | | 147 | .Pp |
150 | Look up | | 148 | Look up |