.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" 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. .\" .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified 1993-07-25 by Rik Faith (faith@cs.unc.edu) .\" Modified 2004-10-31 by aeb .\" .\" Japanese Version Copyright (c) 1998 Shinji Orito all rights reserved. .\" Translated Mon May 25 21:27:03 JST 1998 .\" by Shinji Orito .\" Updated & Modified Thu Feb 17 03:58:45 JST 2005 .\" by Yuichi SATO .\" .\"WORD: resolver レゾルバ (リゾルバ) .\"WORD: override オーバーライド .\"WORD: call 呼び出し、呼び出す .\"WORD: fully qualified domain name 完全修飾ドメイン名(FQDN) .\"WORD: type 型 .\"WORD: class クラス .\"WORD: query 問い合わせ、問い合わせる .\"WORD: buffer バッファー .\"WORD: lower-level routines 下位ルーチン .\"WORD: limit of the array 配列の範囲 .\"WORD: state information 状態の情報 .\"WORD: bitwise ``or'' ビット単位の論理和 .\"WORD: True 真値 .\"WORD: authoritative 権威付けされた .\"WORD: recursion desired bit 再帰要求ビット .\"WORD: single component names 一部分からなる名前 .\" .TH RESOLVER 3 2010-06-17 "GNU" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O res_init, res_query, res_search, res_querydomain, res_mkquery, res_send, .\"O dn_comp, dn_expand \- resolver routines res_init, res_query, res_search, res_querydomain, res_mkquery, res_send, dn_comp, dn_expand \- レゾルバ・ルーチン .\"O .SH SYNOPSIS .SH 書式 .nf .B #include .B #include .B #include .B extern struct state _res; .sp .B int res_init(void); .sp .BI "int res_query(const char *" dname ", int " class ", int " type , .RS .BI "unsigned char *" answer ", int " anslen ); .RE .sp .BI "int res_search(const char *" dname ", int " class ", int " type , .RS .BI "unsigned char *" answer ", int " anslen ); .RE .sp .BI "int res_querydomain(const char *" name ", const char *" domain , .RS .BI "int " class ", int " type ", unsigned char *" answer , .BI "int " anslen ); .RE .sp .BI "int res_mkquery(int " op ", const char *" dname ", int " class , .RS .BI "int " type ", char *" data ", int " datalen ", struct rrec *" newrr , .BI "char *" buf ", int " buflen ); .RE .sp .BI "int res_send(const char *" msg ", int " msglen ", char *" answer , .RS .BI "int " anslen ); .RE .sp .BI "int dn_comp(unsigned char *" exp_dn ", unsigned char *" comp_dn , .RS .BI "int " length ", unsigned char **" dnptrs ", unsigned char **" lastdnptr ); .RE .sp .BI "int dn_expand(unsigned char *" msg ", unsigned char *" eomorig , .RS .BI "unsigned char *" comp_dn ", char *" exp_dn , .BI "int " length ); .RE .fi .sp .\"O Link with \fI\-lresolv\fP. \fI\-lresolv\fP でリンクする。 .\"O .SH DESCRIPTION .SH 説明 .\"O These functions make queries to and interpret the responses from Internet .\"O domain name servers. これらの関数はインターネットのドメインネームサーバーに問い合わせ、 その応答を解釈する。 .PP .\"O The .\"O .BR res_init () .\"O function reads the configuration files (see .\"O resolv.conf(5)) to get the default domain name, search order and name .\"O server address(es). .\"O If no server is given, the local host is tried. .BR res_init () 関数は、デフォルトのドメイン名、検索順、ネームサーバー アドレスを得るために設定ファイル (resolv.conf(5) 参照) を読む。 もしサーバーが示されていなければローカルホストを試す。 .\"O If no domain is given, that associated with the local host is used. .\"O It can be overridden with the environment variable .\"O .BR LOCALDOMAIN . .\"O .BR res_init () .\"O is normally executed by the first call to one of the .\"O other functions. ドメインが示されていなければローカルホストに付けられたドメインを用いる。 環境変数 .B LOCALDOMAIN でオーバーライドできる。 .BR res_init () は、後述する関数のどれかが最初に呼び出された時、その関数 から実行される。 .PP .\"O The .\"O .BR res_query () .\"O function queries the name server for the .\"O fully qualified domain name \fIname\fP of specified \fItype\fP and .\"O \fIclass\fP. .\"O The reply is left in the buffer \fIanswer\fP of length .\"O \fIanslen\fP supplied by the caller. .BR res_query () 関数は、指定された \fItype\fP と \fIclass\fP の 完全修飾ドメイン名 (FQDN) \fIname\fP を、ネームサーバーへ問い合わせる。 応答は、呼び出した側によって用意される長さ \fIanslen\fP の \fIanswer\fP バッファーに残される。 .PP .\"O The .\"O .BR res_search () .\"O function makes a query and waits for the response .\"O like .\"O .BR res_query (), .\"O but in addition implements the default and search .\"O rules controlled by .\"O .B RES_DEFNAMES .\"O and .\"O .B RES_DNSRCH .\"O (see description of .\"O \fI_res\fP options below). .BR res_search () 関数は、問い合わせを行い .BR res_query () 同様その応答を 待つが、さらにデフォルトを実装しており .B RES_DEFNAMES と .B RES_DNSRCH によって規定される検索ルールを適用する。 (下記 \fI_res\fP オプションの説明を参照) .PP .\"O The \fBres_querydomain\fP() function makes a query using .\"O .BR res_query () .\"O on the concatenation of \fIname\fP and \fIdomain\fP. .BR res_querydomain () 関数は \fIname\fP と \fIdomain\fP の結合に .BR res_query () を用いて問い合わせを行う。 .PP .\"O The following functions are lower-level routines used by .\"O .BR res_query (). 次の関数は、 .BR res_query () で使われる下位ルーチンである。 .PP .\"O The .\"O .BR res_mkquery () .\"O function constructs a query message in \fIbuf\fP .\"O of length \fIbuflen\fP for the domain name \fIdname\fP. .\"O The query type .\"O \fIop\fP is usually .\"O .BR QUERY , .\"O but can be any of the types defined in .\"O \fI\fP. \fInewrr\fP is currently unused. .BR res_mkquery () 関数は、ドメイン名 \fIdname\fP の為に、長さ \fIbuflen\fP の \fIbuf\fP に問い合わせるメッセージを作成する。 問い合わせの型 \fIop\fP は通常 .B QUERY だが、 \fI\fP で定義された型のどれでも良い。 \fInewrr\fP は現在使用されていない。 .PP .\"O The .\"O .BR res_send () .\"O function sends a preformatted query given in .\"O \fImsg\fP of length \fImsglen\fP and returns the answer in \fIanswer\fP .\"O which is of length \fIanslen\fP. .\"O It will call .\"O .BR res_init (), .\"O if it .\"O has not already been called. .BR res_send () 関数は、長さ \fImsglen\fP の \fImsg\fP に決められた書式 で問い合わせ、\fIanswer\fP に長さ \fIanslen\fP の回答を返す。 まだ呼び出されていなければ .BR res_init () を呼び出す。 .PP .\"O The .\"O .BR dn_comp () .\"O function compresses the domain name \fIexp_dn\fP .\"O and stores it in the buffer \fIcomp_dn\fP of length \fIlength\fP. .\"O The compression uses an array of pointers \fIdnptrs\fP to previously .\"O compressed names in the current message. .\"O The first pointer points .\"O to the beginning of the message and the list ends with NULL. .\"O The limit of the array is specified by \fIlastdnptr\fP. .\"O If \fIdnptr\fP is NULL, domain names are not compressed. .\"O If \fIlastdnptr\fP is NULL, the list .\"O of labels is not updated. .BR dn_comp () 関数はドメイン名 \fIexp_dn\fP を圧縮して、長さ \fIlength\fP のバッファー \fIcomp_dn\fP に保存する。 圧縮にはポインター配列 \fIdnptrs\fP を用いる。 これらのポインターは、現在のメッセージの中にある以前に圧縮された名前を指す。 最初のポインターはメッセージの冒頭を指し、そのリストは NULL で終わる。 配列の範囲は \fIlastdnptr\fP で決められる。 \fIdnptr\fP が NULL ならばドメイン名は圧縮されない。 \fIlastdnptr\fP が NULL ならば、そのラベルのリストはアップデートされない。 .PP .\"O The .\"O .BR dn_expand () .\"O function expands the compressed domain name .\"O \fIcomp_dn\fP to a full domain name, which is placed in the buffer .\"O \fIexp_dn\fP of size \fIlength\fP. .\"O The compressed name is contained .\"O in a query or reply message, and \fImsg\fP points to the beginning of .\"O the message. .BR dn_expand () 関数は、圧縮されたドメイン名 \fIcomp_dn\fP からサイズ が \fIlength\fP の \fIexp_dn\fP バッファーに正式なドメイン名を展開する。 その圧縮された名前は、問い合わせ、または応答メッセージに含まれていて、 \fImsg\fP がメッセージの冒頭を指す。 .PP .\"O The resolver routines use global configuration and state information .\"O contained in the structure \fI_res\fP, which is defined in .\"O \fI\fP. .\"O The only field that is normally manipulated by the .\"O user is \fI_res.options\fP. .\"O This field can contain the bitwise "OR" .\"O of the following options: レゾルバ・ルーチンは、\fI\fP に定義された \fI_res\fP 構造体に 含まれている全体的な設定と状態の情報を使用する。 通常ユーザーに操作できる項目は \fI_res.options\fP だけである。 この項目は以下のオプションのビット単位の論理和にできる。 .TP .B RES_INIT .\"O True if .\"O .BR res_init () .\"O has been called. .BR res_init () が呼び出されていれば真。 .TP .B RES_DEBUG .\"O Print debugging messages. デバッグ・メッセージを出力する。 .TP .B RES_AAONLY .\"O Accept authoritative answers only. .\"O .BR res_send () .\"O continues until .\"O it fins an authoritative answer or returns an error. [Not currently .\"O implemented]. 権威付けされた (authoritative) 回答のみ受け入れる。 .BR res_send () は、最終的に権威付けされた回答を得られるか、エラーが返される まで続行する。 [現在実装されていない] .TP .B RES_USEVC .\"O Use TCP connections for queries rather than UDP datagrams. 問い合わせに UDP データグラムではなく TCP 接続を用いる。 .TP .B RES_PRIMARY .\"O Query primary domain name server only. プライマリ・ドメインネームサーバーのみ問い合わせる。 .TP .B RES_IGNTC .\"O Ignore truncation errors. .\"O Don't retry with TCP. [Not currently .\"O implemented]. 切り詰めエラー (truncation error) を無視する。TCP でリトライしない。 [現在実装されていない] .TP .B RES_RECURSE .\"O Set the recursion desired bit in queries. .\"O Recursion is carried out .\"O by the domain name server, not by .\"O .BR res_send (). .\"O [Enabled by default]. .\"Osato: .\"Osato: recursion desired は「再帰要求」「再帰要望」「再帰要請」などと .\"Osato: 訳されているものがありました。 .\"Osato: 再帰要求 (recursion desired) ビットを問い合わせに設定する。 再帰は .BR res_send () ではなくドメインネームサーバーによって行われる。 [デフォルトで有効] .TP .B RES_DEFNAMES .\"O If set, .\"O .BR res_search () .\"O will append the default domain name to .\"O single component names, i.e., those that do not contain a dot. .\"O [Enabled by default]. .\"Osato: .\"Osato: single component は「1 つの要素からなる」の方がよいでしょうか? .\"Osato: 設定されていれば、 .BR res_search () はデフォルトのドメイン名を一部分 のみからなる名前、すなわちドットを含まない名前に付け加える。 [デフォルトで有効] .TP .B RES_STAYOPEN .\"O Used with .\"O .B RES_USEVC .\"O to keep the TCP connection open between queries. 問い合わせ中に TCP 接続を保つため .B RES_USEVC と共に用いられる。 .TP .B RES_DNSRCH .\"O If set, .\"O .BR res_search () .\"O will search for hostnames in the current .\"O domain and in parent domains. .\"O This option is used by .\"O .BR gethostbyname (3). .\"O [Enabled by default]. 設定されていれば、 .BR res_search () は現在のドメインおよび親ドメインの ホスト名を探す。このオプションは .BR gethostbyname (3) で用いられる。 [デフォルトで有効] .\"O .SH "RETURN VALUE" .SH 返り値 .\"O The .\"O .BR res_init () .\"O function returns 0 on success, or \-1 if an error .\"O occurs. .BR res_init () 関数は成功すれば 0 を、エラーが発生すれば \-1 を返す。 .PP .\"O The \fBres_query\fP(), \fBres_search\fP(), .\"O .BR res_querydomain (), .\"O .BR res_mkquery () .\"O and .\"O .BR res_send () .\"O functions return the length .\"O of the response, or \-1 if an error occurs. .BR res_query (), .BR res_search (), .BR res_querydomain (), .BR res_mkquery (), .BR res_send () 関数は応答の長さを返す。 また、エラーが発生すれば \-1 を返す。 .PP .\"O The .\"O .BR dn_comp () .\"O and .\"O .BR dn_expand () .\"O functions return the length .\"O of the compressed name, or \-1 if an error occurs. .BR dn_comp () と .BR dn_expand () 関数は圧縮されたドメイン名の長さを返す。 また、エラーが発生すれば \-1 を返す。 .\"O .SH FILES .SH ファイル .nf .\"O /etc/resolv.conf resolver configuration file /etc/resolv.conf レゾルバ設定ファイル .\"O /etc/host.conf resolver configuration file /etc/host.conf レゾルバ設定ファイル .fi .\"O .SH "CONFORMING TO" .SH 準拠 4.3BSD. .\"O .SH "SEE ALSO" .SH 関連項目 .BR gethostbyname (3), .BR resolv.conf (5), .BR resolver (5), .BR hostname (7), .BR named (8)