summaryrefslogtreecommitdiffstats
path: root/man3/getnameinfo.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/getnameinfo.3')
-rw-r--r--man3/getnameinfo.343
1 files changed, 22 insertions, 21 deletions
diff --git a/man3/getnameinfo.3 b/man3/getnameinfo.3
index 580a265..c1453ba 100644
--- a/man3/getnameinfo.3
+++ b/man3/getnameinfo.3
@@ -8,7 +8,7 @@
.\" 2004-12-14, mtk, Added EAI_OVERFLOW error
.\" 2004-12-14 Fixed description of error return
.\"
-.TH getnameinfo 3 2023-07-20 "Linux man-pages 6.05.01"
+.TH getnameinfo 3 2023-10-31 "Linux man-pages 6.7"
.SH NAME
getnameinfo \- address-to-name translation in protocol-independent manner
.SH LIBRARY
@@ -18,7 +18,7 @@ Standard C library
.nf
.B #include <sys/socket.h>
.B #include <netdb.h>
-.PP
+.P
.BI "int getnameinfo(const struct sockaddr *restrict " addr \
", socklen_t " addrlen ,
.BI " char " host "[_Nullable restrict ." hostlen ],
@@ -27,12 +27,12 @@ Standard C library
.BI " socklen_t " servlen ,
.BI " int " flags );
.fi
-.PP
+.P
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
-.PP
+.P
.BR getnameinfo ():
.nf
Since glibc 2.22:
@@ -55,7 +55,7 @@ but unlike those functions,
.BR getnameinfo ()
is reentrant and allows programs to eliminate
IPv4-versus-IPv6 dependencies.
-.PP
+.P
The
.I addr
argument is a pointer to a generic socket address structure
@@ -78,7 +78,7 @@ respectively) into which
.BR getnameinfo ()
places null-terminated strings containing the host and
service names respectively.
-.PP
+.P
The caller can specify that no hostname (or no service name)
is required by providing a NULL
.I host
@@ -91,7 +91,7 @@ argument or a zero
argument.
However, at least one of hostname or service name
must be requested.
-.PP
+.P
The
.I flags
argument modifies the behavior of
@@ -140,7 +140,9 @@ converted from IDN format to the locale's encoding if necessary.
ASCII-only names are not affected by the conversion, which
makes this flag usable in existing programs and environments.
.TP
-.BR NI_IDN_ALLOW_UNASSIGNED ", " NI_IDN_USE_STD3_ASCII_RULES
+.B NI_IDN_ALLOW_UNASSIGNED
+.TQ
+.B NI_IDN_USE_STD3_ASCII_RULES
Setting these flags will enable the
IDNA_ALLOW_UNASSIGNED (allow unassigned Unicode code points) and
IDNA_USE_STD3_ASCII_RULES (check output to make sure it is a STD3
@@ -200,7 +202,7 @@ was too small.
A system error occurred.
The error code can be found in
.IR errno .
-.PP
+.P
The
.BR gai_strerror (3)
function translates these error codes to a human readable string,
@@ -225,14 +227,13 @@ T{
.BR getnameinfo ()
T} Thread safety MT-Safe env locale
.TE
-.sp 1
.SH STANDARDS
POSIX.1-2008.
RFC\ 2553.
.SH HISTORY
glibc 2.1.
POSIX.1-2001.
-.PP
+.P
Before glibc 2.2, the
.I hostlen
and
@@ -244,14 +245,14 @@ In order to assist the programmer in choosing reasonable sizes
for the supplied buffers,
.I <netdb.h>
defines the constants
-.PP
+.P
.in +4n
.EX
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
.EE
.in
-.PP
+.P
Since glibc 2.8,
these definitions are exposed only if suitable
feature test macros are defined, namely:
@@ -262,7 +263,7 @@ or (in glibc versions up to and including 2.19)
.B _BSD_SOURCE
or
.BR _SVID_SOURCE .
-.PP
+.P
The former is the constant
.B MAXDNAME
in recent versions of BIND's
@@ -275,7 +276,7 @@ The following code tries to get the numeric hostname and service name,
for a given socket address.
Note that there is no hardcoded reference to
a particular address family.
-.PP
+.P
.in +4n
.EX
struct sockaddr *addr; /* input */
@@ -287,10 +288,10 @@ if (getnameinfo(addr, addrlen, hbuf, sizeof(hbuf), sbuf,
printf("host=%s, serv=%s\en", hbuf, sbuf);
.EE
.in
-.PP
+.P
The following version checks if the socket address has a
reverse address mapping.
-.PP
+.P
.in +4n
.EX
struct sockaddr *addr; /* input */
@@ -304,7 +305,7 @@ else
printf("host=%s\en", hbuf);
.EE
.in
-.PP
+.P
An example program using
.BR getnameinfo ()
can be found in
@@ -324,17 +325,17 @@ can be found in
.BR services (5),
.BR hostname (7),
.BR named (8)
-.PP
+.P
R.\& Gilligan, S.\& Thomson, J.\& Bound and W.\& Stevens,
.IR "Basic Socket Interface Extensions for IPv6" ,
RFC\ 2553, March 1999.
-.PP
+.P
Tatsuya Jinmei and Atsushi Onoe,
.IR "An Extension of Format for IPv6 Scoped Addresses" ,
internet draft, work in progress
.UR ftp://ftp.ietf.org\:/internet\-drafts\:/draft\-ietf\-ipngwg\-scopedaddr\-format\-02.txt
.UE .
-.PP
+.P
Craig Metz,
.IR "Protocol Independence Using the Sockets API" ,
Proceedings of the freenix track: