OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man3 / inet_ntop.3
1 .\" Copyright 2000 Sam Varshavchik <mrsam@courier-mta.com>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References: RFC 2553
24 .TH INET_NTOP 3 2008-11-11 "Linux" "Linux Programmer's Manual"
25 .SH NAME
26 inet_ntop \- convert IPv4 and IPv6 addresses from binary to text form
27 .SH SYNOPSIS
28 .nf
29 .B #include <arpa/inet.h>
30 .sp
31 .BI "const char *inet_ntop(int " "af" ", const void *" "src" ,
32 .BI "                      char *" "dst" ", socklen_t " "size" );
33 .fi
34 .SH DESCRIPTION
35 This function converts the network address structure
36 .I src
37 in the
38 .I af
39 address family into a character string.
40 The resulting string is copied to the buffer pointed to by
41 .IR dst ,
42 which must be a non-NULL pointer.
43 The caller specifies the number of bytes available in this buffer in
44 the argument
45 .IR size .
46 .PP
47 .BR inet_ntop ()
48 extends the
49 .BR inet_ntoa (3)
50 function to support multiple address families,
51 .BR inet_ntoa (3)
52 is now considered to be deprecated in favor of
53 .BR inet_ntop ().
54 The following address families are currently supported:
55 .TP
56 .B AF_INET
57 .I src
58 points to a
59 .I struct in_addr
60 (in network byte order)
61 which is converted to an IPv4 network address in
62 the dotted-decimal format, "\fIddd.ddd.ddd.ddd\fP".
63 The buffer
64 .I dst
65 must be at least
66 .B INET_ADDRSTRLEN
67 bytes long.
68 .TP
69 .B AF_INET6
70 .I src
71 points to a
72 .I struct in6_addr
73 (in network byte order)
74 which is converted to a representation of this address in the
75 most appropriate IPv6 network address format for this address.
76 The buffer
77 .I dst
78 must be at least
79 .B INET6_ADDRSTRLEN
80 bytes long.
81 .SH "RETURN VALUE"
82 On success,
83 .BR inet_ntop ()
84 returns a non-NULL pointer to
85 .IR dst .
86 NULL is returned if there was an error, with
87 .I errno
88 set to indicate the error.
89 .SH ERRORS
90 .TP
91 .B EAFNOSUPPORT
92 .I af
93 was not a valid address family.
94 .TP
95 .B ENOSPC
96 The converted address string would exceed the size given by
97 .IR size .
98 .SH "CONFORMING TO"
99 POSIX.1-2001.
100 Note that RFC\ 2553 defines a prototype where the last argument
101 .I size
102 is of type
103 .IR size_t .
104 Many systems follow RFC\ 2553.
105 Glibc 2.0 and 2.1 have
106 .IR size_t ,
107 but 2.2 and later have
108 .IR socklen_t .
109 .\" 2.1.3: size_t, 2.1.91: socklen_t
110 .SH BUGS
111 .B AF_INET6
112 converts IPv4-mapped IPv6 addresses into an IPv6 format.
113 .SH EXAMPLE
114 See
115 .BR inet_pton (3).
116 .SH "SEE ALSO"
117 .BR getnameinfo (3),
118 .BR inet (3),
119 .BR inet_pton (3)