Added descriptions of AI_ALL, AI_ADDRCONFIG, AI_V4MAPPED, and AI_NUMERICSERV.

Some wording and formatting fixes.
1,$s/PF_/AF_/g
This commit is contained in:
Michael Kerrisk 2005-08-09 11:40:12 +00:00
parent 8194de3393
commit 8d18d6ed08
1 changed files with 76 additions and 22 deletions

View File

@ -21,6 +21,10 @@
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
.\" References: RFC 2553 .\" References: RFC 2553
.\"
.\" 2005-08-09, mtk, added AI_ALL, AI_ADDRCONFIG, AI_V4MAPPED,
.\" and AI_NUMERICSERV.
.\"
.TH getaddrinfo 3 2000-12-18 "Linux Man Page" "Linux Programmer's Manual" .TH getaddrinfo 3 2000-12-18 "Linux Man Page" "Linux Programmer's Manual"
.SH NAME .SH NAME
getaddrinfo, freeaddrinfo, gai_strerror \- network address and service translation getaddrinfo, freeaddrinfo, gai_strerror \- network address and service translation
@ -116,9 +120,9 @@ function returns socket addresses in either IPv4 or IPv6
address family, address family,
.RI "(" "ai_family" .RI "(" "ai_family"
will be set to either will be set to either
.B PF_INET .B AF_INET
or or
.BR PF_INET6 ). .BR AF_INET6 ).
.PP .PP
The The
.I hints .I hints
@ -127,9 +131,7 @@ the preferred socket type, or protocol.
A NULL A NULL
.I hints .I hints
specifies that any network address or protocol is acceptable. specifies that any network address or protocol is acceptable.
If this parameter is not If this parameter is not NULL it points to an
.B NULL
it points to an
.B addrinfo .B addrinfo
structure structure
whose whose
@ -138,7 +140,7 @@ whose
and and
.I ai_protocol .I ai_protocol
members specify the preferred socket type. members specify the preferred socket type.
.B PF_UNSPEC .B AF_UNSPEC
in in
.I ai_family .I ai_family
specifies any protocol family (either IPv4 or IPv6, for example). specifies any protocol family (either IPv4 or IPv6, for example).
@ -165,11 +167,9 @@ parameter, but not both, may be NULL.
specifies either a numerical network address specifies either a numerical network address
(dotted-decimal format for IPv4, hexadecimal format for IPv6) (dotted-decimal format for IPv4, hexadecimal format for IPv6)
or a network hostname, whose network addresses are looked up and resolved. or a network hostname, whose network addresses are looked up and resolved.
If the If
.I ai_flags .I hints.ai_flags
member in the contains the
.I hints
parameter contains the
.B AI_NUMERICHOST .B AI_NUMERICHOST
flag then the flag then the
.I node .I node
@ -191,9 +191,7 @@ The
field of the first of these field of the first of these
.B addrinfo .B addrinfo
structures is set to point to the official name of the host, if structures is set to point to the official name of the host, if
.I ai_flags .I hints.ai_flags
in
.I hints
includes the includes the
.B AI_CANONNAME .B AI_CANONNAME
flag. flag.
@ -219,11 +217,8 @@ is NULL,
the the
network address in each socket structure is initialized according to the network address in each socket structure is initialized according to the
.B AI_PASSIVE .B AI_PASSIVE
flag, which is set in the flag, which is set in
.I ai_flags .IR hints.ai_flags .
member of the
.I hints
parameter.
The network address in each socket structure will be left unspecified The network address in each socket structure will be left unspecified
if if
.B AI_PASSIVE .B AI_PASSIVE
@ -237,11 +232,57 @@ flag is not set.
This is used by client applications, which intend to connect This is used by client applications, which intend to connect
to a server running on the same network host. to a server running on the same network host.
.PP .PP
If
.I hints.ai_flags
includes the
.B AI_ADDRCONFIG
flag, then IPv4 addresses are returned in the list pointed to by
.I result
only if the local system has at least has at least one
IPv4 address configured, and IPv6 addresses are only returned
if the local system has at least one IPv6 address configured.
.PP
If
.I hint.ai_flags
specifies the
.B AI_V4MAPPED
flag, and
.I hints.ai_family
was specified as
.BR AF_INET6 ,
and no matching IPv6 addresses could be found,
then return IPv4-mapped IPv6 addresses in the list pointed to by
.IR result .
If both
.B AI_V4MAPPED
and
.B AI_ALL
are specified in
.IR hints.ai_family ,
then return both IPv6 and IPv4-mapped IPv6 addresses
in the list pointed to by
.IR result .
.B AI_ALL
is ignored if
.B AI_V4MAPPED
is not also specified.
.PP
.I service .I service
sets the port number in the network address of each socket structure. sets the port number in the network address of each socket structure.
If If
.I service .I service
is NULL the port number will be left uninitialized. is NULL the port number will be left uninitialized.
If
.B AI_NUMERICSERV
is specified in
.IR hints.ai_flags
and
.I service
is not NULL, then
.I service
must point to a string containing a numeric port number.
This flag is used to inhibit the invocation of a name resolution service
in cases where it is known not to be required.
.PP .PP
The The
.BR freeaddrinfo (3) .BR freeaddrinfo (3)
@ -267,12 +308,17 @@ The
.I node .I node
or or
.I service .I service
is not known. is not known; or both
This error is also returned if both
.I node .I node
and and
.I service .I service
are NULL. are NULL; or
.B AI_NUMERICSERV
was specified in
.I hints.ai_flags
and
.I service
was not a numeric port-number string.
.TP .TP
.B EAI_SERVICE .B EAI_SERVICE
The requested service is not available for the requested socket type. The requested service is not available for the requested socket type.
@ -310,6 +356,14 @@ POSIX 1003.1-2003.
The The
.B getaddrinfo() .B getaddrinfo()
function is documented in RFC\ 2553. function is documented in RFC\ 2553.
.SH "NOTES"
.BR AI_ADDRCONFIG ,
.BR AI_ALL,
and
.BR AI_V4MAPPED
are available since glibc 2.3.3.
.BR AI_NUMERICSERV
is available since glibc 2.3.4.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR getipnodebyaddr (3), .BR getipnodebyaddr (3),
.BR getipnodebyname (3) .BR getipnodebyname (3)