.\" Copyright 2000 Sam Varshavchik .\" .\" %%%LICENSE_START(VERBATIM) .\" 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. .\" %%%LICENSE_END .\" .\" References: RFC 2553 .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" 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" .SH 名前 inet_ntop \- IPv4/IPv6 アドレスをバイナリ形式からテキスト形式に変換する .SH 書式 .nf \fB#include \fP .sp \fBconst char *inet_ntop(int \fP\fIaf\fP\fB, const void *\fP\fIsrc\fP\fB,\fP \fB char *\fP\fIdst\fP\fB, socklen_t \fP\fIsize\fP\fB);\fP .fi .SH 説明 この関数は、 \fIaf\fP アドレスファミリーのネットワークアドレス構造体 \fIsrc\fP を文字列に変換する。 変換結果の文字列は、 \fIdst\fP が指すバッファーにコピーされる。 \fIdst\fP は NULL でないポインターでなければならない。 呼び出し時に、このバッファーで利用できるバイト数を 引き数 \fIsize\fP に指定する。 .PP \fBinet_ntop\fP() は \fBinet_ntoa\fP(3) 関数を拡張して複数のアドレスファミリーを扱えるようにしたものである。 今後は \fBinet_ntoa\fP(3) は使わず、 \fBinet_ntop\fP() を使うようにすると良いだろう。 現在サポートされているアドレスファミリーは以下の通り: .TP \fBAF_INET\fP この場合 \fIsrc\fP は (ネットワークバイトオーダーの) \fIstruct in_addr\fP へのポインターとみなされ、この構造体の内容が ドット区切りの 10 進数形式 "\fIddd.ddd.ddd.ddd\fP" の IPv4 ネットワークアドレスに変換される。 バッファー \fIdst\fP は少なくとも \fBINET_ADDRSTRLEN\fP バイトの長さを持たなければならない。 .TP \fBAF_INET6\fP この場合 \fIsrc\fP は (ネットワークバイトオーダーの) \fIstruct in6_addr\fP へのポインターとみなされ、この構造体の内容が、 (このアドレスに対してもっとも適切な) IPv6 ネットワークアドレスの表示形式に変換される。 バッファー \fIdst\fP は少なくとも \fBINET6_ADDRSTRLEN\fP バイトの長さを持たなければならない。 .SH 返り値 成功すると、 \fBinet_ntop\fP() は \fIdst\fP への (NULL でない) ポインターを返す。 エラーがあった場合は NULL を返し、 \fIerrno\fP をエラーを示す値に適切に設定する。 .SH エラー .TP \fBEAFNOSUPPORT\fP \fIaf\fP がサポートされているアドレスファミリーでなかった。 .TP \fBENOSPC\fP 変換されたアドレス文字列の長さが \fIsize\fP で指定されたサイズを超過してしまう。 .SH 準拠 .\" 2.1.3: size_t, 2.1.91: socklen_t POSIX.1\-2001. RFC\ 2553 では最後の引き数 \fIsize\fP のプロトタイプを \fIsize_t\fP 型と定義している。多くのシステムでは RFC\ 2553 にしたがっている。 glibc 2.0 と 2.1 では \fIsize_t\fP だが、 glibc 2.2 以降では \fIsocklen_t\fP となっている。 .SH バグ \fBAF_INET6\fP は IPv4 がマップされた IPv6 アドレスを IPv6 形式に変換してしまう。 .SH 例 \fBinet_pton\fP(3) を参照。 .SH 関連項目 \fBgetnameinfo\fP(3), \fBinet\fP(3), \fBinet_pton\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。