1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
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 consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
27 .\" Modified 1993-07-25 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified 2004-10-31 by aeb
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>
36 .\"WORD: resolver レゾルバ (リゾルバ)
37 .\"WORD: override オーバーライド
38 .\"WORD: call 呼び出し、呼び出す
39 .\"WORD: fully qualified domain name 完全修飾ドメイン名(FQDN)
42 .\"WORD: query 問い合わせ、問い合わせる
44 .\"WORD: lower-level routines 下位ルーチン
45 .\"WORD: limit of the array 配列の範囲
46 .\"WORD: state information 状態の情報
47 .\"WORD: bitwise ``or'' ビット単位の論理和
49 .\"WORD: authoritative 権威付けされた
50 .\"WORD: recursion desired bit 再帰要求ビット
51 .\"WORD: single component names 一部分からなる名前
53 .TH RESOLVER 3 2010-06-17 "GNU" "Linux Programmer's Manual"
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 \- レゾルバ・ルーチン
62 .B #include <netinet/in.h>
63 .B #include <arpa/nameser.h>
64 .B #include <resolv.h>
65 .B extern struct state _res;
67 .B int res_init(void);
69 .BI "int res_query(const char *" dname ", int " class ", int " type ,
71 .BI "unsigned char *" answer ", int " anslen );
74 .BI "int res_search(const char *" dname ", int " class ", int " type ,
76 .BI "unsigned char *" answer ", int " anslen );
79 .BI "int res_querydomain(const char *" name ", const char *" domain ,
81 .BI "int " class ", int " type ", unsigned char *" answer ,
85 .BI "int res_mkquery(int " op ", const char *" dname ", int " class ,
87 .BI "int " type ", char *" data ", int " datalen ", struct rrec *" newrr ,
88 .BI "char *" buf ", int " buflen );
91 .BI "int res_send(const char *" msg ", int " msglen ", char *" answer ,
96 .BI "int dn_comp(unsigned char *" exp_dn ", unsigned char *" comp_dn ,
98 .BI "int " length ", unsigned char **" dnptrs ", unsigned char **" lastdnptr );
101 .BI "int dn_expand(unsigned char *" msg ", unsigned char *" eomorig ,
103 .BI "unsigned char *" comp_dn ", char *" exp_dn ,
108 .\"O Link with \fI\-lresolv\fP.
109 \fI\-lresolv\fP でリンクする。
112 .\"O These functions make queries to and interpret the responses from Internet
113 .\"O domain name servers.
114 これらの関数はインターネットのドメインネームサーバーに問い合わせ、
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.
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 .
131 .\"O is normally executed by the first call to one of the
132 .\"O other functions.
133 ドメインが示されていなければローカルホストに付けられたドメインを用いる。
138 は、後述する関数のどれかが最初に呼び出された時、その関数
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
146 .\"O The reply is left in the buffer \fIanswer\fP of length
147 .\"O \fIanslen\fP supplied by the caller.
149 関数は、指定された \fItype\fP と \fIclass\fP の
150 完全修飾ドメイン名 (FQDN) \fIname\fP を、ネームサーバーへ問い合わせる。
151 応答は、呼び出した側によって用意される長さ \fIanslen\fP の \fIanswer\fP
155 .\"O .BR res_search ()
156 .\"O function makes a query and waits for the response
158 .\"O .BR res_query (),
159 .\"O but in addition implements the default and search
160 .\"O rules controlled by
164 .\"O (see description of
165 .\"O \fI_res\fP options below).
175 (下記 \fI_res\fP オプションの説明を参照)
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 の結合に
185 .\"O The following functions are lower-level routines used by
186 .\"O .BR res_query ().
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.
196 .\"O \fIop\fP is usually
198 .\"O but can be any of the types defined in
199 .\"O \fI<arpa/nameser.h>\fP. \fInewrr\fP is currently unused.
201 関数は、ドメイン名 \fIdname\fP の為に、長さ \fIbuflen\fP
202 の \fIbuf\fP に問い合わせるメッセージを作成する。
205 だが、 \fI<arpa/nameser.h>\fP で定義された型のどれでも良い。
206 \fInewrr\fP は現在使用されていない。
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.
214 .\"O .BR res_init (),
216 .\"O has not already been called.
218 関数は、長さ \fImsglen\fP の \fImsg\fP に決められた書式
219 で問い合わせ、\fIanswer\fP に長さ \fIanslen\fP の回答を返す。
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.
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 ならば、そのラベルのリストはアップデートされない。
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
255 関数は、圧縮されたドメイン名 \fIcomp_dn\fP からサイズ
256 が \fIlength\fP の \fIexp_dn\fP バッファーに正式なドメイン名を展開する。
257 その圧縮された名前は、問い合わせ、または応答メッセージに含まれていて、
258 \fImsg\fP がメッセージの冒頭を指す。
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 この項目は以下のオプションのビット単位の論理和にできる。
275 .\"O has been called.
280 .\"O Print debugging messages.
284 .\"O Accept authoritative answers only.
287 .\"O it fins an authoritative answer or returns an error. [Not currently
289 権威付けされた (authoritative) 回答のみ受け入れる。
291 は、最終的に権威付けされた回答を得られるか、エラーが返される
296 .\"O Use TCP connections for queries rather than UDP datagrams.
297 問い合わせに UDP データグラムではなく TCP 接続を用いる。
300 .\"O Query primary domain name server only.
301 プライマリ・ドメインネームサーバーのみ問い合わせる。
304 .\"O Ignore truncation errors.
305 .\"O Don't retry with TCP. [Not currently
307 切り詰めエラー (truncation error) を無視する。TCP でリトライしない。
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].
317 .\"Osato: recursion desired は「再帰要求」「再帰要望」「再帰要請」などと
318 .\"Osato: 訳されているものがありました。
320 再帰要求 (recursion desired) ビットを問い合わせに設定する。
323 ではなくドメインネームサーバーによって行われる。
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].
333 .\"Osato: single component は「1 つの要素からなる」の方がよいでしょうか?
338 のみからなる名前、すなわちドットを含まない名前に付け加える。
344 .\"O to keep the TCP connection open between queries.
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].
361 .BR gethostbyname (3)
364 .\"O .SH "RETURN VALUE"
368 .\"O function returns 0 on success, or \-1 if an error
371 関数は成功すれば 0 を、エラーが発生すれば \-1 を返す。
373 .\"O The \fBres_query\fP(), \fBres_search\fP(),
374 .\"O .BR res_querydomain (),
375 .\"O .BR res_mkquery ()
378 .\"O functions return the length
379 .\"O of the response, or \-1 if an error occurs.
382 .BR res_querydomain (),
386 また、エラーが発生すれば \-1 を返す。
391 .\"O .BR dn_expand ()
392 .\"O functions return the length
393 .\"O of the compressed name, or \-1 if an error occurs.
398 また、エラーが発生すれば \-1 を返す。
402 .\"O /etc/resolv.conf resolver configuration file
403 /etc/resolv.conf レゾルバ設定ファイル
404 .\"O /etc/host.conf resolver configuration file
405 /etc/host.conf レゾルバ設定ファイル
407 .\"O .SH "CONFORMING TO"
412 .BR gethostbyname (3),