OSDN Git Service

(split) LDP: Restore and add Copyrights for draft pages
[linuxjm/LDP_man-pages.git] / draft / man3 / resolver.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\" Modified 1993-07-25 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified 2004-10-31 by aeb
31 .\"
32 .\"*******************************************************************
33 .\"
34 .\" This file was generated with po4a. Translate the source file.
35 .\"
36 .\"*******************************************************************
37 .\"
38 .\" Japanese Version Copyright (c) 1998 Shinji Orito all rights reserved.
39 .\"     Translated Mon May 25 21:27:03 JST 1998
40 .\"             by Shinji Orito <shinji@os.gulf.or.jp>
41 .\" Updated & Modified Thu Feb 17 03:58:45 JST 2005
42 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
43 .\" Updated 2012-05-05, Akihiro MOTOKI <amotoki@gmail.com>
44 .\" Updated 2013-05-06, Akihiro MOTOKI <amotoki@gmail.com>
45 .\"
46 .TH RESOLVER 3 2013\-03\-05 GNU "Linux Programmer's Manual"
47 .SH 名前
48 res_init, res_query, res_search, res_querydomain, res_mkquery, res_send,
49 dn_comp, dn_expand \- レゾルバ・ルーチン
50 .SH 書式
51 .nf
52 \fB#include <netinet/in.h>\fP
53 \fB#include <arpa/nameser.h>\fP
54 \fB#include <resolv.h>\fP
55 \fBextern struct state _res;\fP
56 .sp
57 \fBint res_init(void);\fP
58 .sp
59 \fBint res_query(const char *\fP\fIdname\fP\fB, int \fP\fIclass\fP\fB, int \fP\fItype\fP\fB,\fP
60 .RS
61 \fBunsigned char *\fP\fIanswer\fP\fB, int \fP\fIanslen\fP\fB);\fP
62 .RE
63 .sp
64 \fBint res_search(const char *\fP\fIdname\fP\fB, int \fP\fIclass\fP\fB, int \fP\fItype\fP\fB,\fP
65 .RS
66 \fBunsigned char *\fP\fIanswer\fP\fB, int \fP\fIanslen\fP\fB);\fP
67 .RE
68 .sp
69 \fBint res_querydomain(const char *\fP\fIname\fP\fB, const char *\fP\fIdomain\fP\fB,\fP
70 .RS
71 \fBint \fP\fIclass\fP\fB, int \fP\fItype\fP\fB, unsigned char *\fP\fIanswer\fP\fB,\fP
72 \fBint \fP\fIanslen\fP\fB);\fP
73 .RE
74 .sp
75 \fBint res_mkquery(int \fP\fIop\fP\fB, const char *\fP\fIdname\fP\fB, int \fP\fIclass\fP\fB,\fP
76 .RS
77 \fBint \fP\fItype\fP\fB, char *\fP\fIdata\fP\fB, int \fP\fIdatalen\fP\fB, struct rrec *\fP\fInewrr\fP\fB,\fP
78 \fBchar *\fP\fIbuf\fP\fB, int \fP\fIbuflen\fP\fB);\fP
79 .RE
80 .sp
81 \fBint res_send(const char *\fP\fImsg\fP\fB, int \fP\fImsglen\fP\fB, char *\fP\fIanswer\fP\fB,\fP
82 .RS
83 \fBint \fP\fIanslen\fP\fB);\fP
84 .RE
85 .sp
86 \fBint dn_comp(unsigned char *\fP\fIexp_dn\fP\fB, unsigned char *\fP\fIcomp_dn\fP\fB,\fP
87 .RS
88 \fBint \fP\fIlength\fP\fB, unsigned char **\fP\fIdnptrs\fP\fB, unsigned char **\fP\fIlastdnptr\fP\fB);\fP
89 .RE
90 .sp
91 \fBint dn_expand(unsigned char *\fP\fImsg\fP\fB, unsigned char *\fP\fIeomorig\fP\fB,\fP
92 .RS
93 \fBunsigned char *\fP\fIcomp_dn\fP\fB, char *\fP\fIexp_dn\fP\fB,\fP
94 \fBint \fP\fIlength\fP\fB);\fP
95 .RE
96 .fi
97 .sp
98 \fI\-lresolv\fP でリンクする。
99 .SH 説明
100 これらの関数はインターネットのドメインネームサーバーに問い合わせ、 その応答を解釈する。
101 .PP
102 \fBres_init\fP()  関数は、デフォルトのドメイン名、検索順、ネームサーバー アドレスを得るために設定ファイル
103 (\fBresolv.conf\fP(5) 参照) を読む。 もしサーバーが示されていなければローカルホストを試す。
104 ドメインが示されていなければローカルホストに付けられたドメインを用いる。 環境変数 \fBLOCALDOMAIN\fP でオーバーライドできる。
105 \fBres_init\fP()  は、後述する関数のどれかが最初に呼び出された時、その関数 から実行される。
106 .PP
107 \fBres_query\fP()  関数は、指定された \fItype\fP と \fIclass\fP の 完全修飾ドメイン名 (FQDN) \fIname\fP
108 を、ネームサーバーへ問い合わせる。 応答は、呼び出した側によって用意される長さ \fIanslen\fP の \fIanswer\fP バッファーに残される。
109 .PP
110 \fBres_search\fP()  関数は、問い合わせを行い \fBres_query\fP()  同様その応答を 待つが、さらにデフォルトを実装しており
111 \fBRES_DEFNAMES\fP と \fBRES_DNSRCH\fP によって規定される検索ルールを適用する。 (下記 \fI_res\fP
112 オプションの説明を参照)
113 .PP
114 \fBres_querydomain\fP()  関数は \fIname\fP と \fIdomain\fP の結合に \fBres_query\fP()
115 を用いて問い合わせを行う。
116 .PP
117 次の関数は、 \fBres_query\fP()  で使われる下位ルーチンである。
118 .PP
119 \fBres_mkquery\fP()  関数は、ドメイン名 \fIdname\fP の為に、長さ \fIbuflen\fP の \fIbuf\fP
120 に問い合わせるメッセージを作成する。 問い合わせの型 \fIop\fP は通常 \fBQUERY\fP だが、
121 \fI<arpa/nameser.h>\fP で定義された型のどれでも良い。 \fInewrr\fP は現在使用されていない。
122 .PP
123 \fBres_send\fP()  関数は、長さ \fImsglen\fP の \fImsg\fP に決められた書式 で問い合わせ、\fIanswer\fP に長さ
124 \fIanslen\fP の回答を返す。 まだ呼び出されていなければ \fBres_init\fP()  を呼び出す。
125 .PP
126 \fBdn_comp\fP()  関数はドメイン名 \fIexp_dn\fP を圧縮して、長さ \fIlength\fP のバッファー \fIcomp_dn\fP に保存する。
127 圧縮にはポインター配列 \fIdnptrs\fP を用いる。 これらのポインターは、現在のメッセージの中にある以前に圧縮された名前を指す。
128 最初のポインターはメッセージの冒頭を指し、そのリストは NULL で終わる。 配列の範囲は \fIlastdnptr\fP で決められる。 \fIdnptr\fP
129 が NULL ならばドメイン名は圧縮されない。 \fIlastdnptr\fP が NULL ならば、そのラベルのリストはアップデートされない。
130 .PP
131 \fBdn_expand\fP()  関数は、圧縮されたドメイン名 \fIcomp_dn\fP からサイズ が \fIlength\fP の \fIexp_dn\fP
132 バッファーに正式なドメイン名を展開する。 その圧縮された名前は、問い合わせ、または応答メッセージに含まれていて、 \fImsg\fP
133 がメッセージの冒頭を指す。
134 .PP
135 レゾルバ・ルーチンは、\fI<resolv.h>\fP に定義された \fI_res\fP 構造体に
136 含まれている全体的な設定と状態の情報を使用する。 通常ユーザーに操作できる項目は \fI_res.options\fP だけである。
137 この項目は以下のオプションのビット単位の論理和にできる。
138 .TP 
139 \fBRES_INIT\fP
140 \fBres_init\fP()  が呼び出されていれば真。
141 .TP 
142 \fBRES_DEBUG\fP
143 .\" See resolv/README.
144 .\" Support for RES_DEBUG was made conditional in glibc 2.2.
145 デバッグ情報を表示する。このオプションは、 glibc がデバッグを有効にしてコンパイルされている場合にのみ利用できる。 デフォルトでは glibc
146 のデバッグは有効になっていない。
147 .TP 
148 \fBRES_AAONLY\fP
149 権威付けされた (authoritative) 回答のみ受け入れる。 \fBres_send\fP()
150 は、最終的に権威付けされた回答を得られるか、エラーが返される まで続行する。 [現在実装されていない]
151 .TP 
152 \fBRES_USEVC\fP
153 問い合わせに UDP データグラムではなく TCP 接続を用いる。
154 .TP 
155 \fBRES_PRIMARY\fP
156 プライマリ・ドメインネームサーバーのみ問い合わせる。
157 .TP 
158 \fBRES_IGNTC\fP
159 切り詰めエラー (truncation error) を無視する。TCP でリトライしない。 [現在実装されていない]
160 .TP 
161 \fBRES_RECURSE\fP
162 再帰要求 (recursion desired) ビットを問い合わせに設定する。 再帰は \fBres_send\fP()
163 ではなくドメインネームサーバーによって行われる。 [デフォルトで有効]
164 .TP 
165 \fBRES_DEFNAMES\fP
166 設定されていれば、 \fBres_search\fP()  はデフォルトのドメイン名を一部分 のみからなる名前、すなわちドットを含まない名前に付け加える。
167 [デフォルトで有効]
168 .TP 
169 \fBRES_STAYOPEN\fP
170 問い合わせ中に TCP 接続を保つため \fBRES_USEVC\fP と共に用いられる。
171 .TP 
172 \fBRES_DNSRCH\fP
173 設定されていれば、 \fBres_search\fP()  は現在のドメインおよび親ドメインの ホスト名を探す。このオプションは
174 \fBgethostbyname\fP(3)  で用いられる。 [デフォルトで有効]
175 .PP
176 このリストは完全なものではない。
177 \fBresolv.conf\fP(5) には他にいくつかのフラグが記載されている。
178 .SH 返り値
179 \fBres_init\fP()  関数は成功すれば 0 を、エラーが発生すれば \-1 を返す。
180 .PP
181 \fBres_query\fP(), \fBres_search\fP(), \fBres_querydomain\fP(), \fBres_mkquery\fP(),
182 \fBres_send\fP()  関数は応答の長さを返す。 また、エラーが発生すれば \-1 を返す。
183 .PP
184 \fBdn_comp\fP()  と \fBdn_expand\fP()  関数は圧縮されたドメイン名の長さを返す。 また、エラーが発生すれば \-1 を返す。
185 .SH ファイル
186 .nf
187 /etc/resolv.conf          レゾルバ設定ファイル
188 /etc/host.conf            レゾルバ設定ファイル
189 .fi
190 .SH 準拠
191 4.3BSD.
192 .SH 関連項目
193 \fBgethostbyname\fP(3), \fBresolv.conf\fP(5), \fBresolver\fP(5), \fBhostname\fP(7),
194 \fBnamed\fP(8)
195 .SH この文書について
196 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
197 である。プロジェクトの説明とバグ報告に関する情報は
198 http://www.kernel.org/doc/man\-pages/ に書かれている。