1 .\" Copyright 2000 Sam Varshavchik <mrsam@courier-mta.com>
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.
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.
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" References: RFC 2553
25 .\" Japanese Version Copyright (c) 2001 NAKANO Takeo all rights reserved.
26 .\" Translated Sun Jan 14 2001 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
27 .\" Updated Tue Nov 26 2002 by Kentaro Shirakata <argrath@ub32.org>
29 .\"WORD: null pointer ヌル・ポインター
31 .TH GETIPNODEBYNAME 3 2010-09-04 "Linux" "Linux Programmer's Manual"
33 getipnodebyname, getipnodebyaddr, freehostent \- ネットワークホストの名前とアドレスの取得
36 .B #include <sys/types.h>
37 .B #include <sys/socket.h>
40 .BI "struct hostent *getipnodebyname(const char *" name ", int " af ,
41 .BI " int " flags ", int *" error_num );
43 .BI "struct hostent *getipnodebyaddr(const void *" addr ", size_t " len ,
44 .BI " int " af ", int *" "error_num" );
46 .BI "void freehostent(struct hostent *" "ip" );
49 これらの関数は非推奨である (glibc では利用できない)。
56 .BR getipnodebyname ()
58 .BR getipnodebyaddr ()
59 は、ネットワークホストの名前とアドレスを返す。
60 これらの関数は、以下の構造体へのポインタを返す。
74 これらの関数は、 IPv4 ネットワークアドレスファミリにしかアクセスできない
79 .BR getipnodebyname ()
81 .BR getipnodebyaddr ()
82 関数は複数のネットワークアドレスファミリーにアクセス可能になっている。
86 の関数群と異なり、動的に割り当てられたメモリへのポインタを返す。
91 関数を用いれば動的な割り当てメモリを解放できる。
92 .SS getipnodebyname() の引き数
93 .BR getipnodebyname ()
96 引き数で指定されたホストのネットワークアドレスを引く。
102 引き数は、ドットで 4 つに区切られた IPv4 アドレスか、
103 IPv4 ネットワークホストの名前へのポインタである。
107 引き数は、16 進の IPv6 アドレスか、
108 IPv6 ネットワークホストの名前へのポインタである。
111 パラメータには追加のオプションを指定する。
112 複数のフラグを指定するには、それらのビット単位の OR をとって指定すればよい。
113 オプションをひとつも指定したくないときには、
120 と共に用いられ、IPv6 アドレスの代わりに IPv4 アドレスを問い合わせる。
121 問い合わせる IPv4 アドレスは IPv6 アドレスにマップされる。
126 と共に用いられ、IPv4 アドレスと IPv6 アドレスの両方を問い合わせる。
127 見つかった IPv4 アドレスは、すべて IPv6 アドレスにマップされる。
133 IPv6 が割り当てられたネットワークインターフェースが
134 システムにひとつもなければ IPv6 アドレスの問い合わせを行わず、
135 IPv4 が割り当てられたネットワークインターフェースが
136 システムにひとつもなければ IPv4 アドレスの問い合わせを行わないように要求する。
143 .BR (AI_ADDRCONFIG | AI_V4MAPPED)
145 .SS "getipnodebyaddr() の引き数"
146 .BR getipnodebyaddr ()
160 .I sizeof(struct in_addr)
170 .I sizeof(struct in6_addr)
173 エラーが起こるとヌル・ポインターが返され、
175 に以下にリストされたエラーコードのいずれかが設定される。
178 ホスト名またはネットワークアドレスが見つからなかった。
182 そのネットワークアドレスまたはネットワーク名を認識したが、
184 例えば IPv4 アドレスしか持たないネットワークホストに対して
185 IPv6 の情報の問い合わせが行われた (およびその逆) などが考えられる。
188 ドメインネームサーバーから恒久的な失敗 (permanent failure)
192 ネームサーバーから一時的な失敗 (temporary failure)
193 を意味する返事が返された。次にはもうちょっと運が必要かも。
201 これはこのネットワークホストのオフィシャルな名前である。
204 これは、そのホストのオフィシャルでない別名へのポインターの配列である。
209 .BR getipnodebyname ()
211 .BR getipnodebyaddr ()
238 .I sizeof(struct in_addr)
244 .I sizeof(struct in6_addr)
250 そのネットワークホストに対応するネットワークアドレス構造体を指す。
254 .\" POSIX.1-2001 にはない。
256 これらの関数は glibc 2.1.91-95 に存在したが、再び削除された。
257 いくつかの UNIX 風システムはこれらの関数に対応しているが、