OSDN Git Service

ab7add6642050c87c2548b574fd90e3231b51550
[linuxjm/LDP_man-pages.git] / draft / 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 .\"
25 .\" Japanese Version Copyright (c) 2001 NAKANO Takeo all rights reserved.
26 .\" Translated 2001-01-14, NAKANO Takeo <nakano@apm.seikei.ac.jp>
27 .\" Updated 2005-02-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
28 .\" Updated 2008-08-08, Akihiro MOTOKI, LDP v3.05
29 .\"
30 .TH INET_NTOP 3 2008-11-11 "Linux" "Linux Programmer's Manual"
31 .\"O .SH NAME
32 .SH 名前
33 .\"O inet_ntop \- convert IPv4 and IPv6 addresses from binary to text form
34 inet_ntop \- IPv4/IPv6 アドレスをバイナリ形式からテキスト形式に変換する
35 .\"O .SH SYNOPSIS
36 .SH 書式
37 .nf
38 .B #include <arpa/inet.h>
39 .sp
40 .BI "const char *inet_ntop(int " "af" ", const void *" "src" ,
41 .BI "                      char *" "dst" ", socklen_t " "size" );
42 .fi
43 .\"O .SH DESCRIPTION
44 .SH 説明
45 .\"O This function converts the network address structure
46 .\"O .I src
47 .\"O in the
48 .\"O .I af
49 .\"O address family into a character string.
50 .\"O The resulting string is copied to the buffer pointed to by
51 .\"O .IR dst ,
52 .\"O which must be a non-NULL pointer.
53 .\"O The caller specifies the number of bytes available in this buffer in
54 .\"O the argument
55 .\"O .IR size .
56 この関数は、
57 .I af
58 アドレスファミリーのネットワークアドレス構造体
59 .I src
60 を文字列に変換する。
61 変換結果の文字列は、
62 .I dst
63 が指すバッファにコピーされる。
64 .I dst
65 は NULL でないポインタでなければならない。
66 呼び出し時に、このバッファで利用できるバイト数を
67 引き数
68 .I size
69 に指定する。
70 .PP
71 .\"O .BR inet_ntop ()
72 .\"O extends the
73 .\"O .BR inet_ntoa (3)
74 .\"O function to support multiple address families,
75 .\"O .BR inet_ntoa (3)
76 .\"O is now considered to be deprecated in favor of
77 .\"O .BR inet_ntop ().
78 .\"O The following address families are currently supported:
79 .BR inet_ntop ()
80
81 .BR inet_ntoa (3)
82 関数を拡張して複数のアドレスファミリーを扱えるようにしたものである。
83 今後は
84 .BR inet_ntoa (3)
85 は使わず、
86 .BR inet_ntop ()
87 を使うようにすると良いだろう。
88 現在サポートされているアドレスファミリーは以下の通り:
89 .TP
90 .B AF_INET
91 .\"O .I src
92 .\"O points to a
93 .\"O .I struct in_addr
94 .\"O (in network byte order)
95 .\"O which is converted to an IPv4 network address in
96 .\"O the dotted-decimal format, "\fIddd.ddd.ddd.ddd\fP".
97 .\"O The buffer
98 .\"O .I dst
99 .\"O must be at least
100 .\"O .B INET_ADDRSTRLEN
101 .\"O bytes long.
102 この場合
103 .I src
104 は (ネットワークバイトオーダーの)
105 .I "struct in_addr"
106 へのポインタとみなされ、この構造体の内容が
107 ドット区切りの 10 進数形式 "\fIddd.ddd.ddd.ddd\fP" の
108 IPv4 ネットワークアドレスに変換される。
109 バッファ
110 .I dst
111 は少なくとも
112 .B INET_ADDRSTRLEN
113 バイトの長さを持たなければならない。
114 .TP
115 .B AF_INET6
116 .\"O .I src
117 .\"O points to a
118 .\"O .I struct in6_addr
119 .\"O (in network byte order)
120 .\"O which is converted to a representation of this address in the
121 .\"O most appropriate IPv6 network address format for this address.
122 .\"O The buffer
123 .\"O .I dst
124 .\"O must be at least
125 .\"O .B INET6_ADDRSTRLEN
126 .\"O bytes long.
127 この場合
128 .I src
129 は (ネットワークバイトオーダーの)
130 .I "struct in6_addr"
131 へのポインタとみなされ、この構造体の内容が、
132 (このアドレスに対してもっとも適切な)
133 IPv6 ネットワークアドレスの表示形式に変換される。
134 バッファ
135 .I dst
136 は少なくとも
137 .B INET6_ADDRSTRLEN
138 バイトの長さを持たなければならない。
139 .\"O .SH "RETURN VALUE"
140 .SH 返り値
141 .\"O On success,
142 .\"O .BR inet_ntop ()
143 .\"O returns a non-NULL pointer to
144 .\"O .IR dst .
145 .\"O NULL is returned if there was an error, with
146 .\"O .I errno
147 .\"O set to indicate the error.
148 成功すると、
149 .BR inet_ntop ()
150
151 .I dst
152 への (NULL でない) ポインタを返す。
153 エラーがあった場合は NULL を返し、
154 .I errno
155 をエラーを示す値に適切に設定する。
156 .\"O .SH ERRORS
157 .SH エラー
158 .TP
159 .B EAFNOSUPPORT
160 .\"O .I af
161 .\"O was not a valid address family.
162 .I af
163 がサポートされているアドレスファミリーでなかった。
164 .TP
165 .B ENOSPC
166 .\"O The converted address string would exceed the size given by
167 .\"O .IR size .
168 変換されたアドレス文字列の長さが
169 .I size
170 で指定されたサイズを超過してしまう。
171 .\"O .SH "CONFORMING TO"
172 .SH 準拠
173 POSIX.1-2001.
174 .\"O Note that RFC\ 2553 defines a prototype where the last argument
175 .\"O .I size
176 .\"O is of type
177 .\"O .IR size_t .
178 .\"O Many systems follow RFC\ 2553.
179 .\"O Glibc 2.0 and 2.1 have
180 .\"O .IR size_t ,
181 .\"O but 2.2 and later have
182 .\"O .IR socklen_t .
183 .\"O .\" 2.1.3: size_t, 2.1.91: socklen_t
184 RFC\ 2553 では最後の引き数
185 .I size
186 のプロトタイプを
187 .I size_t
188 型と定義している。多くのシステムでは RFC\ 2553 にしたがっている。
189 glibc 2.0 と 2.1 では
190 .I size_t
191 だが、
192 glibc 2.2 以降では
193 .I socklen_t
194 となっている。
195 .\" 2.1.3: size_t, 2.1.91: socklen_t
196 .\"O .SH BUGS
197 .SH バグ
198 .\"O .B AF_INET6
199 .\"O converts IPv6-mapped IPv4 addresses into an IPv6 format.
200 .B AF_INET6
201 は IPv4 がマップされた IPv6 アドレスを
202 IPv6 形式に変換してしまう。
203 .\"O .SH EXAMPLE
204 .SH 例
205 .\"O See
206 .\"O .BR inet_pton (3).
207 .BR inet_pton (3)
208 を参照。
209 .\"O .SH "SEE ALSO"
210 .SH 関連項目
211 .BR getnameinfo (3),
212 .BR inet (3),
213 .BR inet_pton (3)