OSDN Git Service

501629a8e84faf1cb59ce4e690a8d6be2cfef0a1
[linuxjm/LDP_man-pages.git] / draft / man3 / resolver.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
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 consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified 1993-07-25 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified 2004-10-31 by aeb
29 .\"
30 .\" Japanese Version Copyright (c) 1998 Shinji Orito all rights reserved.
31 .\"     Translated Mon May 25 21:27:03 JST 1998
32 .\"             by Shinji Orito <shinji@os.gulf.or.jp>
33 .\" Updated & Modified Thu Feb 17 03:58:45 JST 2005
34 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
35 .\"
36 .\"WORD:        resolver        レゾルバ (リゾルバ)
37 .\"WORD:        override        オーバーライド
38 .\"WORD:        call    呼び出し、呼び出す
39 .\"WORD:        fully qualified domain name     完全修飾ドメイン名(FQDN)
40 .\"WORD:        type    型
41 .\"WORD:        class   クラス
42 .\"WORD:        query   問い合わせ、問い合わせる
43 .\"WORD:        buffer  バッファー
44 .\"WORD:        lower-level routines    下位ルーチン
45 .\"WORD:        limit of the array      配列の範囲
46 .\"WORD:        state information       状態の情報
47 .\"WORD:        bitwise ``or''  ビット単位の論理和
48 .\"WORD:        True    真値
49 .\"WORD:        authoritative   権威付けされた
50 .\"WORD:        recursion desired bit   再帰要求ビット
51 .\"WORD:        single component names  一部分からなる名前
52 .\"
53 .TH RESOLVER 3 2010-06-17 "GNU" "Linux Programmer's Manual"
54 .\"O .SH NAME
55 .SH 名前
56 .\"O res_init, res_query, res_search, res_querydomain, res_mkquery, res_send,
57 .\"O dn_comp, dn_expand \- resolver routines
58 res_init, res_query, res_search, res_querydomain, res_mkquery, res_send, dn_comp, dn_expand \- レゾルバ・ルーチン
59 .\"O .SH SYNOPSIS
60 .SH 書式
61 .nf
62 .B #include <netinet/in.h>
63 .B #include <arpa/nameser.h>
64 .B #include <resolv.h>
65 .B extern struct state _res;
66 .sp
67 .B int res_init(void);
68 .sp
69 .BI "int res_query(const char *" dname ", int " class ", int " type ,
70 .RS
71 .BI "unsigned char *" answer ", int " anslen );
72 .RE
73 .sp
74 .BI "int res_search(const char *" dname ", int " class ", int " type ,
75 .RS
76 .BI "unsigned char *" answer ", int " anslen );
77 .RE
78 .sp
79 .BI "int res_querydomain(const char *" name ", const char *" domain ,
80 .RS
81 .BI "int " class ", int " type ", unsigned char *" answer ,
82 .BI "int " anslen );
83 .RE
84 .sp
85 .BI "int res_mkquery(int " op ", const char *" dname ", int " class ,
86 .RS
87 .BI "int " type ", char *" data ", int " datalen ", struct rrec *" newrr ,
88 .BI "char *" buf ", int " buflen );
89 .RE
90 .sp
91 .BI "int res_send(const char *" msg ", int " msglen ", char *" answer ,
92 .RS
93 .BI "int " anslen );
94 .RE
95 .sp
96 .BI "int dn_comp(unsigned char *" exp_dn ", unsigned char *" comp_dn ,
97 .RS
98 .BI "int " length ", unsigned char **" dnptrs ", unsigned char **" lastdnptr );
99 .RE
100 .sp
101 .BI "int dn_expand(unsigned char *" msg ", unsigned char *" eomorig ,
102 .RS
103 .BI "unsigned char *" comp_dn ", char *" exp_dn ,
104 .BI "int " length );
105 .RE
106 .fi
107 .sp
108 .\"O Link with \fI\-lresolv\fP.
109 \fI\-lresolv\fP でリンクする。
110 .\"O .SH DESCRIPTION
111 .SH 説明
112 .\"O These functions make queries to and interpret the responses from Internet
113 .\"O domain name servers.
114 これらの関数はインターネットのドメインネームサーバーに問い合わせ、
115 その応答を解釈する。
116 .PP
117 .\"O The
118 .\"O .BR res_init ()
119 .\"O function reads the configuration files (see
120 .\"O resolv.conf(5)) to get the default domain name, search order and name
121 .\"O server address(es).
122 .\"O If no server is given, the local host is tried.
123 .BR res_init ()
124 関数は、デフォルトのドメイン名、検索順、ネームサーバー
125 アドレスを得るために設定ファイル (resolv.conf(5) 参照) を読む。
126 もしサーバーが示されていなければローカルホストを試す。
127 .\"O If no domain is given, that associated with the local host is used.
128 .\"O It can be overridden with the environment variable
129 .\"O .BR LOCALDOMAIN .
130 .\"O .BR res_init ()
131 .\"O is normally executed by the first call to one of the
132 .\"O other functions.
133 ドメインが示されていなければローカルホストに付けられたドメインを用いる。
134 環境変数
135 .B LOCALDOMAIN
136 でオーバーライドできる。
137 .BR res_init ()
138 は、後述する関数のどれかが最初に呼び出された時、その関数
139 から実行される。
140 .PP
141 .\"O The
142 .\"O .BR res_query ()
143 .\"O function queries the name server for the
144 .\"O fully qualified domain name \fIname\fP of specified \fItype\fP and
145 .\"O \fIclass\fP.
146 .\"O The reply is left in the buffer \fIanswer\fP of length
147 .\"O \fIanslen\fP supplied by the caller.
148 .BR res_query ()
149 関数は、指定された \fItype\fP と \fIclass\fP の
150 完全修飾ドメイン名 (FQDN) \fIname\fP を、ネームサーバーへ問い合わせる。
151 応答は、呼び出した側によって用意される長さ \fIanslen\fP の \fIanswer\fP
152 バッファーに残される。
153 .PP
154 .\"O The
155 .\"O .BR res_search ()
156 .\"O function makes a query and waits for the response
157 .\"O like
158 .\"O .BR res_query (),
159 .\"O but in addition implements the default and search
160 .\"O rules controlled by
161 .\"O .B RES_DEFNAMES
162 .\"O and
163 .\"O .B RES_DNSRCH
164 .\"O (see description of
165 .\"O \fI_res\fP options below).
166 .BR res_search ()
167 関数は、問い合わせを行い
168 .BR res_query ()
169 同様その応答を
170 待つが、さらにデフォルトを実装しており
171 .B RES_DEFNAMES
172
173 .B RES_DNSRCH
174 によって規定される検索ルールを適用する。
175 (下記 \fI_res\fP オプションの説明を参照)
176 .PP
177 .\"O The \fBres_querydomain\fP() function makes a query using
178 .\"O .BR res_query ()
179 .\"O on the concatenation of \fIname\fP and \fIdomain\fP.
180 .BR res_querydomain ()
181 関数は \fIname\fP と \fIdomain\fP の結合に
182 .BR res_query ()
183 を用いて問い合わせを行う。
184 .PP
185 .\"O The following functions are lower-level routines used by
186 .\"O .BR res_query ().
187 次の関数は、
188 .BR res_query ()
189 で使われる下位ルーチンである。
190 .PP
191 .\"O The
192 .\"O .BR res_mkquery ()
193 .\"O function constructs a query message in \fIbuf\fP
194 .\"O of length \fIbuflen\fP for the domain name \fIdname\fP.
195 .\"O The query type
196 .\"O \fIop\fP is usually
197 .\"O .BR QUERY ,
198 .\"O but can be any of the types defined in
199 .\"O \fI<arpa/nameser.h>\fP.  \fInewrr\fP is currently unused.
200 .BR res_mkquery ()
201 関数は、ドメイン名 \fIdname\fP の為に、長さ \fIbuflen\fP
202 の \fIbuf\fP に問い合わせるメッセージを作成する。
203 問い合わせの型 \fIop\fP は通常
204 .B QUERY
205 だが、 \fI<arpa/nameser.h>\fP で定義された型のどれでも良い。
206 \fInewrr\fP は現在使用されていない。
207 .PP
208 .\"O The
209 .\"O .BR res_send ()
210 .\"O function sends a preformatted query given in
211 .\"O \fImsg\fP of length \fImsglen\fP and returns the answer in \fIanswer\fP
212 .\"O which is of length \fIanslen\fP.
213 .\"O It will call
214 .\"O .BR res_init (),
215 .\"O if it
216 .\"O has not already been called.
217 .BR res_send ()
218 関数は、長さ \fImsglen\fP の \fImsg\fP に決められた書式
219 で問い合わせ、\fIanswer\fP に長さ \fIanslen\fP の回答を返す。
220 まだ呼び出されていなければ
221 .BR res_init ()
222 を呼び出す。
223 .PP
224 .\"O The
225 .\"O .BR dn_comp ()
226 .\"O function compresses the domain name \fIexp_dn\fP
227 .\"O and stores it in the buffer \fIcomp_dn\fP of length \fIlength\fP.
228 .\"O The compression uses an array of pointers \fIdnptrs\fP to previously
229 .\"O compressed names in the current message.
230 .\"O The first pointer points
231 .\"O to the beginning of the message and the list ends with NULL.
232 .\"O The limit of the array is specified by \fIlastdnptr\fP.
233 .\"O If \fIdnptr\fP is NULL, domain names are not compressed.
234 .\"O If \fIlastdnptr\fP is NULL, the list
235 .\"O of labels is not updated.
236 .BR dn_comp ()
237 関数はドメイン名 \fIexp_dn\fP を圧縮して、長さ \fIlength\fP
238 のバッファー \fIcomp_dn\fP に保存する。
239 圧縮にはポインター配列 \fIdnptrs\fP を用いる。
240 これらのポインターは、現在のメッセージの中にある以前に圧縮された名前を指す。
241 最初のポインターはメッセージの冒頭を指し、そのリストは NULL で終わる。
242 配列の範囲は \fIlastdnptr\fP で決められる。
243 \fIdnptr\fP が NULL ならばドメイン名は圧縮されない。
244 \fIlastdnptr\fP が NULL ならば、そのラベルのリストはアップデートされない。
245 .PP
246 .\"O The
247 .\"O .BR dn_expand ()
248 .\"O function expands the compressed domain name
249 .\"O \fIcomp_dn\fP to a full domain name, which is placed in the buffer
250 .\"O \fIexp_dn\fP of size \fIlength\fP.
251 .\"O The compressed name is contained
252 .\"O in a query or reply message, and \fImsg\fP points to the beginning of
253 .\"O the message.
254 .BR dn_expand ()
255 関数は、圧縮されたドメイン名 \fIcomp_dn\fP からサイズ
256 が \fIlength\fP の \fIexp_dn\fP バッファーに正式なドメイン名を展開する。
257 その圧縮された名前は、問い合わせ、または応答メッセージに含まれていて、
258 \fImsg\fP がメッセージの冒頭を指す。
259 .PP
260 .\"O The resolver routines use global configuration and state information
261 .\"O contained in the structure \fI_res\fP, which is defined in
262 .\"O \fI<resolv.h>\fP.
263 .\"O The only field that is normally manipulated by the
264 .\"O user is \fI_res.options\fP.
265 .\"O This field can contain the bitwise "OR"
266 .\"O of the following options:
267 レゾルバ・ルーチンは、\fI<resolv.h>\fP に定義された \fI_res\fP 構造体に
268 含まれている全体的な設定と状態の情報を使用する。
269 通常ユーザーに操作できる項目は \fI_res.options\fP だけである。
270 この項目は以下のオプションのビット単位の論理和にできる。
271 .TP
272 .B RES_INIT
273 .\"O True if
274 .\"O .BR res_init ()
275 .\"O has been called.
276 .BR res_init ()
277 が呼び出されていれば真。
278 .TP
279 .B RES_DEBUG
280 .\"O Print debugging messages.
281 デバッグ・メッセージを出力する。
282 .TP
283 .B RES_AAONLY
284 .\"O Accept authoritative answers only.
285 .\"O .BR res_send ()
286 .\"O continues until
287 .\"O it fins an authoritative answer or returns an error.  [Not currently
288 .\"O implemented].
289 権威付けされた (authoritative) 回答のみ受け入れる。
290 .BR res_send ()
291 は、最終的に権威付けされた回答を得られるか、エラーが返される
292 まで続行する。
293 [現在実装されていない]
294 .TP
295 .B RES_USEVC
296 .\"O Use TCP connections for queries rather than UDP datagrams.
297 問い合わせに UDP データグラムではなく TCP 接続を用いる。
298 .TP
299 .B RES_PRIMARY
300 .\"O Query primary domain name server only.
301 プライマリ・ドメインネームサーバーのみ問い合わせる。
302 .TP
303 .B RES_IGNTC
304 .\"O Ignore truncation errors.
305 .\"O Don't retry with TCP.  [Not currently
306 .\"O implemented].
307 切り詰めエラー (truncation error) を無視する。TCP でリトライしない。
308 [現在実装されていない]
309 .TP
310 .B RES_RECURSE
311 .\"O Set the recursion desired bit in queries.
312 .\"O Recursion is carried out
313 .\"O by the domain name server, not by
314 .\"O .BR res_send ().
315 .\"O [Enabled by default].
316 .\"Osato:
317 .\"Osato: recursion desired は「再帰要求」「再帰要望」「再帰要請」などと
318 .\"Osato: 訳されているものがありました。
319 .\"Osato:
320 再帰要求 (recursion desired) ビットを問い合わせに設定する。
321 再帰は
322 .BR res_send ()
323 ではなくドメインネームサーバーによって行われる。
324 [デフォルトで有効]
325 .TP
326 .B RES_DEFNAMES
327 .\"O If set,
328 .\"O .BR res_search ()
329 .\"O will append the default domain name to
330 .\"O single component names, i.e., those that do not contain a dot.
331 .\"O [Enabled by default].
332 .\"Osato:
333 .\"Osato: single component は「1 つの要素からなる」の方がよいでしょうか?
334 .\"Osato:
335 設定されていれば、
336 .BR res_search ()
337 はデフォルトのドメイン名を一部分
338 のみからなる名前、すなわちドットを含まない名前に付け加える。
339 [デフォルトで有効]
340 .TP
341 .B RES_STAYOPEN
342 .\"O Used with
343 .\"O .B RES_USEVC
344 .\"O to keep the TCP connection open between queries.
345 問い合わせ中に TCP 接続を保つため
346 .B RES_USEVC
347 と共に用いられる。
348 .TP
349 .B RES_DNSRCH
350 .\"O If set,
351 .\"O .BR res_search ()
352 .\"O will search for hostnames in the current
353 .\"O domain and in parent domains.
354 .\"O This option is used by
355 .\"O .BR gethostbyname (3).
356 .\"O [Enabled by default].
357 設定されていれば、
358 .BR res_search ()
359 は現在のドメインおよび親ドメインの
360 ホスト名を探す。このオプションは
361 .BR gethostbyname (3)
362 で用いられる。
363 [デフォルトで有効]
364 .\"O .SH "RETURN VALUE"
365 .SH 返り値
366 .\"O The
367 .\"O .BR res_init ()
368 .\"O function returns 0 on success, or \-1 if an error
369 .\"O occurs.
370 .BR res_init ()
371 関数は成功すれば 0 を、エラーが発生すれば \-1 を返す。
372 .PP
373 .\"O The \fBres_query\fP(), \fBres_search\fP(),
374 .\"O .BR res_querydomain (),
375 .\"O .BR res_mkquery ()
376 .\"O and
377 .\"O .BR res_send ()
378 .\"O functions return the length
379 .\"O of the response, or \-1 if an error occurs.
380 .BR res_query (),
381 .BR res_search (),
382 .BR res_querydomain (),
383 .BR res_mkquery (),
384 .BR res_send ()
385 関数は応答の長さを返す。
386 また、エラーが発生すれば \-1 を返す。
387 .PP
388 .\"O The
389 .\"O .BR dn_comp ()
390 .\"O and
391 .\"O .BR dn_expand ()
392 .\"O functions return the length
393 .\"O of the compressed name, or \-1 if an error occurs.
394 .BR dn_comp ()
395
396 .BR dn_expand ()
397 関数は圧縮されたドメイン名の長さを返す。
398 また、エラーが発生すれば \-1 を返す。
399 .\"O .SH FILES
400 .SH ファイル
401 .nf
402 .\"O /etc/resolv.conf          resolver configuration file
403 /etc/resolv.conf          レゾルバ設定ファイル
404 .\"O /etc/host.conf            resolver configuration file
405 /etc/host.conf            レゾルバ設定ファイル
406 .fi
407 .\"O .SH "CONFORMING TO"
408 .SH 準拠
409 4.3BSD.
410 .\"O .SH "SEE ALSO"
411 .SH 関連項目
412 .BR gethostbyname (3),
413 .BR resolv.conf (5),
414 .BR resolver (5),
415 .BR hostname (7),
416 .BR named (8)