mtimeout.1: Use correct dash for number ranges.
[misc] / gai.1
CommitLineData
d3fafed3
MW
1.\" -*-nroff-*-
2.ie t .ds o \(bu
3.el .ds o *
4.de hP
5.IP
6\fB\h'-\w'\\$1'u-1m'\\$1\h'1m'\fP\c
7..
8.TH space 1 "13 September 2017" "Straylight/Edgeware"
9.SH NAME
10gai \- look up names using getaddrinfo
11.SH SYNOPSIS
12.B gai
13.RB [ \-CNacgimnsuv ]
14.RB [ \-f
15.IR family ]
16.RB [ \-p
17.IR protocol ]
18.RB [ \-t
19.IR type ]
20.I name
21.RI [ service ]
22.SH DESCRIPTION
23The
24.B gai
25program looks up host and/or service names
26using the
27.BR getaddrinfo (3)
28C-library function,
29and reports the results in a machine-readable manner.
30.PP
31The following command-line options are recognized.
32.TP
33.B \-h
34Give a short help message describing the options available.
35.TP
36.B \-a
37If
38.B \-m
39is set,
40report plain IPv4 address
41.I in addition to
42the corresponding v6-mapped addresses.
43Sets the
44.B AI_ALL
45flag.
46See also
47.BR \-m .
48.TP
49.B \-c
50Report the canonical name of the host.
51Sets the
52.B AI_CANONNAME
53flag.
54See also
55.BR \-C .
56.TP
57.B \-C
58If the canonical name is an IDN,
59then convert it back into the local character set before display.
60Sets the
61.B AI_CANONIDN
62flag.
63See also
64.BR \-c .
65.TP
66.BI "\-f " family
67Return only addresses for the given address
68.IR family ,
69which may be one of
70.B unspec
71(any address family is acceptable; the default),
72.B inet
73(IPv4), or
74.B inet6
75(IPv6).
76Sets the
77.B ai_family
78hint.
79.TP
80.B \-g
81Return only addresses of families
82for which the host has a configured address.
83This is less useful than it sounds
84because of IPv6 link-local addresses.
85Sets the
86.B AI_ADDRCONFIG
87flag.
88.TP
89.B \-i
90Convert hostnames containing unusual characters to IDNs.
91Sets the
92.B AI_IDN
93flag.
94.TP
95.B \-m
96Return IPv4 addresses as their v6-mapped equivalents.
97Sets the
98.B AI_V4MAPPED
99flag.
100See also
101.BR \-a .
102.TP
103.B \-n
104Accept only numeric host addresses;
105do not attempt to resolve hostnames.
106(Scope ids on link-local IPv6 addresses are still accepted.)
107Sets the
108.B AI_NUMERICHOST
109flag.
110See also
111.BR \-N .
112.TP
113.B \-n
114Accept only numeric port numbers;
115do not attempt to resolve service names.
116Sets the
117.B AI_NUMERICSERV
118flag.
119See also
120.BR \-n .
121.TP
122.BI "\-p " protocol
123Return only addresses suitable for use with the given
124.I protocol ,
125which may be a protocol number
126or a name to be looked up in
127.BR /etc/protocols .
128Sets the
129.B ai_protocol
130hint.
131.TP
132.B \-s
133Allow unassigned Unicode code points in IDNs.
134Sets the
135.B AI_IDN_ALLOW_UNASSIGNED
136flag.
137See also
138.B \-C
139and
140.BR \-i .
141.TP
142.BI "\-t " type
143Return only addresses for the given socket
144.I type ,
145which may be one of
146.B any
147(no restriction; the default),
148.BR stream ,
149.BR dgram ,
150or
151.BR raw .
152Sets the
153.B ai_socktype
154hint.
155.TP
156.B \-u
157Check that the result of IDN conversion is a valid STD3 host name.
158Sets the
159.B AI_IDN_USE_STD3_ASCII_RULES
160flag.
161See also
162.B \-C
163and
164.BR \-i .
165.TP
166.B \-v
167Default the host address suitably for use for receiving connections;
168if
169.I name
170is
171.RB ` \- '
172then return appropriate wildcard addresses rather than loopback
173addresses.
174Sets the
175.B AI_PASSIVE
176flag.
177.PP
178The
179.I name
180may be
181.RB ` \- '
182to indicate that a service-only lookup should be performed.
183The
184.I service
185may be omitted to indicate that a hostname-only lookup should be
186performed.
187.PP
188The output is as follows.
189Firstly, if
190.B \-c
191is set, then a line
192.IP
193.BI [ canon ]
194.PP
195is written showing the canonical host name.
196Following this (if it's present) are one or more lines of the form
197.IP
198.IR family " " type " " address " " port
199.PP
200The
201.I family
202shows the address family of the given address, as either
203.B inet
204or
205.BR inet6 .
206The
207.I type
208shows the socket type, as
209.BR stream ,
210.BR dgram ,
211or
212.BR raw .
213The
214.I address
215and
216.I port
217are the numeric address and service,
218as produced by
219.BR getnameinfo (3).
220.SH AUTHOR
221Mark Wooding, <mdw@distorted.org.uk>