.\" Copyright 2000 Sam Varshavchik .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" References: RFC 2553 .\" .\" Japanese Version Copyright (c) 2001 NAKANO Takeo all rights reserved. .\" Translated 2001-01-14, NAKANO Takeo .\" Updated 2005-02-26, Akihiro MOTOKI .\" Updated 2008-08-08, Akihiro MOTOKI, LDP v3.05 .\" .TH INET_NTOP 3 2008-11-11 "Linux" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O inet_ntop \- convert IPv4 and IPv6 addresses from binary to text form inet_ntop \- IPv4/IPv6 アドレスをバイナリ形式からテキスト形式に変換する .\"O .SH SYNOPSIS .SH 書式 .nf .B #include .sp .BI "const char *inet_ntop(int " "af" ", const void *" "src" , .BI " char *" "dst" ", socklen_t " "size" ); .fi .\"O .SH DESCRIPTION .SH 説明 .\"O This function converts the network address structure .\"O .I src .\"O in the .\"O .I af .\"O address family into a character string. .\"O The resulting string is copied to the buffer pointed to by .\"O .IR dst , .\"O which must be a non-NULL pointer. .\"O The caller specifies the number of bytes available in this buffer in .\"O the argument .\"O .IR size . この関数は、 .I af アドレスファミリーのネットワークアドレス構造体 .I src を文字列に変換する。 変換結果の文字列は、 .I dst が指すバッファにコピーされる。 .I dst は NULL でないポインタでなければならない。 呼び出し時に、このバッファで利用できるバイト数を 引き数 .I size に指定する。 .PP .\"O .BR inet_ntop () .\"O extends the .\"O .BR inet_ntoa (3) .\"O function to support multiple address families, .\"O .BR inet_ntoa (3) .\"O is now considered to be deprecated in favor of .\"O .BR inet_ntop (). .\"O The following address families are currently supported: .BR inet_ntop () は .BR inet_ntoa (3) 関数を拡張して複数のアドレスファミリーを扱えるようにしたものである。 今後は .BR inet_ntoa (3) は使わず、 .BR inet_ntop () を使うようにすると良いだろう。 現在サポートされているアドレスファミリーは以下の通り: .TP .B AF_INET .\"O .I src .\"O points to a .\"O .I struct in_addr .\"O (in network byte order) .\"O which is converted to an IPv4 network address in .\"O the dotted-decimal format, "\fIddd.ddd.ddd.ddd\fP". .\"O The buffer .\"O .I dst .\"O must be at least .\"O .B INET_ADDRSTRLEN .\"O bytes long. この場合 .I src は (ネットワークバイトオーダーの) .I "struct in_addr" へのポインタとみなされ、この構造体の内容が ドット区切りの 10 進数形式 "\fIddd.ddd.ddd.ddd\fP" の IPv4 ネットワークアドレスに変換される。 バッファ .I dst は少なくとも .B INET_ADDRSTRLEN バイトの長さを持たなければならない。 .TP .B AF_INET6 .\"O .I src .\"O points to a .\"O .I struct in6_addr .\"O (in network byte order) .\"O which is converted to a representation of this address in the .\"O most appropriate IPv6 network address format for this address. .\"O The buffer .\"O .I dst .\"O must be at least .\"O .B INET6_ADDRSTRLEN .\"O bytes long. この場合 .I src は (ネットワークバイトオーダーの) .I "struct in6_addr" へのポインタとみなされ、この構造体の内容が、 (このアドレスに対してもっとも適切な) IPv6 ネットワークアドレスの表示形式に変換される。 バッファ .I dst は少なくとも .B INET6_ADDRSTRLEN バイトの長さを持たなければならない。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O On success, .\"O .BR inet_ntop () .\"O returns a non-NULL pointer to .\"O .IR dst . .\"O NULL is returned if there was an error, with .\"O .I errno .\"O set to indicate the error. 成功すると、 .BR inet_ntop () は .I dst への (NULL でない) ポインタを返す。 エラーがあった場合は NULL を返し、 .I errno をエラーを示す値に適切に設定する。 .\"O .SH ERRORS .SH エラー .TP .B EAFNOSUPPORT .\"O .I af .\"O was not a valid address family. .I af がサポートされているアドレスファミリーでなかった。 .TP .B ENOSPC .\"O The converted address string would exceed the size given by .\"O .IR size . 変換されたアドレス文字列の長さが .I size で指定されたサイズを超過してしまう。 .\"O .SH "CONFORMING TO" .SH 準拠 POSIX.1-2001. .\"O Note that RFC\ 2553 defines a prototype where the last argument .\"O .I size .\"O is of type .\"O .IR size_t . .\"O Many systems follow RFC\ 2553. .\"O Glibc 2.0 and 2.1 have .\"O .IR size_t , .\"O but 2.2 and later have .\"O .IR socklen_t . .\"O .\" 2.1.3: size_t, 2.1.91: socklen_t RFC\ 2553 では最後の引き数 .I size のプロトタイプを .I size_t 型と定義している。多くのシステムでは RFC\ 2553 にしたがっている。 glibc 2.0 と 2.1 では .I size_t だが、 glibc 2.2 以降では .I socklen_t となっている。 .\" 2.1.3: size_t, 2.1.91: socklen_t .\"O .SH BUGS .SH バグ .\"O .B AF_INET6 .\"O converts IPv6-mapped IPv4 addresses into an IPv6 format. .B AF_INET6 は IPv4 がマップされた IPv6 アドレスを IPv6 形式に変換してしまう。 .\"O .SH EXAMPLE .SH 例 .\"O See .\"O .BR inet_pton (3). .BR inet_pton (3) を参照。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR getnameinfo (3), .BR inet (3), .BR inet_pton (3)