diff --git a/contrib/idn/mdnkit/doc/LICENSE.txt b/contrib/idn/mdnkit/doc/LICENSE.txt new file mode 100644 index 0000000000..0e33381338 --- /dev/null +++ b/contrib/idn/mdnkit/doc/LICENSE.txt @@ -0,0 +1,55 @@ +Copyright (c) 2000 Japan Network Information Center. All rights reserved. + +By using this file, you agree to the terms and conditions set forth bellow. + + LICENSE TERMS AND CONDITIONS + +The following License Terms and Conditions apply, unless a different +license is obtained from Japan Network Information Center ("JPNIC"), +a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku, +Tokyo, Japan. + +1. Use, Modification and Redistribution (including distribution of any + modified or derived work) in source and/or binary forms is permitted + under this License Terms and Conditions. + +2. Redistribution of source code must retain the copyright notices as they + appear in each source code file, this License Terms and Conditions. + +3. Redistribution in binary form must reproduce the Copyright Notice, + this License Terms and Conditions, in the documentation and/or other + materials provided with the distribution. For the purposes of binary + distribution the "Copyright Notice" refers to the following language: + "Copyright (c) Japan Network Information Center. All rights reserved." + +4. Neither the name of JPNIC may be used to endorse or promote products + derived from this Software without specific prior written approval of + JPNIC. + +5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +6. Indemnification by Licensee + Any person or entities using and/or redistributing this Software under + this License Terms and Conditions shall defend indemnify and hold + harmless JPNIC from and against any and all judgements damages, + expenses, settlement liabilities, cost and other liabilities of any + kind as a result of use and redistribution of this Software or any + claim, suite, action, litigation or proceeding by any third party + arising out of or relates to this License Terms and Conditions. + +7. Governing Law, Jurisdiction and Venue + This License Terms and Conditions shall be governed by and and + construed in accordance with the law of Japan. Any person or entities + using and/or redistributing this Software under this License Terms and + Conditions hereby agrees and consent to the personal and exclusive + jurisdiction and venue of Tokyo District Court of Japan. diff --git a/contrib/idn/mdnkit/doc/en/guide/bind9.html b/contrib/idn/mdnkit/doc/en/guide/bind9.html new file mode 100644 index 0000000000..c47b82f3fd --- /dev/null +++ b/contrib/idn/mdnkit/doc/en/guide/bind9.html @@ -0,0 +1,233 @@ + + + + +
++mDNkit では bind9 用のパッチファイルを提供しています。 +このパッチを適用することにより、 +bind9 において多言語ドメイン名を扱うことが可能になります。 +
+The mDNkit provides a patch file for bind9. +This patch file enables bind9 to support multilingual domain names. + +
+具体的には、このパッチは bind9 に次のような機能を追加します。 +
+The patch adds the following functionality to bind9. +
bind9 へのパッチの適用方法は、パッチファイルの先頭に記載してあります。 +インストールガイドの +bind9 用パッチの適用とインストールも +ご覧ください。 +
Instructions for how to install this patch to bind9 are given at the beginning of the patch file. +Refer also to the section "Adding and installing the bind9 patch"in the Installation guide. + +
+ +
このパッチの適用により、DNS サーバである named に対して、 +UTF-8 文字の透過機能が追加されます。 +
A UTF-8 character pass function★(透過機能)★ will be added to the named DNS server by installing this patch. + +
bind9 の named ではドメイン名の処理はほとんど8ビットスルーになって +いるのですが、named 内のドメイン名の内部表現からテキスト表現への +変換部分は8ビットスルーになっておらず、ASCII 文字以外 +はバックスラッシュでクォートされ、\DDD という形式の表現に +変換されてしまいます。 +
Although most domain name processing under bind9 named is 8-bit through, the conversion of the internal expression of domain names to text in named is not 8-bit through. Therefore, non-ASCII characters are quoted with backslashes as \DDD. + +
これは DNS プロトコル上で用いられるエンコーディングとして UTF-8 を +使用する場合に問題となります。 +
This makes it difficult to use UTF-8 for encoding DNS protocols. + +
本パッチでは、変換しようとする文字がUTF-8 文字の +場合にはバックスラッシュによるクォートをせずそのまま透過させる機能を +追加しました。 +この動作は named の設定ファイル (named.conf) で切り替えることができます。 +デフォルトは互換性のため透過しない設定になっています。 +もしDNS プロトコル上で用いるエンコーディングとして UTF-8 を用いる場合には、 +設定ファイルの options セクションの allow-utf8 パラメータを +次のように指定してください。 +
This patch contains a function that allow UTF-8 characters to pass through, so that they are not converted and quoted with backslashes. +This function can be turned on or off in the named configuration file (named.conf). +For the sake of compatibility, in the default setting UTF-8 characters are not let through. +When UTF-8 characters are to be used as encoding in a DNS protocol, change the options section allow-utf8 parameter in the configuration file as follows: + +
+
+options {
+ ...
+ allow-utf8 yes;
+ ...
+};
+
+
+
+DNS プロトコル上で用いられるエンコーディングとして RACE 等の +ASCII 互換エンコーディングを +使用する場合には、この設定は不要です。 +
This setting is not required when RACE or other ASCII compatible encoding is used as encoding in a DNS protocol. + +
bind9 のリゾルバは、bind8 までのものとは全く異なり、 +lightweight resolver ライブラリと呼ばれるアプリケーションに +リンクされるライブラリと、lightweight resolver デーモンと呼ばれる +サーバから構成されています。 +
The bind9 resolver differs greatly from any resolver up to bind8, in that it is comprised of a library, linked to an application referred to as a lightweight resolver library, and a server called a lightweight resolver daemon. + +
本パッチを適用することにより、このリゾルバに多言語ドメイン名の +処理機能が加わります。具体的には次のような機能が追加されます。 +
The use of this patch enables the resolver to handle multilingual domain names. It specifically adds the following functions. + +
+ +
DNS プロトコル上で用いられるエンコーディングや使用する正規化方式の指定は +あらかじめコンフィギュレーションファイルで設定しておきます。 +このファイルの設定方法については +mDNkit リゾルバのコンフィギュレーション +をご覧ください。 +
The encoding and the normalization scheme to be used in DNS protocol should first be set in the configuration file. +Refer to the mDNkit resolver configuration +for information on how to set up this file. + +
以下に、パッチによって多言語化される名前解決用 API 関数の一覧を示します。 +多言語化された API 関数は、従来の ASCII ドメイン名に加え、 +非 ASCII ドメイン名を扱うことができます。 +
Name-resolving API functions that the patch enables to handle multilingual domain names are listed below. +Multilingual API functions can handle non-ASCII domain names in addition to traditional ASCII domain names. + +
引数の型や返り値の型に変更はありません。 +パッチを当てる前と同様の呼び出し方法で、従来の ASCII ドメイン名と、 +非 ASCII ドメイン名の両方を扱うことができます。 +
Argument types and returned value types do not change. +Both regular ASCII domain names and non-ASCII domain names can be handled through the call up methods used prior to patch installation. + +
本パッチを適用した bind9 リゾルバは +MDN ライブラリ を利用してエンコーディング +変換や正規化を行います。従って bind9 リゾルバを使用したクライアントを +コンパイルする場合、MDN のライブラリ libmdn をリンクする必要が +あります。もしあなたのシステムが iconv() をサポートしていない +場合には、iconv() のライブラリも合わせてリンクする必要があります。 +
A bind9 resolver with this patch installed utilizes the MDN library for encoding, conversion and normalization. Thus when compiling clients that use the bind9 resolver, the MDN library libmdn must be linked. If your system does not support iconv(), the iconv() library must also be linked. + +
+ +
bind9 には DNS の問い合わせツールとして dig、host、nslookup という +コマンドが付属します。bind9 パッチを適用することにより、これらはいずれも +多言語ドメイン名が扱えるようになります。具体的には以下の機能が +付加されます。 +
Included within bind9 are the dig, host and nslookup commands for querying DNS. These commands can support multilingual domain names when the bind9 patch is installed. +The following functions have been added. +
+ +
DNS プロトコル上で用いられるエンコーディングや使用する正規化方式の指定は +あらかじめコンフィギュレーションファイルで設定しておきます。 +このファイルの設定方法については +mDNkit リゾルバのコンフィギュレーション +をご覧ください。 +
The encoding and the normalization scheme to be used in a DNS protocol shoud first be set in the configuration file. +Refer to the mDNkit resolver configuration for information on how to configure this file. + + + diff --git a/contrib/idn/mdnkit/doc/en/guide/bindconfig.html b/contrib/idn/mdnkit/doc/en/guide/bindconfig.html new file mode 100644 index 0000000000..9822165caf --- /dev/null +++ b/contrib/idn/mdnkit/doc/en/guide/bindconfig.html @@ -0,0 +1,403 @@ + + + + +
+DNSサーバにて多言語ドメイン名を扱うための設定方法について +解説します。とはいっても従来の ASCII ドメイン名の場合の設定方法と +大きく変わるわけではありません。注意すべき点は次の2点だけです。 +
This document describes how to configure a DNS server to enable handling of multilingual domain names. This configuration procedure does not differ greatly from that used for configuring ASCII domain names. However, two points have to be borne in mind. +
DNSサーバの設定の手順は、およそ以下の通りです。 +
Configure a DNS server according to the following procedure. + +
最後のファイル作成に関しては、エンコーディングとして UTF-5 を
+使用したときに特有の問題があり、これを
+
When UTF-5 is used for encoding during file generation, the last item, specific problems occur. These problems are discussed in the following section. +
+としてまとめてあります。 + +設定で使用するエンコーディング変換ツール mdnconv の外部仕様 +および内部処理の詳細に関しては、 +mdnconv の仕様書をご覧ください。 +
For information on external specifications and internal processing of mdnconv, the encoding conversion tool, used in the setup, refer to the mdnconv specifications. + +
また、クライアントからこれらの DNS サーバにアクセスするためには、 +多言語ドメイン名用パッチを当てた bind9、 +runmdn コマンド、 +mDN Wrapper などを使用してクライアント側で +エンコーディング変換や正規化を行うか、あるいは +エンコーディング変換を行うプロキシサーバである dnsproxy を通す必要があります。 +dnsproxy の設定については +DNS Proxy Server のコンフィギュレーションで説明します。 +
To enable the client to access these DNS servers, encoding, conversion and normalization using bind9 with a multilingual domain name patch installed、the runmdn command、the mDN Wrapper or similar tool must be used on the client side or access has to be made via dnsproxy, a proxy server that performs encoding and conversion. +dnsproxy configuration is described in DNS Proxy Server configuration. + +
+ +
まず DNS の設定に先だって、DNS サーバで使用するドメイン名の +エンコーディングおよび正規化方式を決める必要があります。 +
The encoding and normalization scheme to be used for a DNS server must be determined prior to DNS setup. + +
評価しようとする DNS の多言語化方式が決まっていれば、 +その方式に合わせることになります。 +現在提案されている方式の中から、使用するエンコーディング・正規化を +いくつか紹介します。これ以外の方式も多数提案されています。詳しくは +参考文献をご覧ください。 +
Encoding scheme should be selected to suit a DNS multilingual system to be assessed. +The following are some of the currently proposed encoding and normalization schemes. Various other systems are also being proposed. For details, see +reference document. + +
+
+
+
エンコーディングとして UTF-5 を採用した場合には、 +ZLD (zero level domain) を付けることで従来のドメイン名と区別する必要が +あります。したがって ZLD を何にするかも決定する必要があります。 +
When UTF-5 encoding is employed, it is essential to distinguish it from traditional domain names by adding ZLD (zero level domain). Consequently, it is necessary to determine which type of ZLD is to be used.★ZLD を何にするか★ + +
その他 mDNkit がサポートしているエンコーディング・正規化方式については +MDN ライブラリの仕様を参照してください。 +
Refer to the MDN library specifications for information on other encoding and normalization schemes supported by the mDNkit. +
もちろん、1台の DNS サーバに複数のエンコーディングを持たせることも可能 +です。この場合はゾーン毎に異なるエンコーディングを割り当てることになる +でしょう。ただし mDNkit を用いて多言語ドメイン名の扱いを可能にした +クライアントや dnsproxy は DNS サーバ側のエンコーディングが単一である +ことを仮定しているので、例えば dnsproxy の場合にはエンコーディング毎に +複数の dnsproxy を起動するなどのテクニックが必要です。 +
Of course, multiple types of encoding schemes can be employed for one DNS server.In such a case, a different type of encoding would be assigned to each zone. However, a client or dnsproxy enabled to support multilingual domain names through mDNkit assumes that a DNS server employs a single encoding scheme. Such techniques that start up multiple dnsproxies to handle all encodings would have to be used for dnsproxy. + +
+ +
エンコーディングとして ASCII 互換エンコーディング (ACE: ASCII Compatible +Encoding) である RACE、UTF-5 を用いる場合には、エンコード結果は従来の +ホスト名として正当な文字列になるので、現在使用中の DNS サーバをそのまま +使うことができます。しかし ASCII 互換エンコーディング以外のエンコーディング、 +特に UTF-8 を用いる場合には、多言語ドメイン処理を付加するパッチを当てた +bind9 の DNS サーバ (named) を使用するか、 +8ビットスルーパッチを当てた bind8 の DNS サーバを用意する必要があります。 +
When ASCII compatible encoding (ACE: ASCII Compatible Encoding) such as RACE or UTF-5 is used, the encoding results legal characters in traditional host names and allow use of current DNS servers. +However, the other encoding schemes, especially UTF-8, requires the use of a bind9 DNS server (named) with a multilingual domain patch installed, or a bind8 DNS server with an 8-bit through patch installed. + +
それぞれのパッチの当て方およびインストールの方法については +bind9 用パッチの適用とインストール および +bind8 用パッチの適用とインストール を +ご覧ください。 +
For information on procedures for adding or installing these patches, refer to Adding and installing bind9 patch and +Adding and installing bind8 patch. + +
+ +
named.conf やゾーンマスタファイル書き方自体は、 +多言語ドメイン名と従来のドメイン名で変わるところはありません。 +単にドメイン名に漢字などを含めることができるかどうかだけの違いです。 +
The writing of named.conf and zone master files for multilingual domain names does not differ from those of traditional domain names. +The only difference is that the domain names contain kanji or other non-ASCII characters. + +
DNS サーバ自体にエンコーディング変換機能は備わっていないので、 +DNS の読み込む named.conf ファイルやゾーンマスタファイルの +エンコーディングはエンコーディング・正規化方式の決定で +決定したエンコーディングに合わせる必要があります。 +mdnconv はこのような目的のために設計されたコード変換ツールです。 +
Since the DNS server does not contain the encoding coversion function, the encoding of the named.conf file and zone master file read by DNS must be adjusted to encoding determined by the encoding and normalization scheme. +mdnconv is the code conversion tool designed to solve this problem. + +
RACE や UTF-5 なら、ASCII 文字が編集できるエディタがあれば直接入力 +することも可能ですが、例えば「こんにちは.世界.」と入力する代わりに +bq--gbjzg23bn4.bq--3bhbm5km. +などといった暗号のような文字列を (しかも正確に) 入力しなければならず、 +変換ツールを使用するほうがはるかにに簡単です。 +
Although an ASCII character editor allows direct entries with RACE and UTF-5, you would be forced to accurately enter code strings such as bq--gbjzg23bn4.bq--3bhbm5km. for 「こんにちは.世界.」. Thus the conversion tool radically simplifies the character entry task. + +
UTF-8 ならばエディタによっては直接編集可能なものがあるので、それを +使うこともできます。しかしそのエディタも正規化までは多分してくれない +でしょうから、やはりツールでエンコーディング変換することをお勧めします。 +
Editors that allow direct editing with UTF-8 can also be used. +However, since such editors will probably not support normalization; encoding conversion is again the recommended procedure. + +
例えば次のようなコマンドを実行すると EUC-JP で書かれたゾーンマスタファイル +db.somezone.euc を RACE エンコーディングの db.somezone.race +に変換し、同時に Unicode Normalization Form C による正規化を適用する +ことができます。 +
For example when the following command is executed, the db.somezone.euc zone master file is converted to db.somezone.race RACE encoding and is simultaneously normalized according to Unicode Normalization Form C. + +
++ ++% mdnconv -noconf -in EUC-JP -out RACE -normalize unicode-form-c \ + db.foo.euc > db.foo.race ++
-in オプションで入力テキストのエンコーディングを、 +-out で出力テキストのエンコーディングを、 +そして -normalize で正規化方式を指定します。 +オプションの一覧とどのような値が指定できるかについては、 +mdnconv の仕様書をご覧ください。 +
-in option specifies encoding of input text, -out specifies output text encoding and -normalize specifies the normalization scheme.Refer to mdnconv specifications for a list of options and other values. + +
ではこの逆に RACE エンコーディングから EUC-JP への変換ができるかというと、 +RACE エンコーディングの場合には可能です。ただしこれは mdnconv が +RACE エンコーディング専用の特別な処理を備えているためで、 +一般的には ASCII 互換エンコーディングからローカルエンコーディングへの変換は +できないということを覚えておいてください。 +これは、入力された文字列の中で ASCII 互換エンコーディングを用いて +表記されている個所とそうでない通常の ASCII 表記の場所を区別できないからです。 +これについては mdnconv の仕様書の +変換処理の詳細を参照してください。 +
RACE encoding also allows you to do the opposite; to convert from RACE encoding to EUC-JP encoding. But note that this is only because mdnconv is provided with RACE encoding specific processing; normally, it is not possible to convert from ASCII compatible encoding to local encoding. The reason is that it is not possible to distinguish between characters denoted in ASCII compatible encoding and those that use normal ASCII encoding in entered character strings. +Refer to the conversion information, the mdnconv specifications, for details. + +
以上のことから、ゾーンマスタファイル等 DNS サーバが読み込むファイル +の作成と管理には次のような方法をとるのがよいと考えられます。 +まずローカルエンコーディングを用いて記述した版を用意して、これに対して +編集やバージョン管理を行います。 +そして mdnconv を用いてエンコーディング変換と正規化を行い、 +DNS サーバの使用するエンコーディング版のファイルを生成して、これを +DNS サーバが読み込むためのファイルとして使用します。 +
Consequently, the following procedure should be adhered to in creating and maintaining zone master files and other files that are to be read by a DNS server.First, create a file version in local encoding that is edited under version control. +Then use mdnconv to convert encoding and normalize the file to generate a file with the encoding employed by a DNS server and use it as the file the DNS server will read. + +
とはいってもローカルエンコーディング版のファイルを改訂するたびに +mdnconv を実行してサーバエンコーディング版のファイルを作るのは面倒です。 +この場合例えば make コマンドを使用すれば変換を自動化することができます。 +
However, executing mdnconv each time a locally encoded file has to be converted to a server encoded file is time-consuming. +In this situation, use the make command to automate conversion. + +
例えばローカルエンコーディング版のファイル名にサフィックス .lc、 +UTF-8 エンコーディング版にサフィックス .utf8、 +RACE エンコーディング版にサフィックス .race をつけるとします。 +すると次のような Makefile を書くことにより、ローカルエンコーディング版を +更新したら make を実行するだけで変換を自動的に行うことができます。 +
For example, let's assume that a file in local encoding has the suffix .lc, a UTF-8 encoding file the suffix .utf8 and a RACE encoding version file the suffix tt>.race. +Then the following type of Makefile could be written to allow automatic conversion using make when a file in local encoding is updated. + +
++ ++.SUFFIXES: .lc .utf8 .race + +.lc.utf8: + mdnconv -in $(LOCALCODE) -out UTF-8 $(NORMALIZE) $< > $@ +.lc.race: + mdnconv -in $(LOCALCODE) -out RACE $(NORMALIZE) $< > $@ + +LOCALCODE = EUC-JP +NORMALIZE = -normalize unicode-form-c -normalize unicode-lowercase + +TARGETS = db.foo.utf8 db.bar.race + +all: $(TARGETS) ++
1つの DNS サーバに異なるエンコーディングの複数のゾーンのマスタを +させようとした場合、named.conf に複数のエンコーディングを +混在させなくてはならない状況になることがあります。残念ながらこれは +mdnconv では無理なので、include ディレクティブ等を使って +ファイルを分割し、1つのファイルに複数のエンコーディングが +混在しないようにしてください。 +
When multiple zone master files with different encoding schemes are attempted in a single DNS server, it may be necessary to include multiple encoding schemes in named.conf. Unfortunately, this cannot be handled with mdnconv so the include directive or similar command must be used to split the file so that each file does not contain multiple encoding schemes. + +
最後にもう1つ、UTF-5 特有の問題について説明します。 +
Finally, we will discuss UTF-5 specific problems. + +
+ +
DNS サーバで使用するドメイン名のエンコーディングを UTF-5 にした場合には +いくつかの問題が生じます。 +
A number of problems occur when UTF-5 encoding is used as the domain name encoding of a DNS server. + +
+ +UTF-5 は ASCII 互換エンコーディングの一つなので、UTF-5 でエンコードされた +ドメイン名はそのままでは従来の ASCII のドメイン名と区別できません。 +同じく ASCII 互換エンコーディングの一つである RACE では、ドメイン名の +各ラベルの先頭に特定のプリフィックス (bq--) をつけることによって +従来のドメイン名と (一応) 識別できるのですが、 +UTF-5 にはこのような機構がないため、ZLD という概念を使用して従来のドメイン +名との識別を可能にしています。 +
+Since UTF-5 is an ASCII compatible encoding scheme, domain names encoded in UTF-5 cannot be distinguished from regular ASCII domain names. +By contrast, RACE, another ASCII compatible encoding scheme, appends (bq--), a prefix, to the beginning of each domain name label to allow differentiation from traditional domain names. But since UTF-5 does not have this feature a concept called ZLD is used to identify traditional domain names. + +
ZLD (zero level domain) とはドメイン名の最後につける +トップレベルドメインのことで、例えば utf5. という +トップレベルドメインを作り、 +UTF-5 エンコーディングのドメイン名はすべてこのドメインのサブドメインとする +ことで、従来のドメイン名との区別を可能にします。実際には このトップレベル +ドメインはローカルエンコーディングから UTF-5 エンコーディングへの変換を行う +場所 (現在の mDNkit では dnsproxy) で自動的に付加され、また UTF-5 から +ローカルエンコーディングに戻すときに自動的に除去されるので +アプリケーションにはこのドメインは見えません。アプリケーションにとっての +トップレベルドメインよりさらに上位ドメインに位置するので zero level domain +なわけです。もちろん DNS サーバからは ZLD は隠されておらず、したがって +DNS サーバの設定では ZLD を意識しなければなりません。 +
ZLD (zero level domain) is the top level domain appended at the end of a domain name. For example, when a utf5. top level domain is created, all UTF-5 encoded domain names can be made the subdomains of this top level domain making it possible to distinguish them from traditional domain names. +Since this top level domain is automatically added to the area (dnsproxy in current mDNkit) where conversion from local encoding to UTF-5 encoding takes place and is automatically deleted when coding is returned from UTF-5 to local encoding, the application does not see this level. +The top level domain to an application is at a still higher level, hence the name zero level domain. ZLD is of course visible to a DNS server, so DNS server settings must take ZLD into account. + +
さて、このように UTF-5 エンコーディングでは ZLD が必須ですが、 +mdnconv によるローカルエンコーディングから UTF-5 エンコーディングへの変換 +の際には、ドメイン名の ZLD の部分とそうでない部分を明確に区別する +必要があります。例えば www.ニック.日本.utf5. というドメイン名を +UTF-5 に変換すると N7N7N7.J0CBJ0C3J0AF.M5E5M72C.utf5 となります +(ただし ZLD は utf5. だとします)。先頭の www は +UTF-5 に変換しますが、ZLD 部分は変換しません。このため mdnconv は +ZLD がなんであるかをあらかじめ知っておく必要があります。このために +-zld というオプションが用意されています。 +このオプションは、ゾーンマスタファイル等に書かれたドメイン名が +指定された ZLD にマッチした時に、マッチした部分を出力エンコーディングへの +変換対象から外すという働きをします。ただしドメイン名と ZLD がマッチするのは +
Thus ZLD is required in UTF-5 encoding, whereas conversion from local encoding to UTF-5 encoding using mdncon requires that the ZLD part of the domain name is distinguished from other parts. +For example when the domain name www.ニック.日本.utf5. is converted to UTF-5, it beccomes N7N7N7.J0CBJ0C3J0AF.M5E5M72C.utf5 (but ZLD is utf5.). +Thus mdnconv must know what ZLD is. The option -zld is provided for this reason. +When a domain name written in a zone master file or other file matches a specified ZLD, this option removes the matching portion from conversion to output encoding.★マッチした部分を出力エンコーディングへの変換対象から外すという働きをします★ +The conditions for a domain name and ZLD match are as follows: +
++ ++www.ニック.日本.utf5. +www.ニック.日本 +utf5.ニック.日本. ++
さらに mdnconv の -auto オプション +を併用するとある程度 ZLD を自動付加させることができ、 +この場合ゾーンマスタファイルにいちいち ZLD を書く必要がなくなります。 +ただし確実に付加できるわけではないので、このオプションには頼らない方が +よいでしょう。 +
Also, if used with the mdnconv option -auto, ZLD is often automatically added in which case there is no need to write ZLD in each zone master file. +However, as addition of this option is not guaranteed, it may be best not to rely on it. + +
+ +
mdnconv は、デフォルトでは非 ASCII 文字を1文字以上含むドメイン名のみを +出力エンコーディングに変換します。つまり ASCII のみからなるドメイン名は +変換しません。これは従来の ASCII ドメイン名と多言語ドメイン名を混在させた +時に、ASCII ドメイン名までが UTF-5 などに変換されてしまうのを防ぐための +処置です。 +
By default, mdnconv converts to output encoding only domain names that contain two or more non-ASCII characters. Consequently, it does not convert domain names that are entirely made up of ASCII characters. This is to prevent ASCII domain names from being converted to UTF-5 when there are both ASCII domain names and multilingual domain names. + +
ところが多言語ドメイン名の中に ASCII 文字のみから構成されるラベルが +ある場合、それが単独でゾーンマスタファイルに出現するとこの処置のために +そのラベルが UTF-5 に変換されないという問題が生じます。 +例えばドメイン名 www.ニック.日本.utf5. の A レコードを +ゾーンマスタファイルに記述するときに、次のように書いてしまうと +www の部分が UTF-5 に変換されません。 +
However, this gives rise to the following problem. A label containing only ASCII characters in a multilingual domain name that occurs independently in the zone master file is not converted to UTF-5. For example when the A record of the domain name www.ニック.日本.utf5. is denoted in the zone master file as shown below the www part is not converted to UTF-5. +
++ ++$ORIGIN ニック.日本.utf5. +... +www IN A 10.9.8.7 ++
このような場合、FQDN で記述するなどして、非 ASCII 文字が含まれる +ようにしてやる必要があります。 +
In this case, use FQDN, for example, to add non-ASCII characters. + + + diff --git a/contrib/idn/mdnkit/doc/en/guide/clientconfig.html b/contrib/idn/mdnkit/doc/en/guide/clientconfig.html new file mode 100644 index 0000000000..31c4deeab4 --- /dev/null +++ b/contrib/idn/mdnkit/doc/en/guide/clientconfig.html @@ -0,0 +1,182 @@ + + + +
++DNS Proxy Server (dnsproxy) は、基本的には +多言語ドメイン名に対応していないクライアントから +多言語化対応したDNSサーバを利用できるようにするものです。 +
+The DNS Proxy Server (dnsproxy) enables clients that basically do not support multilingual domain names the use of multilingual compatible DNS servers. +
+ある手法の多言語ドメイン名に対応しているクライアントから +他の手法で多言語化対応したDNSサーバを利用するためにも使用できます。 ++
+This enables clients that use a specific type of multilingual domain name support procedure to access a DNS server with a different multilingual support procedure. ++
+実際にあるクライアントで多言語ドメイン名を使うことができるかどうかは、 +そのクライアントがドメイン名をどのように扱うかによります。 +クライアントが、ドメイン名を、クライアント側のエンコーディングで +なにもチェック/加工しないで使用しているなら、 +dnsproxyを経由することによって、多言語ドメイン名が利用可能になります。 +しかし、クライアント側でドメイン名のシンタックスを厳密にチェックしていたり、 +ある種の変換を行なっているような場合には、dnsproxyは役に立ちません。 +
+Whether or not multlingual domain names can be used with a specific client depends on how that client handles domain names. +When a client uses domain names without checking or processing the encoding, multilingual domain names can be used via dnsproxy. +But if the domain name syntax is carefully checked or conversion is performed on the client side, dnsproxy is not useful. +
+ここでは、いくつかの代表的なクライアントについて、 +dnsproxyによる多言語ドメイン名が使うことができるかどうか、 +どうすれば多言語ドメイン名を使うことができるようになるか、 +を説明します。 +
+This document will identify a number of major clients that will allow multilingual domain names when used with dnsproxy or what you have to do to use multilingual domain names. +
+ +
+ +
+UNIXの場合、DNSへの要求は、多くの場合resolverを経由して送られます。 +しかし、標準的なresolverはnon-ASCIIのドメイン名を受付けません。 +この問題に対処するため、mDNkitにはbin8のresolver +(およびnslookup、named)を8-bit throughにするためのパッチが +付属しています。まずは、bind8にこのパッチを適用し、 +8-bit throughのresolverを使って再リンクしてください。 +詳しくはインストールガイドの +前準備、 +bind 用パッチの適用とインストールを +ご覧ください。 +
+UNIX often sends DNS queries via a resolver. +The problem is that standard resolvers do not accept non-ASCII domain names. +To cope with this problem, mDNkit is provided with a patch that makes the bind8 resolver (nslookup and named) 8-bit through. First, install this patch in bind8 and use the 8-bit through resolver to relink. +For details, refer to Preparations and Applying and Installing the Bind Patch in the Installation Guide. +
+ +
+標準的なnslookupはnon-ASCIIのドメイン名を受付けません。 +mDNkitのbind8への8-bit throughパッチを適用して作成された +nslookupなら、多言語ドメイン名を使用することが可能になります。 +詳しくはインストールガイドの +前準備、 +bind 用パッチの適用とインストールを +ご覧ください。 +
+Standard inslookup does not support non-ASCII domain names. +nslookup generated by applying the bind8 8-bit through patch in mDNkit can use multilingual domain names. +For details, refer to Preparations and Applying and Installing the Bind Patch in the Installation Guide. + +
+Squid経由でWebにアクセスするような場合には、non-ASCII文字を含む +ドメイン名はsquidによってエラーとされます。 +mDNkitにはsquidを8-bit through にする +(シンタックスチェックを外す)パッチが含まれています。 +これを適用したsquidであれば、多言語ドメイン名を受付けるようになります。 +詳しくはインストールガイドの +前準備、 +squid 用パッチの適用とインストールを +ご覧ください。 +
+When the Web is accessed via Squid, domain names that contain non-ASCII characters generate an error. +mDNkit includes a patch that makes squid 8-bit through (by removing the syntax check). + +squid with this patch installed accepts multilingual domain names. +For details, refer to Preparations and Applying and Installing the squid Patch in the Installation Guide. + +
+残念ながら、入力時点でnon-ASCII文字は拒否されてしまいます。 +
+Unfortunately, non-ASCII characters are rejected when entered. +
+ +
+Windowsのresolver(WINSOCK)は、non-ASCIIのドメイン名を通すようです。 +クライアント内でのチェック、変換が行なわれなければ問題なく +多言語ドメイン名を使うことができます。通常は +
+The Windows resolver (WINSOCK) passes non-ASCII domain names. +So long as no checks or conversions are performed in the client, multilingual domain names can be used without a problem. Usually, +
+ client-translation . Shift_JIS ++とすればOKです。 +
is OK. +
+ +
+残念ながら、ホスト名の入力時点で、non-ASCII文字を含むホスト名は +拒否されるようです。ls による一覧表示は動作します。 +
+Unfortunately, domain names that contain non-ASCII characters are rejected upon entry. ls works as usual. + +
+Version 4.7 は問題なく動作しました。 +
+Version 4.7 works without any problems. +
+ただ、HTTPプロキシサーバを使われている場合には、その +プロキシサーバが多言語ドメイン名に対応しているかどうかが +問題になりますのでご注意ください。 +
However, when an HTTP proxy server is used, operation depends on whether or not that proxy server supports multilingual domain names. +
+ +
+IEには多言語ドメイン名への対応が一部含まれています。 +
+Some IE features support multilingual domain names. +
+ ツール + インターネットオプション + いつもUTF-8としてURLを送信する ++
+ tool + Internet option + URLs are always sent as UTF-8 ++しかし、これを使うと、余分なところまでUTF-8で +エンコードしてしまうようで、dnsproxyでは使用できません。 +逆に、これをオフにして、 +
+ client-translation . Shift_JIS ++とすれば、dnsproxy経由で多言語ドメイン名が使えるようになります。 +
+ですが、IEの場合には、webページ内に埋め込まれたURLについては、 +そのページのエンコーディングに合わせたエンコーディングに変換して +DNSの問合せを行なうようになっていますので、Shift_JIS以外で +記述されたWebページ上の多言語ドメイン名についてはクエリーが +失敗してしまいます。 +
+But for URLs embedded in a web page IE converts to encoding that suits the encoding on that page and bases DNS queries on this so entries that use characters other than Shift_JIS fail. + + + diff --git a/contrib/idn/mdnkit/doc/en/guide/dnsproxy.html b/contrib/idn/mdnkit/doc/en/guide/dnsproxy.html new file mode 100644 index 0000000000..d829441382 --- /dev/null +++ b/contrib/idn/mdnkit/doc/en/guide/dnsproxy.html @@ -0,0 +1,158 @@ + + + + +
+dnsproxy は文字通り DNS のプロキシサーバとして動作する +プログラムです。クライアントと本物の DNS サーバの間で両者の間の +通信データ (DNS プロトコルメッセージ) の変換を行います。 +
As the name implies, dnsproxy is a program that operates as a DNS proxy server. It converts communications data (DNS protocol messages) between clients and real DNS servers. + +
クライアントからローカルエンコードされた多言語ドメイン名を含む +DNS要求を受け取ると、DNSメッセージ中のドメイン名を +多言語化対応したDNS サーバが受付けられる標準エンコーディングに変換し、 +DNS サーバに送出します。 +エンコーディングの変換と同時に正規化も行います。 +また逆に DNS サーバからの応答メッセージを受信すると、その中に +含まれる多言語ドメイン名をクライアント側で認識できるローカル +エンコーディングに変換し、クライアントに返します。 +
When DNS queries that contain multlingual domain names in local encoding are received from a client, it is converted to standard encoding that can be accepted by a DNS server that supports. +Normalization is performed at the same time as the encoding is converted. +On the other hand, when a response message from a DNS server is received, the multilingual domain names in the message are converted to local encoding that is understood by the client before it is returned to the client. + +
dnsproxy はこのようなメカニズムによって一般のクライアントが +多言語ドメイン名を扱うことを可能にします。 +
dnsproxy uses this mechanism to enable regular clients to handle multilingual domain names. + +
具体的には、 +
Specifically, +
+ +
dnsproxy を使用するには、専用のコンフィギュレーションファイルで +使用するエンコーディングや正規化の方法を設定しておく必要があります。 +このファイルの設定方法については +DNS Proxy Server のコンフィギュレーション +をご覧ください。 +
To use dnsproxy, the encoding and normalization method must be set up using a special configuration file. +Refer to DNS Proxy Server Configuration for information on how to configure this file. + +
+ +
dnsproxy を使用するためにはあらかじめ設定が必要です。 +DNS Proxy Server のコンフィギュレーション +をご覧ください。 +
Use of dnsproxy requires prior setup. +Refer to DNS Proxy Server Configuration. + +
dnsproxy は以下のコマンド行オプションを受け付けます。 +
dnsproxy accepts the following command line options. +
dnsproxy は、エンコーディング変換や正規化の機能を持たない +一般のクライアントが多言語ドメイン名を扱うことを可能にします。 +クライアントではローカルコードで記述されたドメイン名を、 +そのまま多言語ドメイン名として使うことができるようになります。 +
dnsproxy enables ordinary clients without encoding conversion and normalization functions to handle multilingual domain names. +Clients can use domain names in local codes as multilingual domain names. + +
しかしそれにはクライアントがドメイン名に対して独自のチェックや変換を +行なっていなければ、という前提条件があります。 +問題はこの点にあり、 +クライアントによっては、ドメイン名のシンタックスを厳密にチェックしていたり、 +独自の手法で部分的に多言語化していたりするものがあります。 +このようなクライアントであれば、dnsproxyを使っても +多言語ドメイン名を使うことはできません。 +
However, this is on condition that the client does not check or convert the domain names. +This is a problem since some clients make strict checks of domain name syntax or use proprietary methods to perform partial multilingual encoding. +Multilingual domain names cannot be handled by such clients through dnsproxy. + +
UNIXの場合は、DNSへの要求は通常リゾルバライブラリを経由して送られますが、 +既存のリゾルバはドメイン名のシンタックスをチェックしていて、 +ドメイン名にnon-ASCIIコードが含まれているとエラーとして +はじかれてしまいます。 +この問題に対処するために、mDNkitには、bind8付属のリゾルバライブラリを +8ビット透過にするためのパッチが付属しています。このパッチを適用した +リゾルバライブラリを組み込めば、クライアントからのローカルコードによる +多言語ドメイン名がdnsproxyに渡されて、多言語化DNSサーバと組み合わせて +使用することができるようになります。 +Windowsの場合には、リゾルバ(WINSOCK)は8ビット透過になっていますので、 +この問題はありません。 +
UNIX usually sends DNS queries to the resolver library and current resolvers checks the syntax of domain names and rejects non-ASCII code as an error. +To cope with this problem, the bind8 resolver library in mDNkit has been provided with an 8-bit through patch. +By installing a resolver library with this patch the local encoding of multilingual domain names handled by clients is submitted to dnsproxy and can be used with multilingual DNS servers. +The Windows resolver (WINSOCK) is already 8-bit through so this is not a problem. + +
残る問題は、アプリケーションでのチェックや変換ですが、 +これは対象となるクライアントが多数ありますし、また、 +ソースが公開されていないものについては手の出しようがありませんので、 +基本的には、mDNkitには含まれていません。しかし、 +DNSのチェックに多用されるnslookup(in bind8)と、 +汎用のproxyとして使用されることの多いsquidについては、 +ドメイン名のチェックを外すためのパッチが含まれています。 +
The remaining problem, i.e. checks and conversions performed by the application, a problem that affects many clients and which little can be done about when sources are not made public. Functions are not provided in mDNkit to handle this issue. However, a patch that removes the check of domain names from nslookup(in bind8), an often used DNS check tool, and squid, an often used as a general-purpose proxy, are included. + +
dnsproxy を使用してどのようなアプリケーションが多言語ドメイン名を +扱えるようになるのかをまとめた +文書を用意してありますので、 +こちらをご覧ください。 +
Refer to document for information on which applications dnsproxy can enable to handle multilingual domain names. + + + diff --git a/contrib/idn/mdnkit/doc/en/guide/guide.html b/contrib/idn/mdnkit/doc/en/guide/guide.html new file mode 100644 index 0000000000..5137775bcb --- /dev/null +++ b/contrib/idn/mdnkit/doc/en/guide/guide.html @@ -0,0 +1,441 @@ + + + +
++mDNkitのガイドは以下のドキュメントから構成されています。 +
+The mDNkit guide is comprised of the following documents. +
+一般ユーザの方はまずmDNkitの紹介をご覧ください。 +そのあと、使用する多言語ドメイン処理方式 (あなたのシステムで +利用できる処理方式についてはシステム管理者にお尋ねください) に応じて +bind9 パッチ、 +runmdn、 +mDN Wrapper、 +dnsproxy のいずれかをご覧ください。 +
+Ordinary users should refer to Introduction to mDNkit. +Depending on the method of processing multilingual domain names (ask the system administrator which method your system uses) refer to bind9 patch, runmdn, mDN Wrapper、or dnsproxy. + +
+本キットをインストールするシステム管理者の方はすべてのガイドに +一通り目を通しておくことをお勧めします。 +
+It is recommended that the system administrator that installs this kit carefully reads through all the guides. + +
+本キットはフリーソフトウェアです。本キットの使用、再配布等に関する +条件については LICENSE.txt を +ご覧ください。 +
+This kit is free software. Read the LICENSE.txt for information on the redistribution conditions of this kit. + +
+mDNkitは、既存のDNSサーバ(bind8/9)、既存のクライアントで、 +多言語ドメイン名を使うために提案されている各種の方式を試験的に +評価してみることができるようにするための +パッチ、ツール、ライブラリをまとめたものです。 +
+The mDNkit comprises all the patches, tools and libraries to experimentally assess the variety of systems that enable existing DNS servers (bind8, bind9) to use multilingual domain names with current clients. +
+従来、ドメイン名には、英字、数字(およびハイフン)しか使えませんでした。 +多言語化されたドメイン名とは、ドメイン名としてこれらに加えて日本語など +いろいろな言語の文字を使えるようにしたものです。 +その実現方式として、現在インターネットドラフトでいくつかの +提案がなされています。(参考文献 参照) +
+Traditional domain names can only use alphabetic characters, numerics and hyphe ns. +In addition to these characters, multilingual domain names can also handle Japanese and a great number of characters from other languages. +A number of recommendations for how these are to be implemented are offered in the form of drafts on the Internet. See (Reference.) +
+ +
+DNS で多言語ドメイン名を使えるようにするには、まず DNS サーバ間で +多言語ドメイン名として使用する標準エンコーディング (コードセット) を +決める必要があります。 +現在提案されている方式は、いずれもISO10646 をベースとした +エンコーディングで、大きく次の2つに分けられます。 +
+First, the standard encoding (code set) to be used for multilingual domain names between DNS servers must be determined to enable use of multilingual names in DNS. +Currently recommended systems are all based on ISO10646 encoding and are basically of the following two types. +
+1. の方法は、エンコード結果が従来のドメイン名としても使える文字列になるので、 +多言語ドメイン名を既存のDNSが受付けることができる文字列で +表現することができます。この場合、DNSサーバ自体は +既存のものがそのまま使えます。 +
+With method 1, the encoded result are character strings that could also be used in traditional domain names, allowing you to use a multilingual domain name in the existing DNS server. Existing DNS servers can be used with this method. +
+2.の方法では、DNS サーバをそのエンコーディングに対応するように +改造する必要があります。 +
+With method 2, the DNS server has to be modified to support the encoding. +
+いずれの方式に関しても、DNS サーバの持つドメイン名のデータはあらかじめ +そのエンコーディングで用意する必要があります。 +
+Whichever method is selected, the domain name data held by a DNS server has to be prepared in that encoding. +
+一方、アプリケーションは一般的には SJIS 等のローカルエンコーディングを +使用するので、多言語ドメイン名を使えるようにするためにはどこかで +エンコーディングの相互変換をする必要があります。 +
+On the other hand, applications normally use SJIS or other local encoding so some type of interconversion must be performed at some point to enable the use of multilingual domain names. +
+つまりアプリケーションは多言語ドメイン名をローカルエンコーディングで +扱い、DNS サーバは標準エンコーディングで扱うので、 +クライアントと DNS サーバの間のどこかでアプリケーションの指定した +ローカルエンコーディングのドメイン名を標準エンコーディングのドメイン名へ +変換し、 +また DNS サーバからの応答に含まれる標準エンコーディングのドメイン名を +クライアントで表示可能なローカルエンコーディングに戻さなければなりません。 +
+Thus applications handle multilingual domain names in local encoding, whereas the DNS server handles them in standard encoding. This requires that at some point between the client and the DNS server that domain names in local encoding specified by an application be converted to domain names in standard encoding, and that domain names in standard encoding in the response from the DNS server be returned to local encoding that can be displayed by the client. +
+このためには次の3種類の方法が考えられます。 +
+The following three methods have been proposed to implement this. +
+ +
+ +
+
+
+ただし b. の方式は DNS サーバに不必要に複雑な機構を持ち込むこと、負
+荷を高めることなどの問題があり好ましくないため、本キットでは a. と
+c. の2通りの方法を提供します。
+
System b. unduly increases the complexity of DNS server configuration and thereby its load making it less desirable, therefore, methods a. and c. are recommended for use with this kit.
+
+mDNkitは、既存のDNSサーバ、クライアントを、最小限の改造で +複数の方式の多言語ドメイン名を +実際に試してみることができるようにするものです。 +
+mDNkit requires a minimum of modifications to allow experimental use of multiple multilingual domain name systems with existing DNS servers and clients. +
+ +
多言語ドメイン名を扱うためには、エンコーディング変換の他にも重要な +機能があります。それはドメイン名の正規化です。 +
In addition to encoding conversion, normalization is another vital function to enable handling of multilingual domain names. + +
すでに述べたように、DNS サーバ間で使用されるドメイン名のエンコーディング +として提案されている方式はいずれも ISO10646 をベースとしていますが、 +ISO10646 では見かけ上全く同一の文字を表す方法が複数ある場合があります。 +このような文字に対してその表現方法を1つに統一しないと、ユーザが +正しい (と思える) ドメイン名を入力したにも関わらず、名前解決ができない +という不都合が生じることになります。 +
As stated above, the recommended encoding of domain names to be used between DNS servers are all based on ISO10646, the problem is that a number of characters that look identical can be denoted in a number of different ways. +Unless a single unique method of notation is found for such characters, what a user thinks is a correctly entered domain name may not be possible to resolve. + +
また、従来の ASCII ドメイン名では、ドメイン名のマッチングの際に大文字と +小文字は同一視されていました。これをそのまま多言語ドメイン名にも適用する +ことは、マッチングの処理効率などの点で問題があり、あらかじめすべて小文字 +あるいは大文字に統一するのがより効率的だと考えられます。 +
Another problem is that upper case and lower case characters in domain name matching of traditional ASCII domain names are handled as equivalents. If this method is carried over to the handling of multilingual domain names in its present form, the matching process will be slowed down. To ensure higher efficiency, it may a good idea to use only lower case or upper case letters. + +
このようにドメイン名をあらかじめ設定した基準にしたがって標準形に変換するのが +正規化です。基本的には正規化はエンコーディング変換と同時に行われるので、 +エンコーディング変換と同じく +
Normalization is the method used to convert domain names to standard encoding using a set standard. Normalization is normally performed simultaneous with encoding conversion and just like encoding conversion there are the following three types. +
Like encode conversion, the second option is not desirable. + +
多言語ドメイン名を扱う方法のあるべき姿は、クライアント側の +リゾルバライブラリなどにエンコーディングの変換や正規化の機能を +持たせることによって、DNS プロトコルにはローカルエンコーディングの +データを一切載せないことだと考えられます。 +この処理方法を実現するために mDNkit ではいくつかの方式を提供しています。 +
The ideal method of handling multilingual domain names is thought to be to leave the conversion and normalization of encoding to resolver libraries and other features on the client side and let no local encoding data be handled by the DNS protocol. + +mDNkit provides a number of methods to implement this type of processing. + +
This patch enables the bind9 resolver to convert and normalize encoding. +An application can handle multilingual domain names by linking to a bind9 resolver library where this patch has been installed. +
+++
+ +
This command allows Unix applications with bind4 or bind8 based resolver libraries to handle multilingual domain names without the need for recompiling. +The command does this by utilizing the dynamic link of shared libraries to dynamically replace some of the functions of the resolver library with versions added to enable multilingual domain name processing. +
+++
+ +
This function is provided to enable Windows clients handle multilingual domain names without the need for recompiling. It utilizes the DLL mechanism to add multilingual domain name processing capability to some of the functions of WINSOCK, the name resolver. +
++ ++
runmdn コマンドと mDN Wrapper は、既存のアプリケーションを変更せずに +多言語ドメイン名の機能を付加しようとするものですが、実際にはいくつかの +制限事項があり、どのようなアプリケーションにも適用できるものではありません。 +詳しくはそれぞれの解説をご覧ください。 +
The rundmdn command and mDN Wrapper attempt to add multilingual domain name functions to existing applications without making any modifications, but there are a number of limitations and they cannot be used with any application. +Refer to respective instructions for details. + +
また bind9 パッチといえども、例えばアプリケーションが独自に +ドメイン名の文字チェックを実行して英数字とハイフン以外の文字を含む +ドメイン名をエラーにしていたりする場合には無力です。 +
For example if the application checks domain name characters, characters other than alphanumerics and hyphens will generate an error regardless of the bind9 patch. + +
すでに述べたように、エンコーディング変換や正規化は +クライアント側で実行するのが理想的だと考えられますが、 +実際問題としてソースが公開されていないためそのような改良のできない +クライアントや、特殊なリゾルバを持っていて runmdn が適用できないクライアントが +存在します。 +
As stated above, conversion and normalization of encoding should ideally be performed on the client side. The problem is that there are clients that do not admit to such modifications because the source is not made public or it uses special resolvers that do not allow the use of runmdn. + +
そこで mDNkit では、クライアントからローカルエンコードされた +多言語ドメイン名を含むDNS要求を受け取り、多言語化対応した +DNS サーバが受付けられる標準エンコーディングのドメイン名に変換し、 +また逆に DNS サーバからの応答の多言語ドメイン名を +クライアント側で認識できる形式に戻す DNS proxy サーバを +用意しました。 +
To cope with such situations, the mDNkit provides a DNS proxy server that receives DNS queries that include multilingual domain names in local encoding from a client and converts these to standard encoding acceptable to a DNS server supporting multilingual domain names, and conversly, returns multilingual domain names in the DNS server response to a format that is understood by the client. + +
dnsproxyを使うと、 +クライアント側がドメイン名のチェックや変換を +行なっていなければ、クライアント側のローカルコードで記述された +ドメイン名を、そのまま多言語ドメイン名として使うことができる +ようになります。 +
When dnsproxyis used, the domain names in the local code of the client side can be used as multilingual domain names without modification if domain names are checked and converted on the client side. +
++ ++
+ +
+DNS サーバ側のゾーンマスタファイルや named.conf ファイル上のドメイン名は、 +あらかじめ、規定されたエンコーディングに変換されている必要があります +(前述の理由により +DNS サーバに変換機能を持たせる方法はここでは考えません)。 +
+The domain names in the zone master file and named.conf file on the DNS server side must be converted to the prescribed encoding. +(the above reason i.e. adding conversion functionality to the DNS server is not considered here). +
+mDNkitでは、管理者はこれらのファイルをローカルエンコーディングで +作成して必要に応じて変換して使うものと想定し、 +ローカルエンコーディングから +多言語ドメイン名で必要とするエンコーディングへの +変換ツールmdnconvを提供します。 +
+mDNkit assumes that the administrator generate these files in local encoding and only convert them as need dictates and to this end provides mdnconv, a conversion tool to handle conversion from local encoding to multilingual domain names. + +
++ ++
| 注: | ++ ローカルエンコーディングで記述されたゾーンマスタ + ファイルを多言語エンコーディングへ変換することはできますが、 + 多言語エンコーディングによっては逆変換が + できないことがあります。 + これは、エンコーディングによってはそのエンコーディングで + エンコードされた文字列と通常の ASCII 文字列が + 区別できず、ファイルのどの部分を逆変換すべきか判定できない + ものがあるためです。 + しかし、DNSの管理のためには、 + 逆方向の変換も必要になると思いますので、一部のエンコーディングに + 対しては逆変換をサポートしています。 + | +
| Note: | ++ Zone master fils in local encoding can be converted to multilingual encoding, but some multilingual encoding may not be possible to return to local encoding. + This is because the encoded character strings in some encoding schemes it cannot be distinguished from normal ASCII character strings making it impossible to know which part of the file should be converted back to local encoding. + Still, since backward conversion is regarded as essential for the sake of DNS management, backward conversion is supported for some encoding. + | +
+ +
+DNS サーバの使用するエンコーディングによっては、 +DNSサーバ自体がドメイン名を8ビット透過で扱うことを +要求するものもあります。 +このようなエンコーディングへの対処のために +mDNkitにはbind8を8ビット透過にするためのパッチが +含まれています。このパッチはbind8に含まれている +nslookup、resolverについても8ビット透過にします。 +
+Some encoding used by DNS servers requires that the DNS server itself handles domain names as 8-bit through. To handle such encoding, mDNkit is provided with a patch that makes bind8 8-bit through. +This patch also turns nslookup and resolver provided with bind8 into 8-bit through. + +
bind9 の DNS サーバは本来8ビット透過になっていますが、 +ドメイン名を内部形式からテキスト形式に変換する際、8ビット文字を +`\DDD' という表現に変換してしまうので、これを抑制して UTF-8 文字は +そのまま透過するようにする機能が bind9 パッチには含まれています。 +
Although bind9 DNS servers are 8-bit through, when domain names are converted from the internal format to text format, 8-bit characters are converted to "\DDD". To suppress this and allow UTF-8 characters through, a bind9 patch has been provided. + +
+ +
+mDNkit のコンパイルおよびインストール方法について解説します。 +ここではソースからのインストール方法について説明します。 +バイナリパッケージの配布も予定されていますが、 +それらのインストール方法に関してはそれぞれのパッケージを参照してください。 +
This document describes mDNkit compiling and installation procedures. +Procedures for how to install from the source is described here. +Distribution of binary packages is planned; refer to the instructions that accompany each package. + +
+本ドキュメントでは Unix 用のコンパイルとインストール方法について +説明します。Windows 用の mDN Wrapper のインストール +方法に関しては mDN Wrapper のセットアップの +項をご覧ください。 +
+This document describes the compiling and installing procedures for Unix. Refer to the section Setup in mDN Wrapper for information on procedures to install in Windows mDN Wrapper. + +
+ソース配布からのインストール手順はおよそ次のようになります。 +
+Installation procedure from source distribution is implemented as follows. + +
+インストールの後は、DNS サーバの設定 +および mDNkit リゾルバのコンフィギュレーション +、さらに dnsproxy を使用する場合には +DNS Proxy Server のコンフィギュレーション +を参照して設定を行ってください。 +
+After installation, refer to and set up DNS server configuration, mDNkit resolver configuration, and if dnsproxy is to be used DNS Proxy Server configuration. +
ソース配布に含まれているパッチを適用する場合には、 +それぞれ次の手順にしたがってください。 +
To install the patch included in source distribution, refer to the following instructions. +
mDNkit は EUC や SJIS など様々なローカルエンコーディングで記述された +ドメイン名のエンコーディングを変換するために、汎用のコードセット変換 +ユーティリティである iconv() を使用します。 +そこで、FreeBSD など iconv() が標準で組み込まれていないシステムでは、 +mDNkit のインストールに先立って iconv() をインストール +しなければなりません。また、mDNkit は iconv() が +UTF-8 エンコーディングをサポートしていることを要求します。システム付属の +iconv() が UTF-8 をサポートしていない場合にはやはり +外部のパッケージをインストールする必要があります。 +
mDNkit uses iconv(), a general-purpose utility, to convert domain name encoding of EUC, SJIS or other local encoding. +iconv() must be installed prior to mDNkit installation in those systems that do not have iconv() as a standard package, such as FreeBSD. Also, the mDNkit requires that iconv() should support UTF-8 encoding. An external package must be installed if the provided iconv() in the system does not support UTF-8. + +
iconv() のフリーな実装としては、例えば libiconv +
There are free versions of iconv(), for example, libiconv. +
+があり、ソースを上記のページから入手することができます。 +これは LGPL に基づいたフリーソフトウェアで、多くの Unix 系 OS の +もとで動作します。このパッケージのインストール方法については、上記ページか、 +あるいはソース配布に含まれる INSTALL.generic ファイルをご覧ください。 +
This source can be downloaded from the above page. +This is an LGPL-based free software package that runs on a variety of Unix operating systems. Refer to the above page or the INSTALL.generic file that accompanies the source distribution for information on installation procedures. + +
+ +
mDNkit は bind9 に対するパッチを提供しており、これによって +多言語ドメイン名を扱うことのできる bind9 のリゾルバおよびサーバを +作成することができます。本キットに含まれるパッチは BIND 9.0.0 に +対するものです。ソースは以下の場所からダウンロードすることができます。 +
The mDNkit provides a bind9 patch that can be used to generate bind9 resolvers and servers that can support multilingual domain names. The patch in this kit is for BIND 9.0.0. The source can be downloaded from the following page. + +
++ +
dnsproxy を利用してクライアントアプリケーションが +多言語ドメイン名を使用できるようにするためには、 +名前解決を行うリゾルバライブラリを 8bit スルーにする必要があります。 +また DNS サーバでも、多言語ドメイン名のエンコーディングとして + ASCII 互換エンコーディングである UTF-5 や RACE 以外の、 +例えば UTF-8 などのエンコーディングを使用するためには、 +8bit スルーの DNS サーバを使用する必要があります。 +
To use dnsproxy to enable client applications to support multilingual domain names, the resolver library that resolves names must be made 8-bit through. +Also, 8-bit through DNS servers must be used to enable a DNS server to use encodings other than UTF-5, RACE or other ASCII compatible encoding (as multilingual domain name encoding), for example, UTF-8. + +
mDNkit にはこのために +BIND 8.2.2-P7 および BIND 8.2.3-T6B を 8bit スルーにする +パッチが含まれています。パッチを適用した bind8 を使用したい場合には +あらかじめいずれかのバージョンのソースを用意してください。 +ソースは以下の場所からダウンロードすることができます。 +
The mDNkit for that reason supplies a patch that makes BIND 8.2.2-P7 and BIND 8.2.3-T6B 8-bit through. To use bind8 with a patch installed, obtain the source of the desired version. +Sources can be downloaded from the following page. + +
+ ++ +
Web のキャッシュサーバである Squid は、そのままでは多言語 +ドメイン名が入力されるとそれをエラーにしてしまい、使用することができません。 +このためmDNkit には +Squid-2.3.STABLE3 を +8bit スルーにするパッチが含まれています。Squid を多言語ドメイン名で使用 +したい場合にはこのソースも用意してください。 +
Squid, a Web cache server, cannot be used as is, because it will generate an error when entering multilingual domain names. +mDNkit comes with a patch that makes Squid-2.3.STABLE3 8-bit through. Obtain this source if you wish to make Squid support multilingual domain names. + +
+ +
mDNkit に関する最新情報は以下の場所から入手可能で、 +最新の配布ソースのダウンロードもできます。 +
The latest information regarding the mDNkit is available on the following site. The most recent distribution source can also be downloaded from the following page. +
+ +入手した mDNkit の配布ソースを展開します。 +配布ソースのファイル名を mdnkit-X.Y.tar.gzとすると +次のようにして展開できます。 +
Extracting the obtained mDNkit distribution source. +Distribution sources with file names such as mdnkit-X.Y.tar.gz are extracted as shown below. + +
++ ++% gunzip mdnkit-X.Y.tar.gz +% tar -xf mdnkit-X.Y.tar ++
展開すると、mdnkit-X.Yというディレクトリが作られますので、 +そこに移動してください。 +
When extracted, a mdnkit-X.Y directory is generated. Move to this directory. +
++ ++% cd mdnkit-X.Y ++
以降の説明では、このディレクトリを $MDNTOP という名前で +参照します。環境変数 $MDNTOP を設定しておくと便利でしょう。 +
In the following descriptions, this directory is referred to as $MDNTOP. Setting the environment variable $MDNTOP makes it easier to use. +
++ ++% setenv MDNTOP `pwd` (csh 系のシェルの場合) +% MDNTOP=`pwd`; export MDNTOP (sh 系のシェルの場合) +% setenv MDNTOP `pwd` (for a csh system shell) +% MDNTOP=`pwd`; export MDNTOP (for a sh system shell) ++
+ +
まず mDNkit の本体である、 +
First compile the following that form the major part of the mDNkit. +
まず、mDNkit のトップディレクトリ +($MDNTOP の指すディレクトリ) に移動し、 +configure スクリプトを実行します。 +configure はヘッダファイルやライブラリの有無など、システム毎の +特徴を調べ、コンパイル環境を適切に設定するためのツールです。 +
First move to the mDNkit top directory (the directory that $MDNTOP points to) and execute the configure script. +Configure is a tool that checks the header file and libraries to learn the features of the system to configure the optimum compiler environment. + +
++ ++% cd $MDNTOP +% ./configure ++
システムに iconv() が組み込まれていて、かつコンパイル時に +特別なオプションを使用しないなら上記のようになにも引数を指定せずに +実行すればよいのですが、そうではない場合、オプションや環境変数で +configure の動作を変えることができます。 +
When iconv() is included with the system and no special options are used during compilation, it can be executed like above without the need to specify any arguments. In other cases, operation of configure can be changed using options and environment variables. + +
configure に指定できるオプションの中で mDNkit に +直接関係するものは以下の通りです。 +
The following options that can be set by configure are directly related to mDNkit. + +
例えば前準備に挙げた
+ iconv のパッケージをインストールした場合、デフォルトでは
+ /usr/local/lib の libiconv にインストールされるので、
+For example, when the iconv package mentioned in Preparations is installed, it is by default installed in libiconv of /usr/local/lib, so it is a good idea to make the following entry.
+
++ と指定すればよいでしょう。libiconv が共有ライブラリの時には、 + -R オプションも指定して+--with-iconv="-L/usr/local/lib -liconv" ++
++ ++--with-iconv="-L/usr/local/lib -R/usr/local/lib -liconv" ++
+ +
+ +
+ +
+
Like RACE and BRACE, LACE is another ASCII compatible encoding scheme and like, RACE, it adds a special prefix to distinguish it from ordinary ASCII domain names. +In the current Internet Draft the prefix is "bq--", but this may change in the future; if it does, use this option to enter the correct prefix. +
+
This option adds ZLD (Zero Level Domain) function support. ZLD is a special domain name used to differentiate standard ASCII domain names from multilingual domain names in some encodings used in a DNS server. This option need not be set unless ZLD is selected as the required encoding in a DNS protocol.
+ +
なお、ZLD 機能のサポートの有無は dnsproxy や runmdn が設定ファイルを読み込む際の振る舞い (ZLD の指定を無視するかどうか) に影響します。 + mDNkit が提供するライブラリ自体は、(設定ファイルを読み込むための一部のモジュールを除いて)このオプションによって動作が変わることはなく、常に ZLD の処理を行うようになっています。 +
The support of the ZLD function affects operation (i.e. whether or not the ZLD setting is ignored) when configuration files are read in using the dnsproxy or runmdn command. The operation of the library provided by the mDNkit does not change with this option (except some modules used for reading in configuration files), but performs ZLD processing at all times.
+ +
+Specifies the directory where dnsproxy, the DNS proxy server, is installed. /usr/local/sbin is the default directory.
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
この他にも configure にはいろいろなオプションを指定することができます。 +
A number of other options can be specified using configure.
+
+++% ./configure --help ++
で指定可能なオプションの一覧を表示させることができます。 +
The above is used to display a list of specifiable options.
+ +
また、関係する環境変数は次の通りです。 +
The related environment variables are as follows.
+ +
+
+
+++% setenv CFLAGS -I/usr/local/include ++
また sh 系のシェルの場合には +
An sh shell requires the following configuration. +
+++% CFLAGS=-I/usr/local/include; export CFLAGS ++
とします。 +
CFLAGS はこの他にも C コンパイラの最適化オプションを指定するためにも使えます。CFLAGS に -O を指定すれば最適化ありでコンパイルされます。 +
CFLAGS can be used in other situations to specify the optimum C compiler options. When -O is specified in CFLAGS compilation is optimized. +
configure を実行することにより、あなたのシステム環境に合わせて調整された Makefile その他のファイルが生成されます。 +
When configure is executed, Makefile and other files are generated and adapted to your system environment. +
+ +
configure 実行によって、システム環境に合った Makefile が生成されているので、コンパイルはトップディレクトリ($MDNTOP の指すディレクトリ) でmake コマンドを実行するだけです。 +
Since configure generates a Makefile tailored to the system environment, all that compile needs to do is to execute the make command in the top directory (the directory pointing to $MDNTOP). +
++ ++% make ++
+ +
コンパイルが終了したら、実行ファイルなどのインストールを行います。 +インストールの前にスーパーユーザになってください。 +
When compiling is finished, install the executable files and other files. Become a superuser prior to installation.
+
++ ++% su ++
あとは make install を実行すれば、必要なファイルがシステムにインストールされます。 +
Then execute make install to install all the required files in the system.
+
++ ++# make install ++
インストールされるファイルは以下の通りです。 +
The following files will be installed.
+
+
+
+
dnsproxy は、デフォルトでは /usr/local/sbinにインストールされます。 + インストール先を変えるにはconfigure の --sysconfdirオプションを使用します。 +
dnsproxy is installed in /usr/local/sbin by default. If you wish to change the installation location, use the configure --sysconfdir option. +
mdnconv および runmdn は、デフォルトでは /usr/local/bin にインストールされます。 + インストール先を変えるには configure の --bindirオプションを使用します。 +
+
mdnconv and runmdn are installed in /usr/local/bin by default. If you wish to change the installation location, use the --bindir option.
+
+
+
+
+
+
デフォルトでは /usr/local/man/man8 (dnsproxy.8)、/usr/local/man/man1 (mdnconv.1、runmdn.1)、/usr/local/man/man5 (mdnres.conf.5)にそれぞれインストールされます。 +
These manuals are by default installed in /usr/local/man/man8 (dnsproxy.8), /usr/local/man/man1 (mdnconv.1, runmdn.1) and /usr/local/man/man5 (mdnres.conf.5), respectively.
+ インストール先を変えるには、configure の --mandir オプションを使用します。 +
+
To change the location of installation, use the --mandir option of configure.
+
Configuration files +
+
このファイルの設定方法に関しては DNS Proxy Server のコンフィギュレーションを参照してください。 +
+
+
このファイルの設定方法に関してはmDNkit リゾルバのコンフィギュレーションを参照してください。 +
+
いずれもデフォルトでは /usr/local/etc にインストールされます。 + インストール先を変えるには、configure の--sysconfdir オプションを使用します。 +
+
Both files are by default installed in /usr/local/etc. To change the installation location, use the --sysconfdir option.
+
+
A basic mDNkit library that employs dnsproxy, mdnconv and other commands. +
いずれのライブラリもデフォルトでは /usr/local/lib にインストールされます。 + インストール先を変えるにはconfigure の --libdirオプションを使用します。 +
+
Both libraries are by default installed in /usr/local/lib. To change the installation location, use configure with the --libdir option.
+
+ +
展開したソースの中の$MDNTOP/patch/bind9/bind-9.0.0-patch がBIND 9.0.0 に多言語ドメイン名の処理機能を付加するパッチです。 +パッチの当て方はこのファイルの先頭にも書いてありますが、簡単に紹介すると、次のようになります。 +
$MDNTOP/patch/bind9/bind-9.0.0-patch in extracted source is the patch that adds multilingual domain name processing functionality to BIND 9.0.0. +Information on how to apply the patch is appended to the beginning of the file, but the following is a brief description.
+
Move to the BIND 9.0.0 source top directory (the directory that contains the README file). +
+++% cd /somewhere/.../bind-9.0.0 ++
Use the patch command to apply the patch to the source. +
+++% patch -p0 < $MDNTOP/patch/bind9/bind-9.0.0-patch ++
パッチを当てると、トップディレクトリに README.mdnkit というファイルが作られます。コンパイルの前にこのファイルを読んでください。 +
When the patch is applied a README.mdnkit file is created in the top directory. Read this file before compilation.
+ +
そのあとコンパイルとインストールを行います。方法は README.mdnkit +に書かれています。このファイルにも書かれていますが、configure コマンドの実行時に--with-mdn オプションをつけることを忘れないでください。 +このオプションをつけないと多言語ドメイン名の処理機能は付加されません。 +
After this perform compilation and installation. Refer to README.mdnkit for instructions. As stated in this file, be sure to add the --with-mdn option when executing the configure command. Unless this option is added, capability to process multilingual domain names will not be added. + +
++ ++% ./configure --with-mdn ++
bind9 用のパッチは mDNkit の本体 (特にライブラリとヘッダファイル) がすでにインストールされていることを前提としています。したがって、この作業はmDNkit 本体のインストール終了後に実行してください。 +
The bind9 patch assumes that the major portion of the mDNkit (especially, the library and header file) is already installed. Consequently, this operation should be performed after the mDNkit has been installed. +
+ +
展開したソースの中の$MDNTOP/patch/bind8/bind-8.2.2-P7-patch がBIND 8.2.2-P7 に対する 8ビットスルーパッチ、また$MDNTOP/patch/bind8/bind-8.2.3-T6B-patch がBIND 8.2.3-T6B に対する 8ビットスルーパッチです。 +パッチの当て方はこれらのファイルの先頭にも書いてありますが、簡単に紹介すると、次のようになります。 +
The $MDNTOP/patch/bind8/bind-8.2.2-P7-patch in the extracted source is the 8-bit through patch for BIND 8.2.2-P7 and the $MDNTOP/patch/bind8/bind-8.2.3-T6B-patch is the 8-bit through patch for BIND 8.2.3-T6B. +Information on how to apply the patch is appended to the beginning of the file, but the following is a brief description. +
Move to the top directory of the BIND 8.2.2-P7 or BIND 8.2.3-T6B source (the directory containing the src subdirectory). +
+++% cd /somewhere/.../bind-8.2.2-P7 ++
Use the patch command to apply the patch to the source. +
+++% patch -p0 < $MDNTOP/patch/bind8/bind-8.2.2-P7-patch ++
パッチを当てたら、あとは通常の BIND のインストール方法にしたがってコンパイルとインストールを行ってください。インストール方法は BIND のソース中の src/INSTALL に書かれています。 +
When the patch has been applied, perform compilation and installation according to the standard BIND installation procedure. Refer to src/INSTALL for installation instructions. + +
bind8 用のパッチは BIND を単に 8ビットスルーにするだけで、mDNkit のライブラリ等は使用しません。したがって mDNkit 本体とは独立にコンパイルおよびインストールすることができます。 +
+
The bind8 patch only makes BIND 8-bit through and does not use the mDNkit library. Thus it can be compiled and installed separately from the mDNkit. +
展開したソースの中の $MDNTOP/patch/squid/squid-2.3.STABLE3-patch がSquid 2.3.STABLE3 に対する 8ビットスルーパッチです。 +パッチの当て方はこのファイルの先頭にも書いてありますが、簡単に紹介すると、次のようになります。 +
The $MDNTOP/patch/squid/squid-2.3.STABLE3-patch in the extracted source is the 8-bit through patch for Squid 2.3.STABLE3. +Information on how to apply the patch is appended to the beginning of the file, but the following is a brief description. +
Move to the top directory of Squid 2.3.STABLE3 source (the directory containing the README file). +
+++% cd /somewhere/.../squid-2.3.STABLE3 ++
Use the patch command to apply the patch to the source. +
+++% patch -p1 < $MDNTOP/patch/squid/squid-2.3.STABLE3-patch ++
パッチを当てたら、あとは通常の Squid のインストール方法にしたがってコンパイルとインストールを行ってください。インストール方法はSquid のソースに含まれる INSTALL ファイルに書かれています。 +
When the patch has been applied, perform compilation and installation according to the standard Squid install procedure. Refer to INSTALL in the Squid source for installation instructions. +
Squid 用のパッチも bind8 用のパッチと同様単に 8ビットスルーにするだけで、mDNkit のライブラリ等は使用しません。 +したがって mDNkit 本体とは独立にコンパイルおよびインストールすることができます。
Both the Squid and the bind8 patches only add 8-bit through capability and does not use any mDNkit library or other function. +Thus they can be compiled and installed independently from the mDNkit. + + + diff --git a/contrib/idn/mdnkit/doc/en/guide/proxyconfig.html b/contrib/idn/mdnkit/doc/en/guide/proxyconfig.html new file mode 100644 index 0000000000..434391e5b4 --- /dev/null +++ b/contrib/idn/mdnkit/doc/en/guide/proxyconfig.html @@ -0,0 +1,389 @@ + + + +
++DNS Proxy Server dnsproxyを使うには、いくつかの情報を設定する必要があります。ここでは、これらの情報の設定方法と意味とを説明します。 +
+A number of data items have to be set up to allow use of dnsproxy, the DNS Proxy Server. This draft describes the procedure for setup, and its significance. +
+設定情報はコンフィギュレーションファイルに記載されます。コンフィギュレーションファイルは、dnsproxyの起動時にコマンドラインで指示することができます。 +
+The setup data can be found in the configuration file. The configuration file can be specified on the command line when dnsproxy starts up. +
++コマンドラインで指示しなかった場合にはデフォルトのコンフィギュレーションファイルが使用されます。 +デフォルトのコンフィギュレーションファイルは、ディレクトリ +When not specified on the command line, the default configuration file can be used. The default configuration file is found under the following directory. ++% dnsproxy -config <config-file> ++
+ /usr/local/etc ++の下の +
+ dnsproxy.conf ++です。ディレクトリは、mDNkit作成時に +
+ configure --sysconfdir=DIR ++This directory can be specified when the mDNkit is generated. +
+ configure --sysconfdir=DIR ++で指示することもできます。 +詳しくは、インストールガイドの +configure 実行の +ところをご覧ください。 + +For details, refer to the installation guide: +Configure and implement + +
+
+コンフィギュレーションファイルはテキストファイルで、以下のコンフィギュレーションデータを指定します。 +
+The configuration file is a text file and specifies the following configuration data. + +
+dnsproxyがクライアントからの要求を受付けるネットワークアドレス、ポート番号を指定します。 +
+Specifies the network address and port number dnsproxy needs in order to receive client queries. +
+ listen <address> ++<address>は以下のいずれかの形式で指示します。
++省略された場合には ++
++ <IP address>:<port number> + :<port number> + <IP address>
++が使用されます。 ++
++ IP address 0.0.0.0 # INADDR_ANY + port number 53
+dnsproxy経由でDNSサーバを使用するクライアントは、ここで指示したアドレス、ポートをDNSサーバとして設定します。 +クライアント側ではポート番号を変更できないものが多いのでポート番号はデフォルトの53をそのまま使った方がよいでしょう。 +
+
+Clients that use a DNS server via dnsproxy will set up the address and port of the DNS server here. +Because most clients cannot usually change the port number, it is best to use default port number 53. +
+ +
+dnsproxyが、DNS要求を転送し、応答を受け取る本来のDNSサーバのネットワークアドレス、ポート番号を指定します。 +
+dnsproxy transfers DNS queries and specifies the network address and port number of the DNS server that is to receive the response. + +
+ forward <address> [ bind4compat ] ++<address>の形式は上のlistenのものと同じです。 +<address>The address format is the same as that of listen above. +
+オプションの bind4compatが指示された場合には、UDPでリクエストを転送する時に、ソースアドレスとして、listenで指示されたアドレス/ポートを使用します。 +これはbind4にある機能で、UDPポートについてのアクセス制限下で運用することを想定したものです。このオプションが指示されなかった場合には、1024以上のソースポートが使用されます。 +
+
+When the option bind4compat is specified, the address and port specified by listen is used as the source address when a request is transferred using UDP. +This is a bind4 function and assumes that UDP port access is limited. A source port greater than 1024 is used when this option is not specified. +
+ +
+dnsproxyが実行ログを出力するファイル名を指定します。 +
+Specifies the name of the file that contains the execution log output by dnsproxy. +
+ log-file <path> ++ログファイル名は、以下のコマンドラインオプションで指定することもできます。 +両方指定した場合にはコマンドラインオプションの指定のほうが優先されます。 +
++The log file name can also be specified using the following command line option. +When both are entered, the command line option takes precedence. +
+ dnsproxy -logfile <address> ++指定されなかった場合には、 +
++When not specified, +
+ /tmp/dnsproxy.log ++に書き込まれます。 +
+ +is written. +
+なお、実行ログは常に追記されていきますので、適当な時を見計らって消すことをお勧めします。 +
+Note that the execution log is added to continuously and should be deleted from time to time. +
+また、dnsproxy にハングアップシグナル (SIGHUP) を送るといったんログファイルを閉じて、再度オープンするようになっています。ログファイルをアーカイブする場合に便利な機能です。 +
+
+When a hangup signal (SIGHUP) is sent to dnsproxy, it temporarily closes the log file and then reopens it. This is a convenient command when the log file is to be archived. +
+ +
+ログのレベルを設定します。 +
+Specifies the log level. +
+ log-level <level> ++レベルとして指定できる値は次の通りです。 +
+ +The following log level values can be specified. ++++
+- none
- 一切ログを記録しません。ログがないと不具合が生じた場合の +原因解明が難しくなりますので、できればこのレベルは指定しないでください。 +
- none
- No log is recorded. The absence of a log file makes it very difficult to identify the cause of a problem. If possible do not use this level. +
- fatal
- 致命的なエラーが生じたときにのみログを出力します。 +
- fatal
- Outputs a log only when a fatal error occurs. +
- warn
- 警告メッセージにもログに記録します。これがログレベルを +指定しなかったときのデフォルトです。 +
- warn
- Records warning messages in the log. This is the default used when no log level is specified. +
- trace
- 実行トレースメッセージもログに出力します。 +このレベルを指定すると dnsproxy の動作がかなり詳細に記録されるので障害が発生した場合の原因究明には便利ですが、大量のログが出力されるので普段は指定しない方がよいでしょう。 +
- trace
- Outputs execution trace messages in the log. +This level provides a detailed record of dnsproxy operation, which is helpful in determining the cause of a problem. As it records a large amount of data, it is best not used during normal operation. +
+ +
- client-translation
- +
+クライアント側でのドメイン名のエンコーディングを指示します。 +
+Specifies the domain name encoding to be used on the client side. ++ client-translation <ZLD> <Encoding> ++多言語ドメイン名に対応していないクライアントの場合には、通常、クライアントのローカルエンコーディングになっています。そのような場合には +
+For clients that do not support multilingual domain names, the local encoding of the client is normally used. In such a case, the following format is used without <ZLD>. ++ client-translation . Shift_JIS ++という形で、<ZLD>無しで指示します。 ++ +
+多言語ドメイン名の手法によっては、クライアント側で多言語ドメイン名を通常のDNSでも受付けられる形式にエンコードして、それを通常のドメイン名と区別するために ZLD (Zero Level Domain) を付加するものがあります。そのような場合には、付加されるZLDとその時のドメイン名のエンコーディング方法とを対応付けることにより、他の多言語ドメイン名手法のDNSサーバを利用することができるようになります。 +
+Some multilingual domain name schemes encode multilingual domain names in the client into a format that normal DNS can accept, and adds ZLD (Zero Level Domain) to distinguish it from regular domain names. Since the added ZLD and the domain name encoding scheme are interrelated, they can also be used with DNS servers using a different multilingual domain name scheme. + +
+ client-translation .i-dns.net UTF-5 ++ +クライアント側のドメイン名のエンコーディングは、ZLD が異なっていれば、複数指定することができます。 ++Multiple domain name encoding schemes can be used in a client if each scheme has its own unique \ZLDs. +
+なお、mDNkit のデフォルトの設定では ZLD の指定はできないようになっています。ZLD を使用するためには、mDNkit のコンパイルの際、configure コマンドに --enable-zldを指定する必要があります。この指定をせずに mDNkit をコンパイルした場合には、ZLD の指定はすべて無視されます。 +
+Note that ZLD cannot be specified in the default setting of mDNkit. To use a ZLD, --enable-zld must be specifed using the configure command when mDNkit is compiled. +All ZLD settings are ignored unless this specification is made when mDNkit is compiled. +
+クライアントから送られてきたDNS要求のドメイン名は、ここで指示したエンコーディングから、内部的に使用されるUTF-8エンコーディングに変換されます。 +そして、後述の正規化、サーバ側エンコーディングへの変換が行なわれてDNSサーバに送出されます。また、DNSサーバからの応答は、逆に元のエンコデーィングに戻されてクライアントに返されます。 +
+The encoding of domain names in the DNS query sent by the client is converted to UTF-8 encoding that is used internally. +Then normalization (described below) and conversion to server side encoding are performed after which the data is sent to the DNS server. The response from the DNS server is converted back to the original encoding and returned to the client. +
+ここで指定可能なエンコーディング名は、mDNkit付属のlibmdnおよび使用するiconv ライブラリに依存します。 +iconv ライブラリによって、エンコーディング名が異なっていることがありますので、ライブラリのマニュアルをご覧になって使用可能なエンコーディング名を確認してください。 +
+The encoding names that can be used here depend on libmdn and iconv, mDNkit libraries. +Since the encoding name used differs with the iconv library that is employed, check the library manual to confirm the encoding names that can be used. In addition to the enconding provided by iconv, libdmn supports the following encoding schemes recommended for multilingual DNS. +
++をサポートしています。 ++
++ UTF-5 +draft-jseng-utf5-01.txt ++ RACE +draft-ietf-idn-race-02.txt ++ BRACE +draft-ietf-idn-brace-00.txt ++ LACE +draft-ietf-idn-lace-00.txt ++ +
- alternate-encoding +
- +
DNS サーバから返されたドメイン名がクライアントのローカルエンコーディングに変換できない文字を含んでいた場合に、ローカルエンコーディングの代わりに使用するエンコーディングを指定します。 +
Specifies the encoding to be used in place of local encoding when the domain name returned by the DNS server contains characters that cannot be converted to the local encoding of the client. +
+ alternate-encoding <Encoding> ++指定するエンコーディングは必ず「ASCII互換エンコーディング (ACE)」と呼ばれる、変換結果が従来のドメイン名として使用可能な文字 (英数字およびハイフン) だけからなるエンコーディングでなければなりません。たとえば ASCII 互換エンコーディングの一つである RACE を指定する場合には次のように指定します。 +The specified encoding must be ASCII compatible encoding (ACE) so that the result of conversion is in an encoding that contains only characters that can be used in traditional domain names (alphanumerics and hyphens). For example, this is how to specify RACE, one of the ASCII compatible encoding schemes. +
+ alternate-encoding RACE +++ +
- normalize
- +
+ドメイン名の正規化手法を指定します。 +
+Specifies the normalization scheme to be used for domain names. +
+ normalize <scheme> ... ++正規化手法は複数指定可能で、左側から順に適用されていきます。 ++A number of normalization schemes can be indicated, and they will be used in order from left to right. +
+クライアントから送られてきたDNS要求のドメイン名は、内部的に使用されるUTF-8エンコーディングに変換された上で、ここで指示した正規化が適用されます。 +使用可能な正規化手法はmDNkitに含まれるlibmdnに依存しています。 +どのような正規化手法があるかは、libmdnのマニュアルのnormalizer モジュールに記載されています。 +
+When the domain name in the DNS query sent by the client has been converted to UTF-8 encoding for internal use, they are normalized according to the normalization scheme specified here. +The normalization schemes that can be used depends on the libmdn in the mDNkit. +Available normalization schemes are described in the Normalizer Module in the libmdn manual. +
+ +
- server-translation
- +
+DNSサーバ側のドメイン名エンコーディング方法を指示します。 +
+Specifies domain name encoding schemes to be used on the DNS server side. +
+ server-translation <ZLD> <Encoding> ++ZLDが不要なエンコーディングであれば、省略値として'.'を指示します。 + +
Specifies '.' as the default when ZLD is not necessary. + +
+ server-translation . UTF-8 ++ZLDを必要するエンコーディングでは、ZLDとエンコーディング名の両方を指定します。 +++When ZLD is required, specify both ZLD and the encoding name. ++ server-translation .i-dns.net UTF-5 ++指定可能なエンコーディングは、前出のclient-translationでのものと同じです。 ++ +The encoding that can be specified is the same as for client-translation above. +
+ +
- user-id +
- +
dnsproxy が動作するユーザを指定します。 +
Specifies user that uses dnsproxy. +
+ user-id <user> ++通常、dnsproxy は特権ポートを使用するためルート権限で起動させる必要がありますが、ルート権限のままで動作させるのはセキュリティ上好ましくありません。この指定により、dnsproxy は特権ポートを作成したあとサービスを開始する前に指定したユーザの権限で動くようになります。 +
Normally, dnsproxy must be started up with root permission to use a privileged port, but continued use of root permission is not recommended for security reasons. With this specification, dnsproxy runs under the user's control with a privileged port before start of service. +
<user> にはユーザ名あるいはユーザ ID 番号を指定することができます。 +
+
<user> allows you to specify user name or user ID number. +
+
- group-id +
- +
dnsproxy が動作するグループを指定します。 +
+Specifies group that uses dnsproxy. +
+ group-id <user> +++これは user-id エントリと似ていますが、ユーザの代わりにグループを指定する点が異なります。 +
+This resembles the user-id entry, but differs from it in that it specifies a group in place of the user. + +
<group> にはグループ名あるいはグループ ID 番号を指定することができます。 +
<group> can be specified by a group name or group ID number. +
+
- root-directory +
- +
dnsproxy が動作する際のルートディレクトリを指定します。 +
Specifies the root directory used with dnsproxy. +
+ root-directory <path> ++これもセキュリティ対策の一つです。dnsproxy が動作する際のルートディレクトリ +を指定することで、そのディレクトリの外にはアクセスできないようにします。 +この指定により、dnsproxy はサービスを開始する前に、chroot()システムコールを用いて指定したディレクトリをルートディレクトリとして設定します。 +
This, also, is a security measure. By specifying the root directory used with dnsproxy access cannot be made outside of this directory. +This specification causes dnsproxy to use chroot() system calls to set the specified directory as the root directory before starting service. + +
<path> にはルートとして設定したいディレクトリ名を指定します。 +
<path> specifies the name of the directory to be used as the root. + +
多言語ドメイン名の方式の提案、関連 RFC、ソフトウェア等、mDNkit に関連する参考文献のリストです。 +
Lists of references for recommended multilingual domain name schemes, related RFCs, software and mDNkit. +
+ +JPNIC の多言語ドメイン名に関する技術解説のページにある関連資料も合わせてご覧ください。 +
Also refer to Related documents on the page that describes the technology behind JPNIC multilingual domain names. +
+ +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+
+
mDNkit が提供するツール、コマンドのうち、dnsproxy 以外のもの、つまり runmdn と mdnconv は共通の設定ファイルを参照します。 +また bind9 パッチも同じ設定ファイルを参照します。 + +
runmdn and mdnconv, commands and tools that the mDNkit provides in addition to dnsproxy, reference the shared configuration file. +The bind9 patch also references the same configuration file. +
このファイルには mDNkit を利用したクライアントあるいはリゾルバが必要とするいくつかの情報を設定する必要があります。 +例えば正規化の方式や DNS プロトコル上で用いられるドメイン名のエンコーディング方法などをこのファイルで指定します。 +ここでは、これらの情報の設定方法と意味とを説明します。 +
A number of data items that the client or resolver needs, in order to be able to use the mDNkit, must be entered in this file. +For example, the normalization scheme and the domain name encoding scheme in the DNS protocol are specified in this file. +The procedure for entering this data, and its significance, are described below. + +
また、アプリケーションの使用するローカルエンコーディングはアプリケーションの動作するロケール情報から取得します。これについても合わせて説明します。 +
The local encoding used by the application is acquired from the locale information of the application. + +
+mDNkit の設定は、コンフィギュレーションファイルによって行われます。 +mDNkit をデフォルトの設定でコンパイルした場合には、このコンフィギュレーションファイルのパス名はとなります。 +
mDNkit is set up using the configuration file. +When mDNkit is compiled in the default setting, the path name of the configuration file becomes the following. +
++ディレクトリ部分、つまり /usr/local/etc はmDNkit の設定時にオプションで変更が可能です。 ++/usr/local/etc/mdnres.conf ++
The directory, /usr/local/etc, can be changed using option when setting up the mDNkit. + +
mDNkit をインストールすると、このファイルのサンプルファイルが(デフォルトの設定の場合) にインストールされます。 +
When mDNkit is installed, a sample file of this file is installed (when the default setting is used). +
++このサンプルファイルには設定項目とその説明が書かれていますので、コンフィギュレーションファイル作成の参考にしてください。 ++/usr/local/etc/mdnres.conf.sample ++
This sample file contains the setting items and their descriptions. Use this information as reference in generating the configuration file. + +
+ +
+コンフィギュレーションファイルは通常のテキストファイルで、以下のコンフィギュレーションデータを指定します。 +
+The configuration file is a text file, and specifies the following configuration data. + +
Specifies the encoding used by a DNS protocol. +
+server-encoding encoding ++encoding にエンコーディング名を指定します。 +encoding specifies the encoding name. + +
++ +なお、アプリケーション側のローカルエンコーディングはロケールによって決まるので、client-encoding というエントリはありません。 +ローカルエンコーディングに関しては後述します。 ++
+- [設定例] +
- [Setting example] +
- +
+server-encoding RACE +server-encoding UTF-8 ++
+The local encoding used by the application is determined by the locale so there are no client-encoding entries. +Local encoding is described in the Section below. + +
+server-zld ZLD ++ZLD で使用する ZLD を指定します。
+ZLD is used to specify ZLD. + +
+++
+- [設定例] +
- [Setting example] +
- +
+server-zld zld.to.be.used ++
+ +
+This entry specifies the normalization scheme to be used. +When 2 or more normalization schemes are specified, this will apply in order from left to right. + +
+normalize scheme... ++scheme で正規化の方式の名称を指定します。 +
+scheme specifies the normalization scheme to be used. + +
正規化の方式として以下のものが指定できます。 +
The normalization schemes listed below can be specified. + +
++ ++
++ ascii-lowercase +ASCII の大文字を小文字に正規化
+Normalizes upper case ASCII as lower case+ ascii-uppercase +ASCII の小文字を大文字に正規化
+Normalizes lower case ASCII as upper case+ unicode-lowercase +Unicode の大文字を小文字に正規化
+Normalizes Unicode upper case as lower case+ unicode-uppercase +Unicode の小文字を大文字に正規化
+Normalizes Unicode lower case as upper case+ unicode-form-c +Unicode normalization form C + unicode-form-kc +Unicode normalization form KC + ja-kana-fullwidth +半角カナ文字を全角カナ文字に正規化
+Normalizes half-width kana as full-width kanaja-alnum-halfwidth +全角英数字およびマイナス記号を半角文字に正規化
+Normalizes full-width alphanumerics and minus symbol as half-width characters+ ja-compose-voiced-sound +全角ひらがなカタカナとそれに続く濁点半濁点を1文字にまとめる正規化
+Normalizes full-width hiragana, katakana with voicing and aspirating signs as one character.+ ja-minus-hack +全角マイナス記号をハイフン ('-') に正規化
+Normalizes full-width minus symbol as a hyphen ('-').+ ja-delimiter-hack +全角ピリオドおよび句点を半角のピリオド ('.') に正規化
+Normalizes full-width periods and punctuation marks as half-width period ('.').
++ ++
+- [設定例] +
- [Setting example] +
- +
+normalize unicode-lowercase unicode-form-kc ++
+alternate-encoding encoding ++encoding に代替エンコーディングの名称を指定します。 +Enter the name of the alternate encoding in encoding. + +
+代替エンコーディングは、ASCII 互換エンコーディングでなくてはなりません。 +
+
+The alternate encoding must be an ASCII-compatible encoding. +
+ +
++ ++
+- [設定例] +
- [Setting example] +
- +
+alternate-encoding RACE ++
+The encoding code set name can be entered as an alias. +Here, we will enter the path name of the alias definition file to be added. + +
+alias-file path ++path に定義ファイルのパス名を指定します。 +Enter the definition file path in path. + +
++ +別名の定義ファイルは通常のテキストファイルであり、1行に1つずつ別名を定義します。各行の形式は次の通りです。 ++
+- [設定例] +
- [Setting example] +
- +
+alias-file /some/where/mdnalias.txt ++
The alias definition file is a normal text file in which one alias is defined on each line. The line format is as follows. +
++エンコーディング名 <元の名前> の代わりに <別名> が使えるようになります。 +<an alias> can be used instead of the encoding name <original name> + ++<別名> <元の名前> +<alias> <original name> ++
+ローカルエンコーディングについては、ロケールから推測して自動判定するため、コンフィギュレーションファイルでは、ローカルエンコーディングを設定するエントリはありません。 +
+There is no entry for setting local encoding in the configuration file because it is automatically determined by referencing the locale on the local machine. + +
+ただし、以下のようなケースのときには自動判定ができません。 +
+However, the following cases cannot be automatically sensed. + +
+このような場合には環境変数 MDN_LOCAL_CODESET を設定することで、ローカルエンコーディングの設定を行うことができます。 +例えばローカルエンコーディングを EUC-JP に設定する場合には、あらかじめ次のような設定をしておきます。 +
+Specify the MDN_LOCAL_CODESET environment variable to set local encoding. For example, to set local encoding to EUC-JP, make the following setting beforehand. + +
++ ++
+- [設定例] +
- +
+
+- sh 系のとき +
- +
+$ MDN_LOCAL_CODESET=EUC-JP +$ export MDN_LOCAL_CODESET ++- csh 系のとき +
- +
+% setenv MDN_LOCAL_CODESET EUC-JP ++
指定する値はローカルエンコーディング名で、これはシステムのiconv() 関数 (より正確には iconv_open()) が受け付ける名前で指定します。この名前は iconv の実装によってそれぞれ異なりますので、具体的な値については iconv のドキュメントを参照してください。 +
The value to be specified is a local encoding name that must be specified using a name that is accepted by the iconv() function in the system (or more precisely iconv_open()). This name differs with the iconv implementation, refer to the iconv document for details. + +
もしあなたが単一のローカルエンコーディングしか使用していないのであれば、このような設定を .profile や .cshrc 等に入れておくことをお勧めします。 +
If you only use a single type of local encoding, it is recommended that you save this setting in .profile or .cshrc. + + diff --git a/contrib/idn/mdnkit/doc/en/guide/runmdn.html b/contrib/idn/mdnkit/doc/en/guide/runmdn.html new file mode 100644 index 0000000000..276cec2d16 --- /dev/null +++ b/contrib/idn/mdnkit/doc/en/guide/runmdn.html @@ -0,0 +1,103 @@ + + + + +
+runmdn は bind4 あるいは bind8 をベースとしたリゾルバライブラリを持つ Unix クライアントを、再コンパイルなしに多言語ドメイン名を扱えるようにするためのコマンドです。具体的には、名前解決用の API (例えば gethostbyname) がアプリケーションのローカルエンコーディング (EUC-JP 等) で表現されたホスト名を受け付けるようになります。またこれらの API が多言語ホスト名をローカルエンコーディングで返すようになります。 +
runmdn is a command that enables a Unix client with the bind4 or bind8 based resolver libraries to support multilingual domain names without recompiling. Specifically, the name-resolving API (for example, gethostbyname) accepts host names denoted in the local encoding (EUC-JP, etc.) of the application, and also returns multilingual host names in local encoding. + +
runmdn を使用してクライアントが多言語ドメイン名を扱えるようにする方法は、mDNkit が提供する方法の中で最も手間がかからず簡単なものですが、システムによっては使用できなかったり、コマンドによっては効果がなかったりします。これらの制限に関しては制限事項の項をご覧ください。 +
Using runmdn to enable clients to support multilingual domain names is the easiest and least time-consuming of the methods provided by the mDNkit. However, it cannot be used with some systems and does not work with certain commands. See the Section Limitations for details. +
+ +
runmdn を使用するには、mDNkit のクライアント共通設定ファイルで使用するエンコーディングや正規化の方法を設定しておく必要があります。このファイルの設定方法についてはmDNkit リゾルバのコンフィギュレーションをご覧ください。 +
To use runmdn, the encoding and normalization schemes must be specified in the shared mDNkit client file. Refer to mDNkit Resolver Configuration for information on how to configure this file. + +
また、runmdn はアプリケーションのローカルエンコーディングを自動的に推測しますが、推測に失敗する場合もあります。そのような場合の対処方法はローカルエンコーディングについてをご覧ください。 +
runmdn automatically senses the local encoding used by an application, but this may sometimes fail. In such an event, refer to Local Encoding for procedures to deal with the situation. + +
+ +
runmdn の使い方は極めて簡単で、アプリケーションの起動コマンドの先頭にコマンド名 runmdn をつけるだけです。 +
runmdn is very easy to use. All that has to be done is to append runmdn, the command name, to the beginning of the application startup command. + +
++ ++% runmdn コマンド [引数...] +% runmdn command [argument...] ++
例えば telnet コマンドを使用してホスト「私の会社.jp」に接続するには次のようにします。 +
For example, to use the telnet command to connect to the host "私の会社.jp", do as follows. + +
++ ++% runmdn telnet 私の会社.jp ++
runmdn は、mDNkit が提供している方法の中で最も手軽にクライアントが多言語ドメインを扱えるようにするものですが、どのようなクライアントにも適用できるわけではありません。 +
runmdn is the easiest method for enabling clients to support multilingual domain names of all the methods that the mDNkit provides. However, this method may not be applicable for some clients. + +
runmdn はシステムの持つ共有ライブラリの動的リンク機構(ライブラリのプリロード機能) を利用し、クライアントアプリケーションの実行時に、アプリケーションにリンクされているリゾルバライブラリの一部の関数を多言語ドメイン名を扱う機能を持たせたバージョンのものと置き換えてしまうことによって多言語ドメイン名の処理を実現します。置き換える関数は bind4 および bind8 をベースとするリゾルバが内部で使用している関数です。 +
runmdn uses the dynamic link (a library pre-load function) of system-owned shared libraries to replace some of the functions of the resolver libraries linked to an application with versions with functions that can handle multilingual domain names to enable handling of multilingual domain names. The functions that are replaced are functions used in bind4- and bind8-based resolvers. + +
したがって runmdn が動作するには次のようないくつかの制限があります。 +
As a result, runmdn operation has the following limitations: +
これらの制限により runmdn が使用できない場合は、mDNkit が提供する他の方法 (dnsproxy や bind9 パッチ など) をご利用ください。 +
When these limitations make use of runmdn impossible, other methods provided by the mDNkit (for example, dnsproxy or bind9 patches) can be used. + + + diff --git a/contrib/idn/mdnkit/doc/en/guide/wrapper.html b/contrib/idn/mdnkit/doc/en/guide/wrapper.html new file mode 100644 index 0000000000..a03f5ea28f --- /dev/null +++ b/contrib/idn/mdnkit/doc/en/guide/wrapper.html @@ -0,0 +1,491 @@ + + + + +
++ +
+
+ +
+
+
+ +
+Windows で多言語ドメイン名を扱えるようにするためには、Windows 上のクライアントアプリケーションにおいて、解決しようとする名前のエンコーディングを、DNS サーバが受付ける形式のものに変換する必要があります。これは、Windows 上のアプリケーションが、きちんと多言語ドメイン名を扱えるようになっていなければならない、ということであり、本来はそれぞれのプログラムの作成者が行なうべきことです。 +
+To enable Windows to support multilingual domain names, the name encoding that client applications resolve must be converted to a format that DNS servers can accept. This requires accurate handling of multilingual domain names by Windows applications, which is basically the responsibility of each program developer. +
+しかし、標準が決まっていない現状では、プログラム作成者にこのような対応を期待するのは無理なので、既存のアプリケーションを多言語ドメイン名対応させるためのトリックが必要になります。mDNkitに含まれるdnsproxyサーバはそのための一つの方法です。 +ここでは、もう一つの方法、mDN Wrapper を提示します。 +
+However, as no standard is yet in place, this is too much to expect of program developers at this time. Therefore, a trick is needed so that existing applications will be able to support multilingual domain names. The dnsproxy server supplied with the mDNkit is one such tool. In this draft, we will introduce another tool, the mDN Wrapper. +
+Windows において、多くの場合、ドメイン名解決の要求はWINSOCK DLLに渡されます。そこで、WINSOCK DLL を多言語ドメイン名対応のものに置き換えてやれば、既存のプログラムからでも多言語ドメイン名を使うことができるようになります。 +
+Queries to resolve domain names in Windows are often passed to WINSOCK DLL. By replacing WINSOCK DLL with one that supports multilingual domain names, it will be possible for existing programs to support multilingual domain names. +
+ +
+*注意* +もし古いバージョンの mDN Wrapper がすでにインストールされているマシンに新しいバージョンをインストールする場合には、まずバージョンアップ時の注意をご覧ください。 +
+
+*Note:* +If an old version of mDN Wrapper is already installed, read the Precautions in Upgrading before installing the new version. +
+mDN Wrapper をインストールするには"setup.exe" を実行します。セットアッププログラムは次のような処理を行います。 +
+Use "setup.exe" to install mDN Wrapper. The setup program does the following.
+
+Copy the file containing mDN Wrapper to the 「\Program Files\JPNIC\mDN Wrapper」(can be changed at setup) directory. +
+ +
+
+Create the required registry key and registry values under HKEY_LOCAL_MACHINE\Software\JPNIC\MDN. The major items are as follows. +
+
+An encoding name used on the DNS server side. +The default value is "RACE", which is currently the leading encoding scheme. +The encoding name can be changed using the configuration program. +
+ +
+A domain name normalization scheme used to specify normalization names (multiple names must be separated by spaces). +It is set to a default value that is considered appropriate for normalization of Japanese domain names. +This value can also be changed using configuration program. +
+ +
+A key used to store values set for each program. Program specific setting is stored with its executable module name used as a key. The following two types of infomration is set.
+
| PerProg\<progname>\Where | REG_DWORD | 変換位置 Conversion location |
+
| PerProg\<progname>\Encoding | REG_SZ | エンコーディング名 Encoding name |
+
+エンコーディング名は通常コンフィギュレーションプログラムによって設定されます。 +変換位置の指定は、標準インストールでは不要です。 +システムディレクトリへのインストールを行なった場合には、レジストリエディタで環境に合わせて設定する必要があります。 +
+The encoding name is normally specified by the configuration program. +The conversion location is not required for a standard installation. +When the program is installed in the system directory, the registry editor must be used to adjust the environment. + +
+
+
+Create a configuration program icon and place it in the Start menu. +This icon allows you to start up the configuration program. + +
+アンインストールするには、コントロールパネルの「アプリケーションの追加と削除」で、「mDN Wrapper」を選択して削除(「追加と削除」ボタン)します。 +
+To uninstall the program, select "mDN Wrapper" in Add/Remove Programs in the Control Panel and click the Add/Remove button. +
+ +
+
+ +コンフィギュレーションプログラムは、アプリケーションを特定して mDN Wrapper を適用したり、適用を解除するためのツールです。 +
+The configuration program is a tool for specifying applications that are to be wrapped or unwrapped. +
+起動すると以下のような画面が表示されます。 +
+
+The screen shown below appears when the program is started. +
+ +
++リストボックスには、その時点で mDN Wrapper が適用されているプログラムが表示されます。最初に実行した場合には空になっています。右側のボタンを押すことにより、操作を行うことができます。 + +
+The list box shows programs that mDN Wrapper is currently wrapping. +The box is blank when the program first starts. Press the buttons on the right to begin. + + +
+Press the "Wrap.." button to wrap a program using mDN Wrapper. +Pressing the "Wrap.." button displays the following dialog box. +
+
++最初に、mDN Wrapper を適用したいプログラムの実行ファイル名を設定します。 +直接入力するか、ブラウズボタンでファイルを探してください。 +
+
+First set the filename of the program that mDN Wrapper is to wrap. Enter the name directly or use the Browse button to find the file. +
+
++次にそのプログラムのローカルエンコーディングを指定します。 +通常は「Default」 でかまいません。 +プログラムが国際化エンコーディングに従っている場合にのみ「UTF-8」 を指示します。 +
+
+Then, specify the local encoding of the program. +Select "Default" for the standard setting. +Select UTF-8 only if the program supports international encoding. +
+
++最後に "Wrap" ボタンを押せば、そのプログラムに対して指定されたエンコーディングで mDN Wrapper が適用されます。 +適用されたプログラムは、最初のウィンドウのリストボックスに反映されます。 +
+
+Then press the Wrap button to use mDN Wrapper with the specified encoding for the selected program. +The wrapped program is displayed in the list box in the first window. +
+ +
++To cancel the use of mDN Wrapper for a program, select the program in the list box and click the Unwrap button. +The confirmation dialog box shown below is displayed. If this is correct, click the Unwrap button. +
+
++mDN Wrapper の適用が解除されると、そのプログラムは最初のウィンドウのリストボックスからも削除されます。 +
+When use of mDN Wrapper is canceled for a program, that program is no longer displayed in the first window list box. +
+
++"Unwrap All" ボタンを押すことによって、現在適用されているすべてのプログラムに対して mDN Wrapper の適用を解除することもできます。 + +
+Use the Unwrap All button to cancel use of mDN Wrapper for all currently selected programs. + +
+Click the "Log.." button to set a log level or log file. +The dialog box shown below is displayed when this button is clicked. +
+
++ログレベルは次の中から選ぶことができます。 +
+The following log levels can be selected. +
+These log levels are for logs output by the mDN library. Because the mDN Wrapper log can only be set to "on" or "off," "None" turns off the log entirely (however, it is "on" in all other cases). +
+ログファイルを指定することも可能です。デフォルトでは mDN Wrapper をインストールしたディレクトリの "mdn_wrapper.log" になっています。 +"Browse.." ボタンを押せばブラウズ用のダイアログを利用して選択することができます。 +
+A log file can also be specified. The default setting is mdn_wrapper log and is stored in the directory where mDN wrapper is installed. +Click the Browse button to select the file from the Browse dialog box. +
+また、このダイアログではログファイルの内容を見ることと、ログファイルを削除することが可能です。それぞれ "View"、"Delete" ボタンを押してください。 +"View" ボタンを押すとメモ帳が起動して、ログファイルの内容を表示します。 +
+This dialog box can also be used to view and delete the log file. Use the View or Delete buttons to do this. +When the View button is clicked, NotePad opens displaying the contents of the log file. +
+"OK" ボタンを押すとダイアログの設定が有効になります。設定を変えたくない場合には "Cancel" ボタンを押してください。 +
+Click the OK button to confirm the dialog settings. Click the Cancel button when none of the settings are to be changed. + +
+ +Click the "Advanced.." button to display the dialog box shown below. +This is for experienced users; an appropriate default setting is provided for ordinary users to enable the change of basic parameters without the need for making detailed settings. +
+
++ダイアログ最上部のパネルでプログラムに対する mDN Wrapper の適用モードを指定することができます。選択できる値とその意味は次の通りです。 +
+The appropriate mDN Wrapper mode can be set in the panel at the top of the dialog box. Settings and their meanings are listed below. +
+中段のパネルでは正規化の方式を設定することができます。左側のリストボックスに使用する正規化の名称が入っており、右側のリストボックスには使用可能な正規化の名称が入っています。右側のリストボックスから追加したい正規化を選択し、"Add" ボタンを押すと左側のリストボックスに追加されます。 +また、左側のリストボックスで削除したい正規化を選択して "Remove" ボタンを押せば削除することができます。"Clear" ボタンを押すとすべての正規化が削除され、また "Reset" ボタンによりデフォルトの設定に戻すことができます。 +
+Normalization schemes can be set in the center panel. The left box lists the names of selected normalization schemes, while the box on the right lists the names of available normalization schemes. Select a normalization scheme from the right box; click the Add button to add it to the list in the left box. +You can also delete normalization schemes from the left list box, by selecting it and clicking the Remove button. The Clear button removes all normalization schemes, and the Reset button reinstates the default settings. + +
+3段目のパネルでは DNS サーバ側のエンコーディング名を指定することができます。 +デフォルトは "RACE" ですが、他のエンコーディングを使用したい場合には +ここで指定してください。 +
+The third panel is used to enter the encoding name of the DNS server. +The default setting is RACE, but this panel allows you set the desired encoding. + +
+以上の設定は "OK" ボタンを押すことにより有効になります。設定を変えずにダイアログを終了したい場合には "Cancel" ボタンを押してください。 +
+The settings become effective by clicking the OK button. Click Cancel to close the dialog box without changing the settings. + +
+ +
+ラッパーDLL は、元のWINSOCK のDLL のバージョンに強く依存します。 +これは、非公開のエントリも含めてすべてのエントリを提供する必要があるためです。 +このためWINSOCK DLL のバージョンが変わると、mDN Wrapper が動作しなくなる可能性があります。 +
+Wrapper DLL is highly dependent on the original WINSOCK DLL version. +This is because all entries including non-public entries must be supplied. +As a result, mDN Wrapper may stop functioning when a different version of WINSOCK DLL is installed. +
+今回作成されたmDN Wrapper は、 +
+It has been confirmed that the current version of mDN Wrapper operates with the following software. +
++で動作を確認しています。ただ、将来にわたって動作する保証はありません。 ++
++ WinNT4.0 SP6a (WINSOCK 1.1 + 2.0) + Win98 (WINSOCK 1.1 + 2.0) + Win95 OSR2 (WINSOCK 1.1)
+There is no guarantee, however, that it will function in the future. +
+
+Windows では、DNS だけではなく、WINSやLMHOSTS によってもドメイン名、ホスト名の解決が行なわれます。 +mDN Wrapper を使った場合には、ドメイン名の変換が、これらの方式へのディスパッチを行なう場所よりも上位層で行なわれるので、これらのすべての方式について、ドメイン名、ホスト名の変換が行なわれることになります。 +このため、Windows が、WINSやLMHOSTS を使っている場合には、予期しない問題が発生する可能性があります。 +これについては、mDN Wrapper を使う場合には、名前解決にDNS だけを使用することをお勧めします。 +
+In Windows, not only DNS but also WINS and LMHOSTS resolve domain names and host names. When mDN Wrapper is used, domain name conversion are not dispatched to these schemes but are performed at a higher level. +As a result, when Windows uses WINS or LMHOSTS, unexpected results may occur. Thus when you use mDN Wrapper, we recommend that only DNS is used for name resolving. +
+
+WINSOCK 2.0 の名前解決API +
The following are WINSOCK 2.0 name resolving APIs +
++は、ドメイン名以外でも使用できる汎用の名前解決用のAPI として定義されています。 +現時点では、これらはもっぱらドメイン名の解決で使用されていますが、他の名前(例えばサービス名)の解決にも使用できることになっています。 ++
++ WSALookupServiceBeginW + WSALookupServiceNextW + WSALookupServiceEnd
+These are defined as a universal name resolving API that can be used for other than domain names. Currently, it is used only for resolving names, but it can also be used for resolving service names, for example. + +
+mDN Wrapper は、名前の対象の如何にかかわらず、名前のエンコーディングを変換してしまうので、これらのAPI が、ドメイン名以外の解決に使われている場合には、問題を引き起こす可能性があります。 +
+Because the mDN Wrapper converts encodings of any type of name, these APIs could cause problems if used for resolving names other than domain names. +
+
+Programs not using name resolving API +
+アプリケーションによっては、ドメイン名の解決にこれらのAPI を使用しないものもあります。例えば、'nslookup'は、これらのAPI を使用しないで、直接DNS サーバと通信してしまいます。このようなアプリケーションについては、mDN Wrapper は役に立ちません。 +
+Some applications do not use these APIs for resolving domain names. +For example, nslookup does not; instead, it communicates directly with the DNS server. mDN Wrapper cannot be used for such applications. +
+
+Applications tied to specific WINSOCK DLLs +
+
+アプリケーションによっては、標準のDLL サーチパスに従わないで、 +特定のパスのDLL にバインドされているものがあります。 +よく使われるプログラムの中では、Netscape Communicator がそうなっています。 +このようなプログラムについては、標準のインストール/コンフィギュレーションでは mDN Wrapper を適用することはできません。 +
+Some applications do not conform to standard DLL search paths, but are tied to a DLL of a specific path. An often used program, Netscape Communicator, is a case in point. mDN Wrapper cannot be added to such programs in a standard install or configuration. +
+このようなプログラムについて、どうしても mDN Wrapper を適用する必要があるなら、システムディレクトリへのインストールを行なうことができます。 +ただし、このインストールは大変危険で、場合によってはシステムを再起動不能にしてしまう可能性もあります。 +
+If mDN Wrapper must be added to this type of program, it can be installed under the system directory. +However, such an installation is quite risky as it may sometimes make it impossible to restart. +
+
+
+これらの制限事項が問題になる場合には、代替手段として'dnsproxy'を使うこともできます。これは、DNS サーバとのトランザクションを中継するので、上で問題になったようなことを回避することができます。 +
+dnsproxy can be used as an alternate approach to avoid such limitations. +The above problems are avoided since dnsproxy operates between the DNS server and the transaction. +
+ただし、'dnsproxy'は、ラッパーよりも複雑な設定が必要ですし、また、呼び元のプログラムを特定することができませんので、プログラム固有のローカルエンコーディングを取り扱うことはできません。しかし、上記の制限事項が問題になるようなケースでは、ラッパーの代わりに使用するといいかもしれません。 +
+However, dnsproxy requires a more complex setup procedure than Wrapper and cannot identify a calling program so it cannot handle the local encoding of specific programs. +It is perhaps best used as an alternative to Wrapper to avoid the above limitations. +
古いバージョンの mDN Wrapper がすでにインストールされているマシンに新しいバージョンをインストールする際には、次のことに気をつけてください。 +
Note the following when a new version of the software is to be installed in a machine containing an earlier version. + +
+Uninstall old version prior to installation.
+Before the most recent version is installed, uninstall the old version. Otherwise, a number of files will not be updated and the old version will remain in effect even though the latest version has been installed.
+To delete, open the Control Panel and select mDN Wrapper in Add/Remove Applications.
If you made the mistake of installing the new version without first removing the old version, first uninstall, and then reinstall, the software.
+ +
+Re-wrapping all files
+mDN Wrapper copies a DLL file to the directory that contains programs that can be wrapped by mDN Wrapper.
+The copied DLL is not automatically updated to the latest version when a new version of the software is installed preventing use of the latest version. Therefore, after installation, unwrap all applications wrapped using mDN Wrapper and then wrap them again. The easiest way to do this is to click the Unwrap All button in the configuration program.
+
+mDNkit に含まれる BIND-9 用のパッチファイルを適用することにより、 +BIND-9 において従来の ASCII 文字によるドメイン名に加え、 +非 ASCII 文字による多言語ドメイン名を扱うことが可能になります。 +
+The BIND-9 patch file included in the mDNkit provides the ability to support both conventional ASCII character domain names and non-ASCII character-derived multilingual domain names. +
+具体的には、このパッチは BIND-9 に次のような機能を追加します。 +
+Specifically, this patch adds the following functions to BIND-9. +
+BIND-9 へのパッチの適用方法は、パッチファイルの先頭に記載してあります。 +なおパッチファイルについては、 +対応する BIND のバージョンをよく確認してから、使用してください。 +
+Instructions for how to apply the patch file to BIND-9 is explained at the beginning of the patch file. +Before using the patch file, be sure to check the version of BIND being used. +
+ +
BIND-9 はそれまでの BIND-8 とはリゾルバの構成が全く異なっています。 +BIND-8 まではリゾルバはアプリケーションにリンクされるライブラリとして +実装されていましたが、 +BIND-9 ではリゾルバの機能の大部分が +lwresd (lightweight resolver daemon) というサーバに移され、 +アプリケーションにリンクされるのはlightweight resolver と呼ばれる +lwresd との通信を行うためのライブラリとなっています。 +
BIND-9 has a different resolver structure than BIND-8. +Up to BIND-8, the resolver was implemented as a library linked by the application. However, with BIND-9, most of the functions of the resolver have been moved to the server called lwresd (lightweight resolver daemon) and only the library called lightweight resolver that is used to communicate with lwresd is linked by the application. + +
本パッチはこのアーキテクチャに合わせ、多言語ドメイン名の各処理を +それぞれのコンポーネントに分散させました。以下に各コンポーネントで +実装される機能とコンポーネント間のインタフェースで用いるエンコーディングを +表した図を示します。 +
Matched to this architecture, the patch distributes multilingual domain name processing to the respective components. The following diagram shows the function implemented in each component and the encoding used by the interface between the components. + +
++ ++
named における修正は次の一点のみです。 +
The following fixes were made in named: + +
BIND-9 の named ではドメイン名の処理はほとんど8ビットスルーになっており、 +UTF-8 等の MSB のセットされたバイトもそのまま透過します。 +しかし named 内で処理に使用されているドメイン名の内部表現 (dns_name_t) +からテキスト表現への変換部分は8ビットスルーになっておらず、ASCII 文字以外 +はバックスラッシュでクォートされ、\DDD という形式の表現に +変換されてしまいます。 +DNS プロトコル上で用いられるエンコーディングが RACE などの ASCII 互換 +エンコーディングであれば ASCII 以外の文字がドメイン名に現れることはないので +問題ないのですが、UTF-8 を使用する場合には問題となります。 +
With BIND-9 named, most domain name processing is based on 8-bit through and UTF-8 bytes in which MSB is set are also passed as is. However, the conversion of domain names from an internal expression (dns_name_t) to the text expression used for processing in named is not 8-bit through and other than ASCII text is quoted with a backslash and converted to a \DDD format expression. +If ASCII-compatible encoding such as RACE is used for the DNS protocol, there is no problem because only ASCII characters appear in domain names; there are, however, problems when UTF-8 is used. + +
BIND-9 パッチは、この処理を修正し、変換しようとする文字がUTF-8 文字の +場合にはバックスラッシュによるクォートをしないようにします。 +この動作は named の設定ファイル (named.conf) で切り替え可能であり、 +設定ファイルの options セクションの allow-utf8 パラメータで +指定します。DNS プロトコル上で用いるエンコーディングとして UTF-8 を +使用する際には次のように記述してください。 +
The BIND-9 patch corrects processing so that the backslash quote is not used when converting UTF-8 characters. +This operation can be switched using the allow-utf8 parameter of the options section in the named configuration file (named.conf). +When UTF-8 is used for encoding the DNS protocol, write as follows. +
+
+options {
+ ...
+ allow-utf8 yes;
+ ...
+};
+
+
+
+lwresd に対しては次のような修正を加えてあります。 +
The following fixes were made to lwresd. + +
これは named に対する修正と同じで、ドメイン名を内部表現から +テキスト表現に変換する際のバックスラッシュによるクォーティングを +行わないようにするものです。 +
This is the same fix made in named wherein backslash quoting is not used for conversion of domain names from an internal expression to a text expression. + +
named の場合、これは設定ファイル named.conf のオプションで +切り替えられるようになっていますが、lwresd の場合には自動切り替えに +なっています。lwresd が読み込む +クライアント設定ファイルの +サーバエンコーディングエントリに設定されているコードセット名を参照し、 +それが ASCII 互換エンコーディングでない場合にはバックスラッシュによる +クォートをしないようにします。 +
With named, this setting can be changed using the option setting in the named.conf configuration file; however, it is automatically changed with Iwresd. The code set name set in the server encoding entry of the client configuration file to be loaded by lwresd is referenced and if it is not ASCII-compatible encoding, the backslash quote is not used. + +
lwresd は多言語ドメイン名のエンコーディングとして、クライアント +つまり lightweight resolver ライブラリとの間の通信には UTF-8 を、 +また named との通信には DNS プロトコル上のエンコーディングをそれぞれ +使用します。したがって両者の間のエンコーディング変換を行います。 +
For encoding of multilingual domain names, lwresd uses UFT-8 for communication with the client, i.e. the lightweight resolver library, and also uses the encoding used for the DNS protocol for communication with named, respectively. Therefore, encoding conversion is performed between both components. + +
エンコーディング変換には MDN ライブラリの +res モジュール を使用しています。 +DNS プロトコル上のエンコーディングの指定は +クライアント設定ファイルで行います。 +
The res module of the MDN library is used for encoding conversion. +The client configuration file is used to specify the encoding used by the DNS protocol. + +
+ +
クライアント側のライブラリは、 +
The client side library was corrected as follows: +
The res module of the MDN library is used for this processing. +The client configuration file is used to set settings. + +
名前解決用の API 関数はローカルエンコーディングで表された +多言語ドメイン名が扱えるように修正されています。 +また内部実装は、将来 UTF-8 エンコーディングのドメイン名を扱える +API の追加が容易にできるように設計されています。これらについて +この後説明します。 +
The API function for name resolution was corrected to that it can handle multilingual domain names expressed in local encoding. +Also, internal implementation is designed so that it will be simpler to add APIs that can handle domain names in UTF-8 encoding in the future. An explanation of those issues will follow at a later date. + +
+ ++ +
+パッチによって多言語化される API 関数の一覧です。 +
+The list of API functions that are made multilingual by the patch is shown below. + +
+多言語化された API 関数は、従来の ASCII ドメイン名に加え、 +非 ASCII ドメイン名を扱うことができます。非 ASCII ドメイン名として、 +クライアント設定ファイルの内容に応じて、 +新たに以下のようなドメイン名を取り扱うことができるようになります。 +
+In addition to the conventional ASCII domain names, API functions that are made multilingual can handle non-ASCII domain names. With regard to non-ASCII domain names, the following domain names can be handled, depending on which settings are set in the client configuration file. + +
+引数の型や返り値の型に変更はありません。 +パッチを当てる前と同様の呼び出し方法で、従来の ASCII ドメイン名と、 +非 ASCII ドメイン名の両方を扱うことができます。 +非 ASCII ドメイン名については、 +ローカルエンコーディングのドメイン名を引数として受け取ることができます。 +
+The type of arguments and return values are not changed. +Using the same calling method that was used prior to applying the patch allows the system to handle both conventional ASCII domain names and non-ASCII domain names. +Regarding non-ASCII domain names, domain names of local encoding can be received as arguments. + +
+これまで上記の API 関数で行なわれていた処理は、 +以降で説明するそれぞれの内部関数に移行し、API +関数は、ドメイン名のエンコーディング情報をこの内部関数に渡す役割をしています。 +
+Processing performed by the above API functions are moved to respective internal functions explained later and API functions pass the encoding information of domain names to these internal functions. + +
+ +
+多言語化された API 関数に関連して、以下の内部関数が追加されました。 +
+In association with the API functions that were made multilingual, the following internal functions are added. + +
+追加された内部関数についての仕様は、以下の通りです。 +
+The specifications of the added internal functions are as follows. + +
+int +lwres_getaddrinfo_enc(const char *, const char *, const struct addrinfo *, + struct addrinfo **, int) ++
+lwres ライブラリの関数 lwres_getaddrinfo() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_getaddrinfo() との違いは、static 関数である set_order() +関数にエンコードタイプの判定フラグを渡している点のみです。 +
+With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_getaddrinfo() function. +The only difference between this function and the lwres_getaddrinfo() function is that the encode type judgment flag is passed to the set_order() function, which is a static function. +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_getaddrinfo() 関数から lwres_getaddrinfo_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. +LWRES_ENCODING_LOCAL is specified for the encode type judgment flag in order to call the lwres_getaddrinfo_enc() function from the lwres_getaddrinfo() function. +
+返される値は +EAI_NONAME、EAI_BADFLAGS、EAI_SYSTEM、 +EAI_FAMILY、EAI_SOCKTYPE、EAI_SERVICE、 +EAI_MEMORY、0 +のいずれかです。 +
+One of the following values is returned. +EAI_NONAME, EAI_BADFLAGS, EAI_SYSTEM, +EAI_FAMILY, EAI_SOCKTYPE, EAI_SERVICE, +EAI_MEMORY, 0 +
+ +
+int +lwres_getnameinfo_enc(const struct sockaddr *, size_t, char *, size_t, char *, + size_t, int, int) ++
+lwres ライブラリの関数 lwres_getnameinfo() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_getnameinfo() との違いは、lwres_getnamebyaddr() 関数の呼び出し部を +lwres_getnamebyaddr_enc() 関数に変更している点のみです。 +
+With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_getnameinfo() function. +The only difference between this function and the lwres_getnameinfo() function is that the call portion of the lwres_getnamebyaddr() function is changed to the lwres_getnamebyaddr_enc() function. +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_getnameinfo() 関数から lwres_getnameinfo_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. +LWRES_ENCODING_LOCAL is specified for the encode type judgment flag in order to call the lwres_getnameinfo_enc() function from the lwres_getnameinfo() function. +
+返される値は +ENI_NOSOCKET、ENI_SALEN、ENI_FAMILY、 +ENI_MEMORY、ENI_SYSTEM、ENI_NOHOSTNAME、 +SUCCESS +のいずれかです。 +
+One of the following values is returned. +ENI_NOSOCKET, ENI_SALEN, ENI_FAMILY, +ENI_MEMORY, ENI_SYSTEM, ENI_NOHOSTNAME, +SUCCESS +
+ +
+struct hostent * +lwres_gethostbyname_enc(const char *, int) ++
+lwres ライブラリの関数 lwres_gethostbyname() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_gethostbyname() との違いは、lwres_getipnodebyname() +関数の呼び出し部を lwres_getipnodebyname_enc() 関数に変更している点のみです。 +
+With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_gethostbyname() function. +The only difference between this function and the lwres_gethostbyname() function is that the call portion of the lwres_getipnodebyname() function is changed to the lwres_getipnodebyname_enc() function. +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_gethostbyname() 関数から lwres_gethostbyname_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. +LWRES_ENCODING_LOCAL is specified for the encode type judgment flag in order to call the lwres_gethostbyname_enc() function from the lwres_gethostbyname() function. +
+lwres_getipnodebyname_enc() から返って来た hostent +構造体へのポインタを返します。 +
+A pointer is returned that points to the hostent structure returned from lwres_getipnodebyname_enc(). +
+ +
+struct hostent * +lwres_gethostbyname2_enc(const char *, int, int) ++
+lwres ライブラリの関数 lwres_gethostbyname2() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_gethostbyname2() との違いは、lwres_getipnodebyname() +関数の呼び出し部を lwres_getipnodebyname_enc() 関数に変更している点のみです。 +
+With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_gethostbyname2() function.The only difference between this function and the lwres_gethostbyname2() function is that the call portion of the lwres_getipnodebyname() function is changed to the lwres_getipnodebyname_enc() function. +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_gethostbyname2() 関数から +lwres_gethostbyname2_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. +LWRES_ENCODING_LOCAL is specified for the encode type judgment flag in order to call the lwres_gethostbyname2_enc() function from the lwres_gethostbyname2() function. +
+lwres_getipnodebyname_enc() から返って来た hostent +構造体へのポインタを返します。 +
+A pointer is returned that points to the hostent structure returned from lwres_getipnodebyname_enc(). +
+ +
+struct hostent * +lwres_gethostbyname_r_enc(const char *, struct hostent *, char *, + int, int *, int) ++
+lwres ライブラリの関数 lwres_gethostbyname_r() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_gethostbyname_r() との違いは、lwres_getipnodebyname() +関数の呼び出し部を lwres_getipnodebyname_enc() 関数に変更している点のみです。 +
+With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_gethostbyname_r() function. +The only difference between this function and the lwres_gethostbyname_r() function is that the call portion of the lwres_getipnodebyname() function is changed to the lwres_getipnodebyname_enc() function. +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_gethostbyname_r() 関数から +lwres_gethostbyname_r_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. +LWRES_ENCODING_LOCAL is specifed for the encode type judgment flag in order to call the lwres_gethostbyname_r_enc() function from lwres_gethostbyname_r() function. +
+エラーのときは NULL、正常のときは値が格納された hostent +構造体へのポインタを返します。 +
+NULL is returned when there is an error and a pointer to the hostent structure that contains the value is returned when the result of processing is normal. +
+ +
+struct hostent * +lwres_gethostbyaddr_enc(const char *, int, int, int) ++
+lwres ライブラリの関数 lwres_gethostbyaddr() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_gethostbyaddr() との違いは、lwres_getipnodebyaddr() +関数の呼び出し部を lwres_getipnodebyaddr_enc() 関数に変更している点のみです。 +
+With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_gethostbyaddr() function. +The only difference between this function and the lwres_gethostbyaddr() function is that the call portion of the lwres_getipnodebyaddr() function is changed to the lwres_getipnodebyaddr_enc() function. +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_gethostbyaddr() 関数から lwres_gethostbyaddr_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+The last argument of the function is the encode type judgment flag. +LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. +LWRES_ENCODING_LOCAL is specifed for the encode type judgment flag in order to call the lwres_gethostbyaddr_enc() function from tge lwres_gethostbyaddr() function. +
+lwres_getipnodebyaddr_enc() から返って来た hostent +構造体へのポインタを返します。 +
+The pointer is returned that points to the hostent structure returned from lwres_getipnodebyaddr_enc(). +
+ +
+struct hostent * +lwres_gethostbyaddr_r_enc(const char *, int, int, struct hostent *, + char *, int, int *, int) ++
+lwres ライブラリの関数 lwres_gethostbyaddr_r() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_gethostbyaddr_r() との違いは、lwres_getipnodebyaddr() +関数の呼び出し部を lwres_getipnodebyaddr_enc() 関数に変更している点のみです。 +
+With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_gethostbyaddr_r() function. +The only difference between this function and the lwres_gethostbyaddr_r() funciton is that the call portion of the lwres_getipnodebyaddr() function is changed to the lwres_getipnodebyaddr_enc() function. +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_gethostbyaddr_r() 関数から +lwres_gethostbyaddr_r_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+The last argument of the function is the encode type judgment flag. +LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. +LWRES_ENCODING_LOCAL is specified to the encode type judgment flag in order to call the lwres_gethostbyaddr_r_enc() function from the lwres_gethostbyaddr_r() function. +
+エラーのときは NULL、正常のときは値が格納された hostent +構造体へのポインタを返します。 +
+NULL is returned when there is an error and pointer to hostent structure that contains the value is returned when the result of processing is normal. +
+ +
+struct hostent * +lwres_getipnodebyname_enc(const char *, int, int, int *, int) ++
+lwres ライブラリの関数 lwres_getipnodebyname() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_getipnodebyname() との違いは、lwres_getaddrsbyname() +関数の呼び出し部を lwres_getaddrsbyname_enc() 関数に変更している点のみです。 +
+With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_getipnodebyname() function. +The only difference between this function and the lwres_getipnodebyname() function is that the call portion of the lwres_getaddrsbyname() function is changed to the lwres_getaddrsbyname_enc() function. +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_getipnodebyname() 関数から +lwres_getipnodebyname_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+The last argument of the function is the encode type judgment flag. +LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. +LWRES_ENCODING_LOCAL is specified for the encode type judgment flag in order to call the lwres_getipnodebyname_enc() function from the lwres_getipnodebyname() function. +
+エラーのときは NULL、正常のときは値が格納された hostent +構造体へのポインタを返します。 +
+NULL is returned when there is an error and a pointer to the hostent structure that contains the value is returned when the result of processing is normal. +
+ +
+struct hostent * +lwres_getipnodebyaddr_enc(const void *, size_t, int, int *, int) ++
+lwres ライブラリの関数 lwres_getipnodebyaddr() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_getipnodebyaddr() との違いは、lwres_getnamebyaddr() +関数の呼び出し部を lwres_getnamebyaddr_enc() 関数に変更している点のみです。 +
+With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_getipnodebyaddr() function. +The only difference between this function and the lwres_getipnodebyaddr() function is that the call portion of the lwres_getnamebyaddr() function is changed to the lwres_getnamebyaddr_enc() function. +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_getipnodebyaddr() 関数から +lwres_getipnodebyaddr_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+The last argument of the function is the encode type judgment flag. +LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encodong. +LWRES_ENCODING_LOCAL is specified for the encode judgment flag in order to call the lwres_getipnodebyaddr_enc() function from the lwres_getipnodebyaddr() function. +
+エラーのときは NULL、正常のときは値が格納された hostent +構造体へのポインタを返します。 +
+NULL is returned when there is an error and a pointer to the hostent structure that contains the value is returned when the result of processing is normal. + +
BIND-9 には DNS の問い合わせツールとして dig、host、nslookup という +コマンドが付属します。mDNkit の BIND-9 パッチにより、これらはいずれも +多言語ドメイン名が扱えるようになります。具体的には以下の機能が +付加されます。 +
The DNS inquiry commands called dig, host, and nslookup are attached to BIND-9. Because of the BIND-9 patch in mDNkit, these commands can handle multilingual domain names. Specifically, the following functions are added. +
また DNS の返答に含まれる多言語ドメイン名をローカルエンコーディングに +変換し、表示します。 +
Also converts multilingual domain names included in the DNS response to local encoding and displays the result. +
+
+The res module of the MDN library is used for that processing. +The client configuration file is used to make the setting. + + + diff --git a/contrib/idn/mdnkit/doc/en/spec/clientconfig.html b/contrib/idn/mdnkit/doc/en/spec/clientconfig.html new file mode 100644 index 0000000000..08852eda51 --- /dev/null +++ b/contrib/idn/mdnkit/doc/en/spec/clientconfig.html @@ -0,0 +1,401 @@ + + + + +
++クライアント設定ファイルは、多言語ドメイン名のための各種の設定が +記述されているファイルで、mDNkit を使用して多言語化 (国際化) +したクライアント側のリゾルバが読み込むファイルです。 +このファイルは MDN ライブラリの +resconf モジュール によって読み込まれ、 +多言語ドメインに関する以下のような設定ができます。 +
+The client configuration file is the file in which various settings for multilingual domain names are described. This file is loaded by the resolver at the client side for which the mDNkit is used to make it multilingual (internationalized). The resconf module of the MDN library is used to load this file and the following settings related to multilingual domains can be made. + +
+このファイルは通常のテキストファイルで、ファイルの各行 (# +で始まるコメント行と、空行を除いて) は、 +次のような単純なフォーマットで構成されます。 +
+This file is a standard text file and each line of the file (except comment lines starting with # and blank lines) consists of following simple format. + +
+++キーワード 値... ++
++ ++Keyword Value... ++
+クライアント設定ファイルは、mDNkit をデフォルトの設定でコンパイルした +場合には以下に配置されます。 +
+The client configuration file is located as follows when the mDNkit is compilied using the default settings. + +
++ ++/usr/local/etc/mdnres.conf ++
以降、各キーワードごとに設定内容を記述します。 +
The setting content is discussed below for each keyword. +
+ +
+DNS プロトコル上の多言語ドメイン名のエンコーディングとして使用する +エンコーディング (コードセット名) を指定します。 +
+Specifies encoding (code set name) used as the encoding for multilingual domain name in the DNS protocol. + +
encoding には、使用するエンコーディング名を記述し、 +次のものが指定できます。 +
The encoding name to be used is described in encoding and the following types can be specified. + +
+このエントリは必須エントリであり、必ず記述しなければなりません。 +
+This entry is a prerequisite and must always be described. + +
+DNS プロトコル上で使用される多言語ドメイン名のエンコーディング +(server-encoding エントリで指定されたもの) +の中には、多言語ドメイン名と従来の ASCII ドメイン名とを区別するために +ZLD (zero-level domain) というドメインを必要とするものがあります。 +ZLD は通常のトップレベルドメインのさらに上位ドメインに相当します。 +ただしこれは DNS のシステム内部でのみ使われるドメインであり、 +一般ユーザやアプリケーションからは見えないようになっています。 +
+Of the encoding types (specified by server-encoding entry) for multilingual domain names used by the DNS protocol, some require a domain called ZLD (zero-level domain) in order to distinguish multilingual domain names from conventional ASCII domain names. +ZLD is equivalent to a higher level domain that is above the usual top level domain. Note, however, that this domain is only used inside the DNS system and ordinary users and application cannot see this domain. + +
mDNkit のデフォルトの設定では、ZLD は使用できないようになっており、 +設定ファイル中にこのエントリがあると警告メッセージが表示されます。 +このエントリの指定を有効にするには、mDNkit の configure 実行時に +--enable-zld オプションによって ZLD サポートを有効にしておく +必要があります。 +
ZLD cannot be used in the default settings of the mDNkit. When this entry exists in the configuration file, a warning message is displayed. +To make this entry specification effective, it is necessary to use the --enable-zld option to make ZLD support effective when executing configuration of the mDNkit. +
+ +
+正規化エントリでは、DNS サーバに送る前にドメイン名に適用すべき +正規化の方式を指定します。 +
+The normalization entry is used to specify the normalization scheme that should be applied to domain names before sending it to the DNS server. + +
+scheme には、正規化形式を記述します。 +以下のものが記述できます。 +
+The normalization form is described in scheme. +The following formats can be described. + + +
+正規化形式には複数の形式が指定可能です。複数の形式が指定された場合、 +順序通りに (左から右に) 適用されます。 +
+More than one formats can be specified for the normalization method. When more than one method is specified, they are applied in the order indicated (from left to right). +
+ +
+mDNkit で多言語化されたリゾルバライブラリは、 +アプリケーションが使用しているローカルコードセットを自動的に決定し、 +DNS の応答メッセージ中のドメイン名を、そのコードセットに変換しようとします。 +しかし、ドメイン名に使用されているある文字がローカルコードセットに +マップされていないために、変換に失敗することもあり得ます。 +例えば日本語コードセットを使用している日本語のアプリケーションが、 +日本語の文字セットに含まれていない中国語の文字を含んだ DNS +応答を受信したような時にこのようなことが起こります。 +
+Resolver library that was made multilingual by the mDNkit automatically determines the local code set used by the application, and tries to convert the domain name in the response message of DNS to that code set. +However, conversion may fail because some characters used for the domain name are not mapped in the local code set. +For example, this happens when a Japanese application using the Japanese code set receives a DNS response that includes Chinese characters that are not included in the Japanese character set. + +
+代替エンコーディングエントリは、上記のような問題が生じた時に +ローカルコードセットの代わりに使用するコードセットを指定します。 +
+The alternate encoding entry specifies a code set to be used instead of the local code set when the above type of problem occurs. + +
+encoding はコードセット名で、RACE のような +ASCII 互換エンコーディング +を使用しなければなりません。 +
+encoding is a code set name and ASCII-conpatible encoding such as RACE must be used. +
+ +
+エンコーディングエイリアスエントリでは、コードセット名のエイリアスを +記述したファイルのパス名を記述します。 +
+The encoding alias entry contains a description of the path to the file that describes the alias of the code set name. + +
+pathname には、エイリアスファイルへのパス名を指定します。 +このエイリアスファイルは通常のテキストファイルで、 +以下のような形式の行から構成されます。 +
+pathname specifies the path for the alias file. +This alias file is usually a text file and consists of lines in the following format. + +
++ ++alias-name name ++
+alias-name は定義されるエイリアス名で、name は +実際のコードセット名か、定義済のエイリアス名です。 +
+alias-name is the defined alias name and name is the actual code set name or previously defined alias name. +
+ +
+クライアント設定ファイルにはローカルコードセットを指定するエントリは +存在しません。 +ローカルコードセットはアプリケーションがそのときに使用している +ロケールの情報から決定されるからです。 +ですから、それぞれのアプリケーションがそれぞれ異なるローカルコードセットを +使用することができますし、同一アプリケーションが複数のローカルコードセットを +切り替えながら使用することも可能です。 +
+The client configuration file does not have an entry used to specify local code set. +This is because the local code set is determined based on the locale information used by the application at that time. +Therefore, each application can use a different local code set and also a single application can use more than one local code sets by switching between them. + +
+mDNkit はロケール情報からアプリケーションの使用しているローカルコードセットを +推測しようとしますが、時には失敗することもあります。 +例えば、C ロケールで動作しているにも関わらず +非 ASCII コードセットを使用しているアプリケーションではロケール情報から +ローカルコードセットを判定することは不可能ですし、mDNkit が知らない +ロケールで動作するアプリケーションの場合にも推測に失敗するでしょう。 +
+mDNkit tries to guess the local code set used by the application based on locale information but it sometimes fails to do so. +For example, though an application may run in the C locale, if the application uses a non-ASCII code set it is impossible to determine the local code set from the locale information. Also, mDNkit will fail when it attempts to guess the local code set an application uses if it does not understand the locale information. + +
+このような場合のために、環境変数 MDN_LOCAL_CODESET によって +アプリケーションのローカルコードセットを強制指定することができるように +なっています。 +この変数にコードセット名 (もしくはそのエイリアス名) +を指定すると、mDNkit はロケールの設定に関わらず、指定したコードセットを +ローカルコードセットとして動作します。 +
+In such cases, the MDN_LOCAL_CODESET environmental variable can be used to forcefully specify the local code set used by the application. +When the code set name (or its alias name) specifies this variable, mDNkit operates using the specified code set as the local code set regardless of the locale setting. + +
+ +
+以下に、コンフィギュレーションファイルの記述例を示します。 +
+Description examples of the configuration file are shown below. + +
++ + + diff --git a/contrib/idn/mdnkit/doc/en/spec/dnsproxy.html b/contrib/idn/mdnkit/doc/en/spec/dnsproxy.html new file mode 100644 index 0000000000..f8b5ba4485 --- /dev/null +++ b/contrib/idn/mdnkit/doc/en/spec/dnsproxy.html @@ -0,0 +1,497 @@ + + + + + ++# +# a sample configuration. +# + +# DNS プロトコル上のエンコーディングとして RACE を使用する +# Uses RACE as encoding for the DNS protocol +server-encoding RACE + +# 正規化の手順として、小文字に変換した後、KC 正規化法を使用する +# For the normalization procedure, converts to lowercase and then +# uses the KC normalization method +normalize unicode-lowercase unicode-form-kc + +# 代替エンコーディングとして RACE を使用する +# Uses RACE for alternate encoding +alternate-encoding RACE ++
+dnsproxyは、クライアントからのローカルコードベースの多言語ドメイン名を +含むDNS要求を受け取り、多言語化対応したDNSが受付けられるドメイン名に +変換し、また逆に、DNSからの応答の多言語ドメイン名を、 +クライアント側で認識できる形式に戻します。 +
+dnsproxy receives DNS requests including local code-based multilingual domain names from the client and converts them to domain names that can be accepted by the multilingual DNS. In reverse, it returns multilingual domain names included in responses from the DNS to a format that can be recognized by the client side. +
+これによって、クライアントは何も改造することなく +各種の多言語ドメイン名を使うことができるようになります。 +また、DNSサーバから見た場合には、クライアント+dnsproxyによって +多言語ドメイン名に対応したクライアントとして動作しているように +見えることになります。 +
Because of this, the client can use various multilingual domain names without modification. +From the DNS server's point of view, because of client + dnsproxy, the client operates as if it supports multilingual domain names. +
+ただし、dnsproxy が正しく動作するには、クライアントのリゾルバライブラリが +ローカルエンコーディングのドメイン名をそのまま透過させ、エラーにならない +ようになっている必要があります。残念ながら現在 UNIX のリゾルバライブラリの +多くは 8ビットスルーではないので、そのままでは dnsproxy を用いても +多言語ドメイン名を扱えるようにはなりません。この場合には +
+However, in order for dnsproxy to operate correctly, it is necessary for the resolver library of the client to transmit domain names in local encoding as is and does not cause an error. Regretably, many current UNIX resolver libraries are not 8-bit through and they cannot support multilingual domain names even when dnsproxy is used. In such cases, it is necessary to use the following methods. +
+++$ dnsproxy [オプション...] ++
+++$ dnsproxy [Option...] ++
+ +
+dnsproxyをデーモンとして起動します。 +
+dnsproxy is activated as a daemon. +
+ +
+コンフィギュレーションファイルを指示します。 +コマンドラインで指示しなかった場合には +デフォルトのコンフィギュレーションファイルが使用されます。 +詳しくはコンフィギュレーションの +項で説明します。 +
+Indicates the configuration file. When the command line does is not used to indicate a configuration file, the default configuration file is used. The details of this are explained in the Configuration section. +
+ +
+dnsproxyが実行ログを出力するファイル名を指定します。 +特に指定されなかった場合には、コンフィギュレーションファイルで +指示されたログファイル、あるいはデフォルトのログファイルに +出力されます。 +
+Specifies the file name for dnsproxy to output the execution log. Unless otherwise specified, the execution log is output to the log file specified by the configuration file or the default log file. + +
+ +
+設定情報はコンフィギュレーションファイルに記載されます。 +コンフィギュレーションファイルは、 +dnsproxyの起動時にコマンドラインで指示することができます。 +
+The configuration information is written in the configuration file. +The configuration file can be specified by the command line upon activation of dnsproxy. +
++コマンドラインで指示しなかった場合には +デフォルトのコンフィギュレーションファイルが使用されます。 +デフォルトのコンフィギュレーションファイルは、ディレクトリ ++% dnsproxy -config <config-file> ++
+ /usr/local/etc ++の下の +
+ dnsproxy.conf ++です。ディレクトリは、mDNkit作成時に +
+ configure --sysconfdir=DIR ++で指示することもできます。 +
When the configuration file is not specified by the command line, the default configuration file is used. +The default configuration file is located in +
+ dnsproxy.conf ++under +
+ /usr/local/etc ++ +The directory can be specified by +
+ configure --sysconfdir=DIR ++when mDNkit is created. +
+コンフィギュレーションファイルはテキストファイルで、 +以下のコンフィギュレーションデータを指定します。 +
+The configuration file is a text file and specifies the following configuration data. + +
+dnsproxyがクライアントからの要求を受付ける +ネットワークアドレス、ポート番号を指定します。 +
+Specifies the network address and port number used by dnsproxy to accept requests from the client. +
+ listen <address> ++<address>は以下のいずれかの形式で指示します。 +
<address> is specified using one of the following formats. +
++省略された場合には ++
++ <IP address>:<port number> + :<port number> + <IP address>
++が使用されます。 ++
++ IP address 0.0.0.0 # INADDR_ANY + port number 53
+ +
+dnsproxyが、DNS要求を転送し、応答を受け取る本来のDNSサーバの +ネットワークアドレス、ポート番号を指定します。 +
+dnsproxy specifies the original network address and port number of the DNS server that transfers DNS requests and accepts responses. +
+ forward <address> [ bind4compat ] ++<address>の形式は上のlistenのものと同じです。 +
+オプションの bind4compatが指示された場合には、 +UDPでリクエストを転送する時に、ソースアドレスとして、 +listenで指示されたアドレス/ポートを使用します。 +
When an option bind4compat is specified, the address/port specified by listen is used as the source address when a request is transferred via UDP. +
+ +
+dnsproxyが実行ログを出力するファイル名を指定します。 +
+Specifies the file name for dnsproxy to output the execution log. +
+ log-file <path> ++ログファイル名は、 +以下のコマンドラインオプションで指定することもできます。 +両方指定した場合にはコマンドラインオプションの指定のほうが優先されます。 +
The log file name can be specified by the following command line option. When both are specified, priority is given to the command line option specification. +
+ dnsproxy -logfile <address> ++指定されなかった場合には、 +
+ /tmp/dnsproxy.log ++に書き込まれます。 +
When the log file name is not specified, the execution log is output to +
+ /tmp/dnsproxy.log ++
+ +
+ログのレベルを設定します。 +
Sets the log level. +
+ log-level <level> ++レベルとして指定できる値は次の通りです。 +
The level values that can be specified are as follows. +
+++
+- none
- 一切ログを記録しません。 +
- none
- Logs are not recorded at all. +
- fatal
- 致命的なエラーのみ記録します。 +
- fatal
- Records only fatal errors. +
- warn
- 警告メッセージも記録します +
- warn
- Records warning messages as well. +
- trace
- 実行トレースメッセージも記録します。 +
- trace
- Records execution trace messages as well. +
指定しなかった場合のデフォルトは warn です。 +
When the value is not specified, the default is warn. +
none を指定した場合、ログファイルは作成されません。 +
When none is specified, no log file is created. +
trace レベルを指定すると大量のログが出力されるので、短時間で +ログファイルが巨大になる可能性があります。注意してください。 +
Use care that when the trace level is specified, large log files are output and it is possible that the log file can become very large in a short period of time. +
+ +
+クライアント側でのドメイン名のエンコーディングを指示します。 +
Indicates the encoding of the domain name at the client side. +
+ client-translation <ZLD> <Encoding> ++多言語ドメイン名に対応していないクライアントの場合には、 +通常、クライアントのローカルエンコーディングになっています。 +そのような場合には +
When the client does not support multilingual domain names, usually the local encoding used by the client is used. In such a case, use the following form +
+ client-translation . Shift_JIS ++という形で、<ZLD>無しで指示します。 +
and with no <ZLD>. +
+多言語ドメイン名の手法によっては、 +クライアント側で多言語ドメイン名を通常のDNSでも +受付けられる形式にエンコードして、それを通常のドメイン名と +区別するために ZLD (Zero Level Domain) を付加するものがあります。 +そのような場合には、付加されるZLDとその時のドメイン名の +エンコーディング方法とを対応付けることにより、 +他の多言語ドメイン名の手法のDNSサーバを利用することが +できるようになります。 +
+Depending on the multilingual domain name method used, the client side encodes multilingual domain names so that the usual DNS can accept them and adds ZLD (Zero Level Domain) in order to distinguish them from the usual domain names. +In such cases, by associating the added ZLD and encoding method of the domain name at that time, it becomes possible to use DNS servers that use another multilingual domain name method. +
+ client-translation .i-dns.net UTF-5 ++クライアント側のドメイン名のエンコーディングは、 +ZLD が異なっていれば、複数指定することができます。 +
More than one encoding method can be specified for domain names at the client side when the ZLD is different. +
+ただし、mDNkit のデフォルトの設定では ZLD の指定はできないように +なっています。ZLD を使用するためには、mDNkit のコンパイルの際、 +configure コマンドに +--enable-zld +を指定する必要があります。 +この指定をせずに mDNkit をコンパイルした場合には、ZLD の指定は +すべて無視されます。 +
+However, ZLD cannot be specified with the default setting of mDNkit. In order to use ZLD, it is necessary to specify --enable-zld in the configure command when compiling mDNkit. +If mDNkit is compiled without this specification, ZLDs are all ignored even though they may be specified. +
+クライアントから送られてきたDNS要求のドメイン名は、 +ここで指示したエンコーディングから、内部的に使用される +UTF-8エンコーディングに変換されます。 +そして、後述の正規化、サーバ側エンコーディングへの変換が +行なわれてDNSサーバに送出されます。また、DNSサーバからの +応答は、逆に元のエンコデーィングに戻されてクライアントに +返されます。 +
+The domain name of the DNS request sent from the client is converted from the specified encoding to the internally used UTF-8 encoding. +Then, normalization (explained below) and conversion to the server side encoding are performed and it is output to the DNS server. Also, the response from the DNS server is converted back to the orginal encoding and is returned to the client. +
+ここで指定可能なエンコーディング名は、mDNkit付属のlibmdnおよび +使用するiconv ライブラリに依存します。 +iconv ライブラリによって、エンコーディング名が異なっている +ことがありますので、ライブラリのマニュアルをご覧になって +使用可能なエンコーディング名を確認してください。 +付属のlibmdnでは、iconvが提供するエンコーディングの他に、 +多言語化DNS用に提案されている +
+Encoding names that can be specified here depend on libmdn attached to mDNkit and iconv library used. +Encoding names may differ depending on the iconv library. Refer to the manual of the library and check the encoding names that can be used. +With the attached libmdn, in addition to the coding provided by iconv, the following proposed multilingual DNS coding methods are supported. +
++をサポートしています。 ++
++ UTF-5 +draft-jseng-utf5-01.txt ++ RACE +draft-ietf-idn-race-02.txt ++ BRACE +draft-ietf-idn-brace-00.txt ++ LACE +draft-ietf-idn-lace-00.txt +
+
DNS サーバから返されたドメイン名がクライアントのローカルエンコーディングに +変換できない文字を含んでいた場合に、ローカルエンコーディングの代わりに使用する +エンコーディングを指定します。 +
When a domain name returned from the DNS server includes characters that cannot be converted to the local encoding used by the client, this specifies the encoding to be used instead of local encoding. +
+ alternate-encoding <Encoding> ++指定するエンコーディングは必ず「ASCII互換エンコーディング (ACE)」と呼ばれる、 +変換結果が従来のドメイン名として使用可能な文字 (英数字およびハイフン) だけ +からなるエンコーディングでなければなりません。たとえば ASCII 互換 +エンコーディングの一つである RACE を指定する場合には次のように指定します。 +
The specified encoding must be "ASCII-conpatible encoding (ACE)" so that the conversion result consists of only characters (alphanumeric characters and hyphens) that are used in conventional domain names. For example, to specify RACE (one type of ASCII-compatible encoding), specify as follows. +
+ alternate-encoding RACE ++
+
+ドメイン名の正規化手法を指定します。 +
+Specifies the normalization method used for domain names. +
+ normalize <scheme> ... ++正規化手法は複数指定可能で、左側から順に適用されていきます。 +
More than one normalization method can be specified and they are applied in order starting from the left side. +
+クライアントから送られてきたDNS要求のドメイン名は、 +内部的に使用されるUTF-8エンコーディングに変換された上で、 +ここで指示した正規化が適用されます。 +
+Domain names in the DNS request sent from the client are converted to internally used UTF-8 encoding and then the normalization specified here is applied. +
+次に示す正規化手法を指定することができます。 +
+The following normalization methods can be specified. +
+
それぞれの内容については +libmdnのマニュアルの +normalizer モジュール +を参照してください。 +
For details of each method, refer to normalizer module of the libmdn manual +
+ +
+DNSサーバ側のドメイン名エンコーディング方法を指示します。 +
+Indicates the encoding method used for domain names at the DNS server side. +
+ server-translation <ZLD> <Encoding> ++ZLDが不要なエンコーディングであれば、<ZLD> の部分には +'.' を指示します。 +
When the encoding method does not need a ZLD, specify '.' in <ZLD>. +
+ server-translation . UTF-8 ++ZLDを必要するエンコーディングでは、ZLDとエンコーディング名の +両方を指定します。 +
When the encoding method requires a ZLD, specify both the ZLD and encoding name. +
+ server-translation .i-dns.net UTF-5 ++ZLD の指定を有効にするには、mDNkit のコンパイル時の設定が必要です。 +client-translationの項を +ご覧ください。 +
To make the ZLD specification active, you must set a setting when compiling mDNkit. +Refer to the client-translation section for details. +
+指定可能なエンコーディングは、前出の +client-translation でのものと同じです。 +
+The encoding methods that can be specified are the same as those previously explained in +client-translation. +
+
dnsproxy が動作するユーザを指定します。 +
Specifies users for whom dnsproxy is operational. +
+ user-id <user> ++
通常、dnsproxy は特権ポートを使用するためルート権限で起動させる必要が +ありますが、ルート権限のままで動作させるのはセキュリティ上好ましくありません。 +この指定により、dnsproxy は特権ポートを作成したあとサービスを開始する前に +指定したユーザの権限で動くようになります。 +
Usually, since dnsproxy uses a special port, it can only be activated if the user has root authorization; however, operating under root authorization is not recommended for security reasons. +With this specification, after the special port is created, dnsproxy operates uner the specified user authorization before starting the service. +
<user> にはユーザ名あるいはユーザ ID 番号を指定することができます。
+
User name or user ID number can be specified in <user>.
+
+
dnsproxy が動作するグループを指定します。 +
Specifies the group wherein dnsproxy operates. +
+ group-id <user> ++これは user-id エントリと似ていますが、ユーザの代わりにグループを +指定する点が異なります。 +
This looks like the user-id entry but differs in that a group is specified instead of a user. +
<group> にはグループ名あるいはグループ ID 番号を指定することが +できます。 +
The group name or group ID number can be specied in <group>. +
+
dnsproxy が動作する際のルートディレクトリを指定します。 +
Specifies the root directry when dnsproxy operates. +
+ root-directory <path> ++
これもセキュリティ対策の一つです。dnsproxy が動作する際のルートディレクトリ +を指定することで、そのディレクトリの外にはアクセスできないようにします。 +この指定により、dnsproxy はサービスを開始する前に、chroot() +システムコールを用いて指定したディレクトリをルートディレクトリとして +設定します。 +
This is also a security measure. By specifying the root directory when dnsproxy operates, access other than by the specified directory is prevented. +Because of this specification, dnsproxy sets the specified directry using the chroot() system call as the root directory before dnsproxy starts the service. +
<path> にはルートとして設定したいディレクトリ名を指定します。 +
Directry name to be set as the root is specified in <path>. + +
+ +
dnsproxy に SIGHUP シグナルを送ると、ログファイルをいったん閉じ、 +再度オープンするという動作を行います。これは次のような手順で +ログをアーカイブできるようにするためです。 +
When a SIGHUP signal is sent to dnsproxy, the log file is closed and opened again. This is performed so that the log can be archived as described in the following procedure. +
mDNkit のドキュメントは以下のような3部構成となっています。 +
The mDNkit consists of three documents as described below. + +
+ +
+ +
+ +
+ +
mDNkit ユーザーズガイドおよび mDNkit 仕様書の内容は +mDNkit バージョン 1.2 に対応しています。 + +
mDNkit User's Guide and Specifications are for mDNkit version 1.2. + +
関連するドキュメントおよび関連ソフトウェアなどへのポインタをまとめた +参考文献のページもご覧ください。 + +
Also refer to the following page containing pointers pertaining to related documents and softwares. +Reference Documentation + + +
本キットに関するコメントは +idn-cmt@nic.ad.jp +に、またバグレポートは +mdnkit-bugs@nic.ad.jp +にそれぞれお送りください。 + +
Please send comments to: +idn-cmt@nic.ad.jp +and reports of bugs to: +mdnkit-bugs@nic.ad.jp + + + + diff --git a/contrib/idn/mdnkit/doc/en/spec/library.html b/contrib/idn/mdnkit/doc/en/spec/library.html new file mode 100644 index 0000000000..b990d54da5 --- /dev/null +++ b/contrib/idn/mdnkit/doc/en/spec/library.html @@ -0,0 +1,3135 @@ + + + + +
+MDN ライブラリ (libmdn) は多言語ドメイン名の変換に関わる各種の処理を
+実装するモジュールの集合です。このライブラリは以下のような機能を
+提供します。
+The MDN library (libmdn) is a group of modules that provide various processing with respect to multilingual domain name conversion. This library provides the following features.
+
+
文字列のエンコーディングを変換し、その結果を返します。
+MDN ライブラリの内部では、文字列はすべて UTF-8 エンコーディングであるとして
+取り扱われます。そこで、このモジュールは
+Converts character string encoding and returns the result.
+Inside the MDN library, character strings are all handled as UTF-8 encoding. This module supports the following conversions.
+
エンコーディングは大きく分けて、次の2種類があります。
+Encoding is roughly divided into the following two types.
+
このモジュールでは前者のエンコーディング変換のために
+iconv() ユーティリティを使用し、後者のエンコーディング変換のためには
+独自の変換関数を実装して使用しています。
+This module uses the iconv() utility for the first encoding conversion process and implements a unique conversion function for the latter encoding conversion.
+
+
+ +
与えられた文字列を正規化します。標準では次にあげる正規化をサポートします。
+Normalizes given character strings. The following standard normalization functions are supported.
+
DNS プロキシサーバ (dnsproxy) では、クライアントから送られてきた DNS
+メッセージに含まれるドメイン名に対してエンコーディング変換や正規化を行い、
+その結果を DNS サーバに送ります。このために以下の機能を提供します。
+In the DNS proxy server (dnsproxy), encoded domain names included in DNS messages sent from the client are converted and normalized and the result is sent to the DNS server. This process is comprised of the following functions:
+
多言語ドメイン名を識別するために ZLD を必要とする方式のために、ZLD に
+関する以下の機能を提供します。
+To identify multilingual domain names, the following ZLD-related functions are provided:
+
アプリケーションプログラムが使用しているローカルエンコーディング
+(コードセット) を自動判別します。判別は基本的にはアプリケーションのロケール
+情報を利用しますが、環境変数で指定することも可能になっています。
+Automatically identifies the local encoding (code set) used by the application program. Basically, the application locale information is used, though the local encoding (code set) can also be specified using an environmental variable.
+
+
+ +
アプリケーションにリンクされるリゾルバライブラリでエンコーディング
+変換や正規化を行う場合、使用するエンコーディングや正規化方式は
+設定ファイルに記述されます。このファイルを読み込む機能を提供します。
+When the resolver library linked by the application is used to perform conversion or normalization, the encoding and normalization method to be used is described in the configuration file. A function is provided to load this file.
+
+
MDN ライブラリは以下のモジュールから構成されます。
+The MDN library consists of the following modules.
+
+
以下にモジュールの呼び出し関係図を示します。ただしほとんどすべての
+モジュールから呼び出されている debug モジュールと log モジュール、また
+共用関数を納めた util モジュールは割愛してあります。
+The following diagram shows the invoking relationship of modules. debug and log modules called by most modules and util modules that store common functions are omitted in the diagram.
+
+
++ ++
MDN ライブラリに含まれるすべてのモジュールについて、その仕様を記述
+します。まず各モジュールで共通に使用される、関数のリターン値について
+説明したあと、モジュール毎に詳細を解説します。
+The specifications of all modules included in MDN library are explained below.
+First, return values of functions commonly used by the modules are explained and then each module is discussed in detail.
+
+
MDNライブラリのほとんど全てのAPI関数は、リターン値として
+列挙型であるmdn_result_t 型の値を返します。値の一覧とその意味を
+示します。
+Almost all API functions of the MDN library return values of mdn_result_t, which is an enumeration type value. The values and their meanings are explained below.
+
+
brace モジュールは、多言語ドメイン名のエンコーディング方式の一つとして提案されているBRACE エンコーディングとUTF-8との間の変換を行うモジュールです。このモジュールはconverter モジュールの下位モジュールとして実装されており、アプリケーションがこのモジュールを直接呼び出すことはありません。converter モジュールに対してBRACE エンコーディングとの変換を要求すると、このモジュールが間接的に呼び出されることになります。
+The brace module performs conversion between UTF-8 and the proposed BRACE encoding of multilingual domain names. This module is implemented as a low-order converter module, and is not directly called by the application.
+When converter module is requested in association with BRACE encoding conversion, this module is indirectly called.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn__brace_open(mdn_converter_t ctx, mdn_converter_dir_t dir) ++
BRACEエンコーディングとの変換をオープンします。実際には何もしません。
+Opens conversion context used for BRACE encoding. Actually, this does not do anything.
+
常に mdn_successを返します。
+Always returns mdn_success.
+
+ +
+mdn_result_t +mdn__brace_close(mdn_converter_t ctx, mdn_converter_dir_t dir) ++
BRACEエンコーディングとの変換をクローズします。実際には何もしません。
+Closes conversion context used for BRACE encoding. Actually, this does not do anything.
+
常に mdn_successを返します。
+
Always returns mdn_success.
+
+ +
+mdn_result_t +mdn__brace_convert(mdn_converter_t ctx, mdn_converter_dir_t dir, + const char *from, char *to, size_t tolen) ++
BRACEエンコードされた文字列とUTF-8エンコードされた文字列の相互変換を
+行います。入力文字列 from を変換し、結果を to と
+tolen で指定される領域に書き込みます。dir がmdn_converter_l2uならBRACEエンコーディングからUTF-8エンコーディングへ、mdn_converter_u2lならUTF-8エンコーディングからBRACEエンコーディングへの変換となります。
+Performs bidirectional conversion of BRACE and UTF-8 encoded character strings.
+The from input character string is converted and the result is written in the area specified by to and tolen.
+When dir is mdn_converter_l2u, BRACE strings are converted to UTF-8 encoding and when dir is mdn_converter_u2l, UTF-8 strings are converted to BRACE encoding.
+
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
mdn_invalid_encoding
+
mdn_nomemory
+
+
converter モジュールは、文字列のエンコーディング(コードセット)を
+変換します。MDN ライブラリは内部処理に UTF-8 エンコーディングの文字列を
+使用するため、このモジュールはローカルエンコーディングと UTF-8 との
+間の相互変換を行います。
+converter module converts character string encoding (code set). Because the MDN library uses UTF-8 character strings for internal processing, this module performs bidirectional conversion between the local encoding method and UTF-8.
+
+
現在サポートされているエンコーディングは次の通りです
+Support is currently provided for the following encoding methods.
+
また、converter モジュールはドメイン名のエンコーディング変換のために
+特別に設計されたもので、一般的なエンコーディング変換には必ずしも適しません。
+例えば UTF-5、RACE、BRACE、LACE エンコーディングはドメイン名の
+区切り文字であるピリオドを特別に扱います。
+The converter module is specially designed for encoding conversion of domain names and is not suitable for general encoding conversion.
+For example, UTF-5, RACE, BRACE, and LACE encoding provide special handling of the delimiting periods used in domain names.
+
+
converter モジュールは「コード変換コンテキスト」という概念を用います。
+あるエンコーディングと UTF-8 との相互変換を行うには、まず
+そのエンコーディングのコード変換コンテキストを作成します。実際の
+コード変換にはエンコーディングを直接指定するのではなく、この
+コード変換コンテキストを指定します。コード変換コンテキストの型は
+mdn_converter_t 型であり、次のような opaque 型として定義されています。
+The converter module employs the "code conversion context" concept.
+When perform bidirectional conversion between a specific encoding method and UTF-8, first the code conversion context of that encoding is created. For actual code conversion, the encoding is not directly specified; instead this code conversion context is specified. The code conversion context is mdn_converter_t and is defined as the following opaque type.
+
++ ++typedef struct mdn_converter *mdn_converter_t; ++
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn_converter_initialize(void) ++
モジュールの初期化処理を行います。本モジュールの他のAPI関数を呼ぶ前に
+ 必ず呼び出してください。
+Initializes the module. This function is always called before calling other API functions of this module.
+
返される値はmdn_success、mdn_nomemoryのいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn_converter_create(const char *name, mdn_converter_t *ctxp, + int delayedopen) ++
name で指定されるローカルエンコーディングと UTF-8 との間の
+コード変換コンテキストを作成、初期化し、ctxp の指す領域に
+格納します。
+Creates the code conversion context used for conversion between the local encoding specified by name and UTF-8, then initializes and stores it in the area specified by ctxp.
+
ローカルエンコーディングとして、現在のところ
+UTF-5、RACE、BRACE、LACE
+の変換機能が用意されています。これ以外のエンコーディングが指定された場合には、システムの提供するiconv() ユーティリティを用いて変換が行われます。
+この場合、この関数の呼び出し時にiconv_open() の呼び出しが行われますが、
+delayedopen が真ならば実際に文字列の変換が行われるまで
+iconv_open() の呼び出しが遅延されます。
+Currently provides UTF-5, RACE, BRACE, and LACE conversion functions.
+For encoding methods other than those listed above, conversion is performed using the iconv() utility provided with the system.
+In such a case, when this function is invoked iconv_open() is called. When delayedopen is true, calling of iconv_open() is delayed until the character string is actually converted.
+
またmdn_converter_register
+を用いて新たなローカルエンコーディングを追加することも可能です。
+In addition, mdn_converter_register can be also used to add new local encoding methods.
+
One of the following values is returned:
+
mdn_success
+
mdn_invalid_name
+
mdn_nomemory
+
mdn_failure
+
+ +
+void +mdn_converter_destroy(mdn_converter_t ctx) ++
mdn_converter_create で
+作成したコード変換コンテキストを削除し、確保したメモリを解放します。
+Deletes the code conversion context created by mdn_converter_create and releases the allocated memory.
+
+ +
+mdn_result_t +mdn_converter_convert(mdn_converter_t ctx, + mdn_converter_dir_t dir, const char *from, + char *to, size_t tolen) ++
mdn_converter_create で作成したコード変換コンテキストを用いて文字列 from をコード変換し、結果を to に格納します。tolen は to の長さです。
+dir は変換の方向の指定で、
+Uses the code conversion context created by mdn_converter_create to perform code conversion of character strings and stores the result in to.
+tolen is the length of to. dir is used to specify the direction of conversion.
+
ISO-2022-JPのように状態をもつエンコーディングを使用した場合、
+iconv() と異なり、この関数の呼び出し間で状態は保存されません。
+変換は毎回初期状態から始まります。
+Unlike iconv(), when status-dependent encoding such as ISO-2022-JP is used, the status that is in effect when the function is called the first time is not maintained when this function is called the next time.
+Conversion starts from the initial status each time.
+
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
mdn_invalid_encoding
+
mdn_invalid_name
+
mdn_nomemory
+
mdn_failure
+
+ +
+char * +mdn_converter_localencoding(mdn_converter_t ctx) ++
コード変換コンテキスト ctx のローカルエンコーディング名を
+返します。
+Returns the local encoding name of the code conversion context ctx.
+
+ +
+int +mdn_converter_isasciicompatible(mdn_converter_t ctx) ++
コード変換コンテキスト ctx のローカルエンコーディングが
+ASCII互換エンコーディングかどうかを返します。ASCII互換エンコーディングなら
+0でない値が、そうでないなら1が返ります。
+Returns whether or not the local encoding of the code conversion context ctxis ASCII-compatible. When the local encoding method is ASCII-compatible encoding, a value other than 0 is returned and if not, 1 is returned.
+
ASCII互換エンコーディング
+(ASCII-compatible Encoding) とは、そのエンコーディングでエンコードされたドメイン名が通常のASCIIのドメイン名と区別できない、つまり英数字およびハイフンのみで構成されるようなエンコーディングのことで、具体的には RACE などが相当します。これらのエンコーディングは一般にアプリケーションのローカルエンコーディングとして用いられることはありませんが、DNS プロトコル上でドメイン名を表すためのエンコーディングとしては(従来の DNS サーバ等がなんの変更もなしに使えることもあって) 有力視されているものです。
+ASCII-compatible encoding consists of only alphenumeric characters and hyphens, meaning it is not possible to differentiate between domain names encoded using this encoding and standard ASCII domain names. Specifically, RACE encoding is of this type.
+These types of encoding are not generally used for local encoding by applications but are strong candidates for the encoding used to express domain names in the DNS protocol (because conventional DNS servers can be used without modification).
+
+ +
+mdn_result_t +mdn_converter_addalias(const char *alias_name, const char *real_name) ++
エンコーディング名 real_name に対して、alias_name
+という別名を登録します。登録した別名はmdn_converter_create のname 引数に指定することができます。
+Used to register the alias alias_name for the encoding name real_name . Registered aliases can be specified in the var>name argument of mdn_converter_create.
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn_converter_aliasfile(const char *path) ++
ファイル path で指定されるファイルを読み込み、その内容に
+従って別名を登録します。
+Loads the file specified by the path variable and registers the alias in accordance with the contents of the file.
+
ファイル path は次のような単純な形式の行からなるテキストファイルです。
+The file path is a text file consisting of the following simple format.
+
+ 別名 正式名 + Alias Formal name + ++
また #で始まる行はコメントとみなされます。
+In addition, comment lines begin with #.
+
返される値は +mdn_success、 +mdn_nofile、 +mdn_invalid_syntax、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nofile
+
mdn_invalid_syntax
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn_converter_resetalias(void) ++
mdn_converter_addalias
+や mdn_converter_aliasfile
+で登録した別名をリセットし、別名が全く登録されていない初期状態に戻します。
+Resets aliases registered using mdn_converter_addalias or mdn_converter_aliasfile to the initial default status (where no aliases are registered).
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn_converter_register(const char *name, + mdn_converter_openproc_t open, + mdn_converter_closeproc_t close, + mdn_converter_convertproc_t convert, + int ascii_compatible) ++
name という名前のローカルエンコーディングと UTF-8との
+間のエンコーディング変換機能を追加します。open、close、
+convert は変換等の処理関数へのポインタです。
+ascii_compatible にはこのローカルエンコーディングが
+ASCII互換エンコーディングなら1を、そうでなければ0を指定します。
+Adds the encoding conversion function between the name local encoding method and UTF-8. open, close, and convert are used as pointers to processing functions such as conversion. 1 specifies ascii_compatible local encoding, 0 that local encoding is not ASCII compatible.
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success and
+
mdn_nomemory
+
+
debug モジュールはデバッグ用出力のためのユーティリティモジュールです。
+The debug module is a utility module for debug output.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+char * +mdn_debug_hexstring(const char *s, int maxbytes) ++
文字列 s を16進数表示した文字列を返します。
+maxbytes は表示する最大の長さで、sが これを超えた場合には
+最後に ...が追加されます。
+Returns a hexidecimal character string of s length. maxbytes indicates the maximum length expressed and when s exceeds that length, ... is appended to the string at that point.
+
+
返される文字列のメモリ領域は本関数の保持するスタティック変数のもので、その内容は本関数の次の呼び出し時まで有効です。
+The memory area allocated for the returned character string is used for the static variable held by this function and is in effect until the function is called the next time.
+
+ +
+char * +mdn_debug_xstring(const char *s, int maxbytes) ++
文字列 s の中で、コードが128以上のものを\x{HH}形式で
+表示した文字列を返します。
+maxbytes は表示する最大の長さで、s がこれを超えた場合には
+最後に ...が追加されます。
+Of the s character strings, returns in \x{HH} format those character strings 128 bytes or larger.
+maxbytes indicates the maximum length expressed and when s exceeds this, ... is appended to the string at that point.
+
返される文字列のメモリ領域は本関数の保持するスタティック変数の
+もので、その内容は本関数の次の呼び出し時まで有効です。
+The memory area allocated for the returned character string is used for the static variable held by this function and is in effect until the function is called the next time.
+
+ +
+char * +mdn_debug_hexdata(const char *s, int length, int maxlength) ++
長さ length のバイト列 s を16進表示した文字列を返します。maxbytes は表示する最大のバイト長で、length がこれを超えた場合には最後に ...が追加されます。
+Returns the length of byte row s in hexadecimal character strings. maxbytes indicates the maximum length expressed and when length exceeds this, ... is appended to the string at that point.
+
返される文字列のメモリ領域は本関数の保持するスタティック変数のもので、その内容は本関数の次の呼び出し時まで有効です。
+The memory area allocated for the returned character string is used for the static variable held by this function and is in effect until the function is called the next time.
+
+ +
+void +mdn_debug_hexdump(const char *s, int length) ++
長さ length のバイト列 s の16進ダンプを標準エラー出力に表示します。
+The standard error output is comprised of a hexidecimal dump of length of byte row s.
+
+
dn モジュールは、DNS メッセージ内のドメイン名の展開・圧縮を行うモジュール
+です。これはリゾルバライブラリのres_comp およびres_expand に
+相当する機能を提供します。
+The dn module expands or compresses domain names in DNS messages. This provides the functional equivalent of res_comp and res_expand in the resolver library.
+
+
このモジュールは本ライブラリの他のモジュールからのみ利用されることを想定して
+設計されています。
+This module was designed under the assumption that it would only used by only other modules in the libary.
+
+
ドメイン名の圧縮の際は、次に示すmdn__dn_t 型のコンテキスト情報を
+使用します。
+When a domain name is compressed, context information of type mdn__dn_t is used, as shown below:
+
+
+#define MDN_DN_NPTRS 64
+typedef struct {
+ const unsigned char *msg;
+ int cur;
+ int offset[MDN_DN_NPTRS];
+} mdn__dn_t;
+
+
+
+以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn__dn_expand(const char *msg, size_t msglen, + const char *compressed, char *expanded, + size_t buflen, size_t *complenp) ++
長さ msglen のDNSメッセージ msg 中の
+圧縮されたドメイン名 compressed を展開し、
+expanded に結果を格納します。
+buflen は expanded の大きさです。
+また、compressed の長さが *complenp に格納されます。
+Expands the compressed domain name in DNS message msg of length msglen and stores the result in expanded.
+buflen is the size of expanded.
+Also, the length of compressed is stored in *complenp.
+
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_message +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
mdn_invalid_message
+
+ +
+void +mdn__dn_initcompress(mdn__dn_t *ctx, const char *msg) ++
ドメイン名圧縮用のコンテキスト情報 ctx を初期化します。
+この関数はmdn__dn_compress を呼び出す前に必ず呼び出す必要があります。
+msg は圧縮したドメイン名を格納するDNSメッセージの
+先頭アドレスです。
+Initializes context information ctx for domain name compression.
+This function must be called before calling mdn__dn_compress.
+msg is the leading address in a DNS message where the compressed domain name is stored.
+
+ +
+mdn_result_t +mdn__dn_compress(const char *name, char *sptr, size_t length, + mdn__dn_t *ctx, size_t *complenp) ++
name の指すドメイン名を圧縮して sptr の指す
+場所に格納します。length は sptr の空き領域の長さです。
+圧縮の際は、ctx に入っている以前に圧縮したドメイン名の情報が
+参照されます。圧縮したドメイン名の長さが complenp に入れられるとともに、圧縮に必要な情報が ctx に追加されます。
+Compresses the domain name indicated by name and stores it in the location indicated by sptr. length is the length of available space sptr.
+When compression is performed, the previously compressed domain name information in ctx is referenced. The length of the compressed domain name is placed in complenp and also the information necessary for compression is added to ctx.
+
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_name +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
mdn_invalid_name
+
+
lace モジュールは、多言語ドメイン名のエンコーディング方式の一つとして
+提案されている
+
+LACE エンコーディング
+とUTF-8との間の変換を行うモジュールです。このモジュールは
+converter モジュールの
+下位モジュールとして実装されており、
+アプリケーションがこのモジュールを直接呼び出すことはありません。
+converter モジュールに対して
+LACE エンコーディング
+との変換を要求すると、このモジュールが間接的に呼び出されることになります。
+The lace module performs conversion between UTF-8 and the proposed LACE multilingual domain name encoding method. This module is implemented as a low-order converter module, and is not directly called by the application.
+When the converter module is requested for conversion with LACE encoding, this module is indirectly called.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn__lace_open(mdn_converter_t ctx, mdn_converter_dir_t dir) ++
LACEエンコーディングとの変換をオープンします。実際には何もしません。
+Opens conversion context with LACE encoding. Actually, this does not do anything.
+
+
常に mdn_successを返します。
+Always returns mdn_success.
+
+ +
+mdn_result_t +mdn__lace_close(mdn_converter_t ctx, mdn_converter_dir_t dir) ++
LACEエンコーディングとの変換をクローズします。実際には何もしません。
+Closes conversion context with LACE encoding. Actually, this does not do anything.
+
常に mdn_successを返します。
+Always returns mdn_success.
+
+ +
+mdn_result_t +mdn__lace_convert(mdn_converter_t ctx, mdn_converter_dir_t dir, + const char *from, char *to, size_t tolen) ++
LACEエンコードされた文字列とUTF-8エンコードされた文字列の相互変換を
+行います。
+入力文字列 from を変換し、結果を to と
+tolen で指定される領域に書き込みます。
+dir がmdn_converter_l2uなら
+LACEエンコーディングからUTF-8エンコーディングへ、mdn_converter_u2l
+ならUTF-8エンコーディングからLACEエンコーディングへの変換となります。
+Provides bidirectional conversion between LACE character strings and UTF-8 character strings.
+The from input character string is converted and the result is written in the area specified by to and tolen.
+When dir is mdn_converter_l2u, LACE encoding is converted to UTF-8 encoding. When it is mdn_converter_u2l, UTF-8 encoding is converted to LACE encoding.
+
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
mdn_invalid_encoding
+
mdn_nomemory
+
+
localencoding モジュールはロケール情報を利用して、
+アプリケーションの使用しているエンコーディングを推測するモジュールです。
+The localencoding module uses locale information to guess the encoding used by the application.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+const char * +mdn_localencoding_name(void) ++
現在のロケール情報を元に、アプリケーションの使用しているエンコーディング名
+(mdn_converter_create() に渡す
+名前) を推測して返します。
+Guesses the type of encoding used by the application (the name passed to mdn_converter_create())and returns it based on the current locale information.
+
推測は、システムがnl_langinfo() を備えていればそれを利用し、
+そうでなければsetlocale() や環境変数の情報から行われます。
+後者の場合には必ずしも正しいエンコーディング名が得られるとは限りません。
+To guess the type of encoding, nl_langinfo() is used if it is available in the the system and if not, setlocale() or environmental variable information is used.
+In the latter case, the corrent encoding name may not be obtained.
+
ロケール情報から正しい推測ができない場合、もしくはアプリケーションが
+ロケールと異なるエンコーディングを用いて動作している場合のために、
+もし環境変数 MDN_LOCAL_CODESET が定義されていれば、
+をアプリケーションのロケールに関わらず、その変数の値をエンコーディング名として
+返すようになっています。
+When MDN_LOCAL_CODESET environmental variable is defined in order to deal with situations in which the correct encoding cannot be guessed from the locale information or the application is operating using different encoding than that the locale, this module returns the value of that variable as the encoding name regardless of the application locale.
+
+
log モジュールはMDN ライブラリのログの出力処理を制御するモジュールです。
+ログはデフォルトでは標準エラー出力に書き出されますが、ハンドラを登録する
+ことで、別の出力方法に変更することも可能です。
+log module controls MDN library log output.
+A standard error output log is written by default. It can, however, be changed to another output method by registering the handler.
+
またログレベルを設定することも可能です。ログレベルは次の5段階が
+定義されています。
+The log level can be set as well. The following five log levels are defined.
+
+
+enum {
+ mdn_log_level_fatal = 0,
+ mdn_log_level_error = 1,
+ mdn_log_level_warning = 2,
+ mdn_log_level_info = 3,
+ mdn_log_level_trace = 4,
+ mdn_log_level_dump = 5
+};
+
+
+
+以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+void +mdn_log_fatal(const char *fmt, ...) ++
fatal レベルのログを出力します。このレベルは、プログラムの実行が
+不可能であるような致命的なエラーの際に用いられます。
+引数はprintf と同じ形式で指定します。
+Outputs a fatal level log. This level is used when a fatal error occurs that causes problems such as when program execution cannot be performed.
+Arguments are specified using the same format as printf.
+
+ +
+void +mdn_log_error(const char *fmt, ...) ++
error レベルのログを出力します。このレベルは、
+致命的ではないエラーの際に用いられます。
+引数はprintf と同じ形式で指定します。
+Outputs the error level log. This level is used when an error occurs that is not fatal.
+Arguments are specified using the same format as printf.
+
+ +
+void +mdn_log_warning(const char *fmt, ...) ++
warning レベルのログを出力します。このレベルは警告メッセージを
+表示するために用いられます。
+引数はprintf と同じ形式で指定します。
+Outputs a warning level log. This level is used to display a warning message.
+Arguments are specified using the same format as printf.
+
+ +
+void +mdn_log_info(const char *fmt, ...) ++
info レベルのログを出力します。このレベルはエラーではなく、
+有用と思われる情報を出力するのに用いられます。
+引数はprintf と同じ形式で指定します。
+Outputs info level log. This level is not used for errors but instead to output other potentially useful information.
+Arguments are specified using the same format as printf.
+
+
+ +
+void +mdn_log_trace(const char *fmt, ...) ++
trace レベルのログを出力します。このレベルはAPI関数のトレース
+情報を出力するのに用いられます。一般にライブラリのデバッグ目的以外で
+このレベルのログを記録する必要はないでしょう。
+引数はprintf と同じ形式で指定します。
+Outputs the trace level log. This level is used to output API function trace information. Generally, this log does not need to be recorded for purposes other than debugging the library.
+The arguments are specified using the same format as printf.
+
+ +
+void +mdn_log_dump(const char *fmt, ...) ++
dump レベルのログを出力します。このレベルはさらにデバッグ用の
+パケットデータダンプなどを出力するのに用いられます。
+一般にライブラリのデバッグ目的以外でこのレベルのログを記録する
+必要はないでしょう。
+引数は printf と同じ形式で指定します。
+Outputs the dump level log. This level is used to output additional packet data dump for debugging.
+Generally, this level of log does not need to be recorded for purposes other than debugging the library.
+The arguments are specified using the same format as for printf.
+
+ +
+void +mdn_log_setlevel(int level) ++
ログ出力のレベルを設定します。設定したレベルを超えるレベルの
+ログは出力されません。この関数でログレベルを設定しない場合、
+環境変数 MDN_LOG_LEVEL に設定された整数値が使用されます。
+Sets the level of log output. Logs higher than the set level are not output. When the log level is not specified with this function, the integer value set to the MDN_LOG_LEVEL environmental variable is used.
+
+ +
+int +mdn_log_getlevel(void) ++
現在のログ出力のレベルを表す整数値を取得して返します。
+Obtains and returns the integer value for the current level of log output.
+
+ +
+void +mdn_log_setproc(mdn_log_proc_t proc) ++
ログの出力ハンドラを設定します。proc はハンドラ関数への
+ポインタです。もしハンドラを指定しない場合、あるいは proc に
+NULL を指定した場合には、ログは標準エラー出力に出力されます。
+Used to set the log output handler. proc is a pointer to the handler function. When the handler is not specified or NULL is specified for proc, a standard error log is output.
+
ハンドラの型 mdn_log_proc_t は次のように定義されています。
+The mdn_log_proc_t handler type is defined as follows.
+
++level にはログのレベルが、また msg には表示すべき +メッセージ文字列が渡されます。+typedef void (*mdn_log_proc_t)(int level, const char *msg); ++
msgheader モジュールはDNS メッセージのヘッダの解析、および組み立てを
+行うモジュールです。
+msgheader module analyses and assembles the DNS message header.
+
解析されたヘッダ情報は、次に示す構造体に入ります。各フィールドは
+DNS メッセージヘッダのフィールドにそのまま対応しているので、説明は省略します。
+Analyzed header information is placed in the following structure. Since each field corresponds to a field of DNS message header, the explanation is omitted here.
+
+
+typedef struct mdn_msgheader {
+ unsigned int id;
+ int qr;
+ int opcode;
+ int flags;
+ int rcode;
+ unsigned int qdcount;
+ unsigned int ancount;
+ unsigned int nscount;
+ unsigned int arcount;
+} mdn_msgheader_t;
+
+
+
+以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn_msgheader_parse(const char *msg, size_t msglen, + mdn_msgheader_t *parsed) ++
msg と msglen で示されるDNSメッセージのヘッダを
+解析し、parsed が示す構造体に格納します。
+Analyses the DNS message headers indicated by msg and msglen and stores the information in the structure indicated by parsed.
+
返される値は +mdn_success、 +mdn_invalid_message +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_invalid_message
+
+ +
+mdn_result_t +mdn_msgheader_unparse(mdn_msgheader_t *parsed, + char *msg, size_t msglen) ++
この関数はmdn_msgheader_parse の
+逆の処理を行います。つまり、parsed で指定された構造体のデータから
+DNSメッセージのヘッダを構成し、msg と msglen で
+示される領域に格納します。
+This function performs reverse processing of mdn_msgheader_parse, in which the DNS message header is structured from the structure data specified by parsed, after which it is stored in the area specified by msg and msglen.
+
+
返される値は +mdn_success、 +mdn_buffer_overflow +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
+ +
+unsigned int +mdn_msgheader_getid(const char *msg) ++
msg で指定されるDNSメッセージから ID を取り出して返します。
+この関数はヘッダ全体を解析せずにIDだけ取り出したいときに便利です。
+この関数は、msg の指すデータがDNSメッセージのヘッダ長以上ある
+ことを仮定していますので、必ず呼び出し側で確認してから呼び出すように
+してください。
+Extracts the ID from the DNS message specified by msg and returns it.
+This function is only useful for extracting the ID without analyzing the entire header.
+Since this function assumes the data indicated by msg is longer than the DNS message header length, always call the function after confirmation at the calling side.
+
+ +
+void +mdn_msgheader_setid(char *msg, unsigned int id) ++
msg で指定されるDNSメッセージに id で指定される
+ID を設定します。
+この関数も msg の指すデータがDNSメッセージのヘッダ長以上ある
+ことを仮定していますので、必ず呼び出し側で確認してから呼び出すように
+してください。
+Sets the ID specified by id in the DNS message specified by msg.
+Since this function also assumes that the data indicated by msg is longer than the DNS message header length, always call the function after confirmation at the calling side.
+
+
msgtrans モジュールはDNS プロキシサーバでの DNS メッセージの変換処理の
+大部分を提供するモジュールです。このモジュールは
+converter モジュールや
+normalizer モジュールなど他の多くのモジュールを
+の上位モジュールとして実現されています。
+The msgtrans module provides a large portion of DNS message conversion processing performed by the DNS proxy server. This module is implemented as a high-order module for many other modules including the converter module and normalizer module.
+
+
DNSプロキシサーバにおけるメッセージ変換処理はおよそ次のようなものです。
+Message conversion processing by the DNS proxy server is briefly explained below.
+
まずクライアントからDNSサーバへのメッセージの変換の場合は次の
+ようになります。
+Conversion of a message from a client to the DNS server is as follows.
+
次にDNSサーバからクライアントへのメッセージの変換の場合は次の
+ようになります。
+Conversion of messages from the DNS server to the client is as follows.
+
このように、DNSメッセージの変換に際しては、
+クライアント・サーバ側のZLD、エンコーディング等
+いろいろなパラメータが必要となります。API関数にこれらを指定する際、
+それぞれを別々の引数で指定するのは煩雑なので、次のような構造体を
+用いてまとめて渡すようにしてあります。
+As explained above, various parameters with respect to ZLD at the client/server side and encoding are necessary for DNS message conversion. When specifying those parameters for API functions, it is troublesome to specify them using different arguments for various functions. To avoid this, the following structure can be used to pass the parameters collectively.
+
+
+typedef struct mdn_msgtrans_param {
+ int use_local_rule;
+ mdn_ZLDrule_t local_rule;
+ mdn_converter_t local_converter;
+ mdn_converter_t local_alt_converter;
+ char *local_ZLD;
+ mdn_converter_t target_converter;
+ mdn_converter_t target_alt_converter;
+ char *target_ZLD;
+ mdn_normalizer_t normalizer;
+} mdn_msgtrans_param_t;
+
+
+use_local_ruleは、入力側のメッセージのZLDおよびエンコーディングの
+判定方法を指定します。
+use_local_rule specifies the ZLD and encoding determination method fr the message at the input side.
+
もし値が真ならば、これらはlocal_ruleで
+指定されるZLDとエンコーディングの集合とメッセージに含まれるドメイン名の
+マッチング処理を行い、マッチしたものが使われます。
+これはクライアントからDNSサーバへのリクエストメッセージの変換の際に
+用いられます。
+この場合、判定結果がlocal_converterとlocal_ZLDに
+代入されます。
+When the value is true, matching processing is performed on the ZLD and encoding as specified by local_rule and the domain names included in the message, and the matches are used when converting the request message from the client to the DNS server; in this case, the judgement results are assigned to local_converter and local_ZLD.
+
一方、local_ruleが偽ならばZLDおよびエンコーディングは
+local_converterとlocal_ZLDで指定されるものがそのまま
+使用されます。
+これはDNSサーバからクライアントへのリクエストメッセージの変換の際に
+用いられます。
+この場合local_ruleの値は使用されません。use_local_rule の値に関わらず、local_alt_converter は入力側メッセージの代替エンコーディングとして使用されます。代替エンコーディングがない場合には NULL を指定します。
+On the other hand, if local_rule is false, the ZLD and encoding specified by local_converter and local_ZLD are used as is when converting the request message sent from DNS server to the client; in this case, the value of local_rule is not used.
+Regardless of the value of use_local_rule, local_alt_converter defines the alternate encoding method used to encode the message at the input side.
+When there is no alternate encoding, NULL is specified.
+
target_converter and target_ZLD are used to specify the output side encoding and ZLD.
+target_converterとtarget_ZLDで出力側の
+エンコーディングとZLDを指定します。
+target_alt_converterは、target_converterによる
+出力側のエンコーディングへの変換が、変換しようとするドメイン名に
+出力側の文字集合にない文字が含まれていたために失敗した場合に、
+target_converterの代わりに使用されます。
+なお local_alt_converter と target_alt_converter
+に対応するエンコーディングはいずれも
+ASCII 互換エンコーディングでなければなりません。
+target_alt_converter is alternately used with target_converter when the conversion by target_converter to the output side encoding fails because the domain name to be converted includes characters that do not exist in the output side character set. Note that the encoding corresponding to local_alt_converter and target_alt_converter must be ASCII-compatible encoding, respectively.
+
normalizerは正規化方式を指定します。
+normalizer specifies normalization method.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn_msgtrans_translate(mdn_msgtrans_param_t *param, + const char *msg, size_t msglen, + char *outbuf, size_t outbufsize, + size_t *outmsglenp) ++
msg および msglen で指定されるDNSメッセージを
+変換パラメータ param にしたがって変換し、結果を
+outbuf および outbufsize で示される領域に格納します。
+outmsglenp には変換結果のメッセージ長が格納されます。
+Converts the DNS messages specified by msg and msglen according to the conversion parameter param and stores the result in the area indicated by outbuf and outbufsize. The message length of the conversion result is stored in outmsglenp.
+
返される値は +mdn_success、 +mdn_invalid_message、 +mdn_invalid_encoding、 +mdn_buffer_overflow +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_invalid_message
+
mdn_invalid_encoding
+
mdn_buffer_overflow
+
+
normalizer モジュールは文字列の正規化を行うモジュールです。
+正規化の方式としては現在次のものが用意されています。
+また別の新たな正規化方式を追加登録するためのAPIも用意されています。
+normalizer module normalizes character string.
+The following normalization methods are currently provided.
+In addition, API used to additionally register new normalization method is provided.
+
最後のja-delimiter-hackは句点および全角ピリオドを
+ドメイン名のセパレータであるピリオドと見なすようにするもので、
+これは本来多言語ドメイン名のユーザ入力の際の手間および間違いを軽減するために
+用意されたものですが、ブラウザによってはピリオドのないドメイン名が
+ドメイン名ではなくキーワードと認識されてしまうなどの問題があり、
+またこれはドメイン名の正規化の範囲を逸脱しているとも考えられるので、
+できるだけこの正規化方式の使用は避けるべきです。
+The last ja-delimiter-hack is to assume Japanese period and double-byte period as the period that is the separator of domain name. This is originally provided to reduce steps or mistakes when user enters multilingual domain names. However, depending on browser, there are problems that domain names without period are recognized as keyword not domain name and also this method is supposed to exceed the scope of normalization of domain names, therefore, use of this normalization method should be avoided as much as possible.
+
+
正規化方式は複数併用することも可能で、この場合指定した順に適用されます。
+More than one normalization methods can be used and they are applied in the order they were specified.
+
normalizer モジュールは「正規化コンテキスト」という概念を用います。
+正規化を行うに先立ってまず正規化コンテキストを作成し、使用する正規化方式をコンテキストに登録しておきます。実際の正規化処理の際には正規化方式ではなく、この正規化コンテキストを指定します。正規化コンテキストの型はmdn_normalizer_t 型であり、次のような opaque 型として定義されています。
+normalizer module uses the concept "normalization context". Prior to normalization, a normalization context is created and the normalization method to be used is registered in the context. For actual normalization procesesing, not the normalization method but this normalization context is specified. The type of normalization context is mdn_normalizer_t type and defined as the following opaque type.
+
++ ++typedef struct mdn_normalizer *mdn_normalizer_t; ++
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn_normalizer_initialize(void) ++
モジュールの初期化処理を行います。本モジュールの他のAPI関数を呼ぶ前に
+ 必ず呼び出してください。
+Initializes module. Make sure to call this function before calling other API function of this module.
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn_normalizer_create(mdn_normalizer_t *ctxp) ++
正規化用の空のコンテキストを作成し、ctxp の指す領域に格納します。
+返されるコンテキストは空で、正規化方式は一つも含まれていません。
+正規化方式を追加するには
+mdn_normalizer_add を用います。
+Creates an empty content for normalization and stores it in the area specified by ctxp.
+The returned content is empty and does not contain any normalization methods.
+To add normalization method, mdn_normalizer_add is used.
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+ +
+void +mdn_normalizer_destroy(mdn_normalizer_t ctx) ++
mdn_normalizer_create で
+作成した正規化コンテキストを削除し、アロケートされたメモリを解放します。
+Deletes the normalization context created by mdn_normalizer_create and releases the allocated memory.
+
+ +
+mdn_result_t +mdn_normalizer_add(mdn_normalizer_t ctx, const char *scheme_name) ++
mdn_normalizer_create で
+作成した正規化コンテキストに、scheme_name で指定される
+正規化方式を追加します。一つのコンテキストに複数の正規化方式を
+追加することができます。
+Adds the normalization method specified by scheme_name in the normalization context created by mdn_normalizer_create. More than one normalization methods can be specified in one context.
+
返される値は +mdn_success、 +mdn_invalid_name、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_invalid_name
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn_normalizer_normalize(mdn_normalizer_t ctx, + const char *from, char *to, size_t tolen) ++
UTF-8 でエンコードされた文字列 from に ctx で
+指定される正規化方式を適用し、その結果を to と tolen で
+指定される領域に書き込みます。
+ctx に複数の正規化方式が含まれている場合、それらが
+mdn_normalizer_add で追加した順番に
+適用されます。
+Applies the normalization method specified by ctx to the character strings encoded by UTF-8 from and writes the result in the area specified by to and tolen.
+When more than one normalization method is included in ctx, they are applied in the order they were added by mdn_normalizer_add.
+
返される値は +mdn_success、 +mdn_invalid_encoding、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_invalid_encoding
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn_normalizer_register(const char *scheme_name, + mdn_normalizer_proc_t proc) ++
新しい正規化方式を scheme_name という名前で登録します。
+proc はその正規化方式の処理関数へのポインタです。
+New normalization methods are registered in scheme_name.proc is a pointer to the processing function of that normalization method.
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+
race モジュールは、多言語ドメイン名のエンコーディング方式の一つとして
+提案されている
+RACE エンコーディング
+とUTF-8との間の変換を行うモジュールです。このモジュールは
+converter モジュールの下位モジュールとして実装されており、
+アプリケーションがこのモジュールを直接呼び出すことはありません。
+converter モジュールに対して RACE エンコーディング
+との変換を要求すると、このモジュールが間接的に呼び出されることになります。
+The race module performs conversion between UTF-8 and the proposed RACE multilingual domain name method. This module is implemented as a low-order module of converter module and is not directly called by the application. When converter module is requested for conversion with RACE encoding, this module is indirectly called.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn__race_open(mdn_converter_t ctx, mdn_converter_dir_t dir) ++
RACEエンコーディングとの変換をオープンします。実際には何もしません。
+Opens conversion context with RACE encoding. Actually, this does not do anything.
+
常に mdn_successを返します。
+Always returns mdn_success.
+
+ +
+mdn_result_t +mdn__race_close(mdn_converter_t ctx, mdn_converter_dir_t dir) ++
RACEエンコーディングとの変換をクローズします。実際には何もしません。
+Closes conversion context with RACE encoding. Actually, this does not do anything.
+
常に mdn_successを返します。
+Always returns mdn_success.
+
+ +
+mdn_result_t +mdn__race_convert(mdn_converter_t ctx, mdn_converter_dir_t dir, + const char *from, char *to, size_t tolen) ++
RACEエンコードされた文字列とUTF-8エンコードされた文字列の相互変換を
+行います。
+入力文字列 from を変換し、結果を to と
+tolen で指定される領域に書き込みます。
+dir がmdn_converter_l2uなら
+RACEエンコーディングからUTF-8エンコーディングへ、mdn_converter_u2l
+ならUTF-8エンコーディングからRACEエンコーディングへの変換となります。
+Performs bidirectional conversion between RACE-encoded and UTF-8 encoded character strings. Converts the from input character string and writes the result in the area specified by to and tolen.
+When dir is mdn_converter_l2u, RACE encoding is converted to UTF-8 encoding. When it is mdn_converter_u2l, UTF-8 encoding is converted to RACE encoding.
+
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
mdn_invalid_encoding
+
mdn_nomemory
+
+
res モジュールはクライアント側 (リゾルバライブラリやアプリケーション)
+で多言語ドメイン名の処理、つまりドメイン名のエンコーディング変換や
+正規化を行う際の高レベル API を提供します。
+このモジュールはあとで説明する resconf モジュール
+とともに用いることを前提に設計されています。
+The res module provides high level APIs used when multilingual domain names are processed at the client side (by the resolver library or an application) i.e. when domain name encoding conversion or normalization is performed. This module is designed on the assumption that it will be used together with resconf module, which is explained below.
+
+
これらのモジュールの提供する API を使用すれば、
+converter モジュールや
+normalizer モジュールなどの関数を直接
+呼び出す必要はありません。
+Using APIs provided by the module, it is not necessary to directly call converter module or normalizer module function.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn_res_localtoucs(mdn_resconf_t conf, const char *local_name, + char *ucs_name, size_t ucs_name_len) ++
アプリケーションの使用するローカルエンコーディングで表された
+ドメイン名文字列 local_name を UTF-8 に変換し、その結果を
+ucs_name に格納します。ucs_name_len で
+あらかじめ ucs_name に確保した領域の大きさを指定します。
+Converts local_name domain name character strings expressed in the local encoding used by the application to UTF-8 and stores the result in ucs_name. ucs_name_len is used to specify the size of the area secured for ucs_name beforehand.
+
+
conf は resconf モジュール の返す
+クライアント設定コンテキストです。もし conf が NULL であれば
+変換は行われず、local_name の内容がそのまま ucs_name
+にコピーされます。
+conf is the client configuration context returned by resconf module. When conf is NULL, conversion is not performed and the contents of local_name is copied to ucs_name as is.
+
+
ドメイン名 local_name が従来の ASCII ドメイン名として
+正しく (つまり英数字およびハイフンとピリオドから構成される)、かつ
+クライアント設定コンテキスト conf に代替エンコーディング
+が設定されている場合、ローカルエンコーディングとしての変換を行う前に
+代替エンコーディングから UTF-8 の変換を試み、失敗した場合に
+ローカルエンコーディングから UTF-8 への変換を行います。これによって、
+mdn_res_ucstolocal が
+与えられたドメイン名をローカルエンコーディングに変換できず
+代替エンコーディングに変換した場合でも、それを本関数に与えれば
+正しい UTF-8 エンコーディングのドメイン名が得られます。
+Conversion from local encoding to UTF-8 is performed when the local_name domain name is a valid conventional ASCII domain name (that is, it consists of alphanumeric characters, hyphens and periods), alternate encoding is set in the client configuraiton context conf, and conversion to UTF-8 from the alternate encoding is attempted and failed before conversion of the local encoding is performed. Because of this, even if mdn_res_ucstolocal could not convert the given domain name to the local encoding and converted to the alternate encoding, if it is given to this function, the correct UTF-8 encoded domain name can be obtained.
+
+
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_name、 +mdn_failure +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
mdn_invalid_name
+
mdn_failure
+
+
+ +
+mdn_result_t +mdn_res_ucstolocal(mdn_resconf_t conf, const char *ucs_name, + char *local_name, size_t local_name_len) ++
mdn_res_localtoucs の
+逆の変換、つまり UTF-8 で表されたドメイン名文字列 ucs_name
+をアプリケーションの使用するローカルエンコーディングに変換し、その結果を
+local_name に格納します。local_name_len で
+あらかじめ local_name に確保した領域の大きさを指定します。
+Performs reverse conversion of mdn_res_localtoucs, i.e., converts the ucs_name domain name character string expressed in UTF-8 to the local encoding used by the application and stores the result in local_name. local_name_len is used to specify the size of the area secured for local_name beforehand.
+
+
conf は resconf モジュール の返す
+クライアント設定コンテキストです。もし conf が NULL であれば
+変換は行われず、local_name の内容がそのまま ucs_name
+にコピーされます。
+conf is the client configuration context returned by resconf module. When conf is NULL, conversion is not performed and the contents of local_name is copied in ucs_name as is.
+
+
もしドメイン名 ucs_name の中にローカルエンコーディングの
+文字集合にない文字があって変換に失敗した場合、クライアント設定コンテキスト
+conf に代替エンコーディングが設定されていれば、
+ローカルエンコーディングの代わりに代替エンコーディングへの変換が行われます。
+これにより、たとえ DNS サーバからローカルエンコーディングに含まれない文字を
+含むドメイン名が返された場合にもエラーとならずに変換が行われます。
+なお、代替エンコーディングに変換された文字列は
+mdn_res_localtoucs によって
+UTF-8 文字列に戻すことが可能です。
+When conversion fails because a character that is not in the character set of the local encoding is contained in the ucs_name domain name, if the alternate encoding is set in the client configuration context conf, conversion to the alternate encoding is performed instead of to the local encoding.
+Because of this, even if the DNS server returns a domain name that includes a character that is not included in the local encoding, conversion is performed without error. Note that character strings converted to the alternate encoding can be returned to UTF-8 character strings by mdn_res_localtoucs.
+
+
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_name、 +mdn_failure +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
mdn_invalid_name
+
mdn_failure
+
+
+ +
+mdn_result_t +mdn_res_normalize(mdn_resconf_t conf, const char *name, + char *normalized_name, size_t normalized_name_len) ++
クライアント設定コンテキスト conf にしたがって
+UTF-8 で表されたドメイン名 name に対して正規化を実行し、
+その結果を normalized_name に格納します。
+normalized_name_len であらかじめ normalized_name に
+確保した領域の大きさを指定します。
+Executes normalization on the name domain name expressed in UTF-8 according to the client configuration context conf and stores the result in normalized_name.
+normalized_name_len is used to specify the size of the area secured for normalized_name beforehand.
+
+
もし conf が NULL であれば正規化は行われず、
+name の内容がそのまま normalized_name にコピーされます。
+When conf is NULL, normalization is not performed and the contents of name is copied in normalized_name as is.
+
+
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
mdn_invalid_encoding
+
mdn_nomemory
+
+
+ +
+mdn_result_t +mdn_res_ucstodns(mdn_resconf_t conf, const char *ucs_name, char *dns_name, + size_t dns_name_len) ++
クライアント設定コンテキスト conf にしたがって
+UTF-8 で表されたドメイン名 ucs_name を DNS プロトコル上で
+用いられるエンコーディングに変換し、その結果を dns_name に
+格納します。
+dns_name_len であらかじめ dns_name_len に
+確保した領域の大きさを指定します。
+Converts the ucs_name domain name expressed in UTF-8 to the encoding used in the DNS protocol per the conf client configuration context and stores the result in dns_name. dns_name_len is used to specify the size of the area secured for dns_name_len beforehand.
+
+
もし conf が NULL であれば変換は行われず、
+ucs_name の内容がそのまま dns_name にコピーされます。
+When conf is NULL, conversion is not performed and the contents of ucs_name are copied to dns_name as is.
+
+
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_invalid_name、 +mdn_failure +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
mdn_invalid_encoding
+
mdn_invalid_name
+
mdn_failure
+
+
+ +
+mdn_result_t +mdn_res_dnstoucs(mdn_resconf_t conf, const char *dns_name, char *ucs_name, + size_t ucs_name_len) ++
mdn_res_ucstodns の逆変換、
+つまりクライアント設定コンテキスト conf にしたがって
+DNS プロトコル上のエンコーディングで表されたドメイン名 dns_name
+を UTF-8 に変換し、その結果を ucs_name に格納します。
+ucs_name_len であらかじめ ucs_name_len に
+確保した領域の大きさを指定します。
+Performs reverse conversion of mdn_res_ucstodns, i.e., converts the dns_name domain name expressed in the encoding used in the DNS protocol to UTF-8 per the conf client configuration context and stores the result in ucs_name. ucs_name_len is used to specify the size of the area secured for ucs_name_len beforehand.
+
+
もし conf が NULL であれば変換は行われず、
+dns_name の内容がそのまま ucs_name にコピーされます。
+When conf is NULL, conversion is not peformed and the contents of dns_name are copied to ucs_name as is.
+
+
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_invalid_name、 +mdn_failure +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
mdn_invalid_encoding
+
mdn_invalid_name
+
mdn_failure
+
+
resconf モジュールはクライアント側 (リゾルバライブラリやアプリケーション)
+で多言語ドメイン名の処理を行う際に参照される
+クライアント設定ファイルを読み込み、
+ファイルに記述された設定にしたがった初期化を実行します。また
+設定情報を取り出す機能を提供します。
+The resconf module loads the client configuration file referenced when a multilingual domain name is processed at the client side (by a resolver library or application) and executes initialization in accordance with the settings described in the file. It also provides a function to extract the setting information.
+
+
resconf モジュールは「クライアント設定コンテキスト」という概念を用います。
+クライアント設定ファイルに記述された設定はこのクライアント設定コンテキストに
+格納され、このコンテキストを引数にして API 関数を呼び出すことによって
+設定された値を取り出すことができます。
+クライアント設定コンテキストの型は mdn_resconf_t 型であり、
+次のような opaque 型として定義されています。
+The resconf module uses the "client configuration context" concept.
+Settings described in the client configuration file are stored in this client configuration context, which is used as an argument to call API functions to extract the set values. The client configuration context is defined by mdn_resconf_t and is of the following opaque type.
+
++ + + ++typedef struct mdn_resconf *mdn_resconf_t; ++
このモジュールは単体でも使用できますが、
+res モジュールと組み合わせることによって、
+クライアント側での多言語ドメイン名の処理を簡単に行うことができるように
+設計されています。
+This module can be used as a single module but it is designed so that by combining it with res module multilingual domain names can easily be processed at the client side.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn_resconf_initialize(void) ++
多言語ドメイン名の処理を行う際に必要な初期化を実行します。
+本モジュールの他のAPI関数を呼ぶ前に必ず呼び出してください。
+本モジュールが使用する他のモジュールの初期化もすべて行うので、これ以外の初期化
+関数を呼び出す必要はありません。
+Executes initialization required when processing multilingual domain names. Always call this function before calling other API functions of this module. Since this function initializes all other modules used by this module, it is not necessary to call another initialization function.
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn_resconf_create(mdn_resconf_t *ctxp) ++
クライアント設定コンテキストを作成、初期化し、ctxp の指す
+領域に格納します。
+初期状態では、まだクライアント設定ファイルの内容は読み込まれていません。
+読み込むためには
+mdn_resconf_loadfile を実行する必要があります。
+Creates and initializes client configuration context and stores it in the area indicated by ctxp. In the initial status, the contents of the client configuration file are not loaded. To do so, mdn_resconf_loadfile must be executed.
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+ +
+void +mdn_resconf_destroy(mdn_resconf_t ctx) ++
mdn_resconf_create で
+作成されたクライアント設定コンテキストを削除し、確保したメモリを解放します。
Deletes the client configuration context created by mdn_resconf_create and releases the allocated memory.
+
+ +
+mdn_result_t +mdn_resconf_loadfile(mdn_resconf_t ctx, const char *file) ++
file で指定される
+クライアント設定ファイルの内容を読み込み、
+設定内容をクライアント設定コンテキスト ctx に格納します。
+file が NULL の場合にはデフォルトのクライアント設定ファイルの
+内容を読み込みます。
+Loads the contents of the client configuration file specified by file and stores the setting contents in the ctx client configuration context.
+When file is NULL, the contents of the default client configuration file are loaded.
+
すでに設定ファイルが読み込まれているコンテキストに対して、
+別の設定ファイルの内容を読み込むこともできます。その場合には、
+クライアント設定コンテキストに格納されていた前の設定ファイルの内容は
+すべて消え、新たに読み込んだ設定ファイルの内容で置き換わります。
+If the configuration file has already been loaded and another configuration file is loaded, the previous configuration file contents stored in the client configuration context are erased and replaced with the newly loaded configuration file contents.
+
返される値は +mdn_success、 +mdn_nofile、 +mdn_invalid_syntax、 +mdn_invalid_name、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nofile
+
mdn_invalid_syntax
+
mdn_invalid_name
+
mdn_nomemory
+
+ +
+char * +mdn_resconf_defaultfile(void) ++
デフォルトのクライアント設定ファイルのパス名を返します。
+これは mDNkit のコンパイル時の設定によって決まりますが、特に指定しなければ
+Returns the path to the default client configuration file. This is determined by the settings set when mDNkit is compiled. The default path is as follows:
+
++です。 ++/usr/local/etc/mdnres.conf ++
+ +
+mdn_converter_t +mdn_resconf_localconverter(mdn_resconf_t ctx) ++
クライアント設定コンテキスト ctx の情報を元に、
+ローカルエンコーディングと UTF-8 との間の文字コード変換を行うための
+コード変換コンテキストを返します。ローカルエンコーディングが判別できなかった
+場合には NULL を返します。
+Based on the ctx client configuration context information, returns the code conversion context to perform character code conversion between the local encoding and UTF-8. NULL is returned if the local encoding cannot be determined.
+
コード変換コンテキストについては
+converter モジュール の項をご覧ください。
+For details of code conversion context, refer to the converter module section.
+
+ +
+mdn_converter_t +mdn_resconf_alternateconverter(mdn_resconf_t ctx) ++
クライアント設定コンテキスト ctx の情報を元に、
+代替エンコーディングと UTF-8 との間の
+文字コード変換を行うためのコード変換コンテキストを返します。
+代替エンコーディングとはドメイン名をローカルエンコーディングに変換することが
+できなかった場合に、ローカルエンコーディングの代わりに用いられる
+エンコーディングのことです。
+クライアント設定ファイルがまだ読み込まれていなかったり、設定ファイルに
+エンコーディングの指定がなかった場合には NULL を返します。
+Based on the ctx client configuration context information, returns the code conversion context to perform character code conversion between the alternate encoding and UTF-8. The alternate encoding is used instead of the local encoding when a domain name could not be converted to the local encoding. NULL is returned if the client configuration file has not been loaded or the encoding method is not specified in the configuration file.
+
コード変換コンテキストについては
+converter モジュール の項をご覧ください。
+For code conversion context, refer to converter module section.
+
+ +
+mdn_converter_t +mdn_resconf_serverconverter(mdn_resconf_t ctx) ++
クライアント設定コンテキスト ctx の情報を元に、
+DNS プロトコル上で用いられるエンコーディングと UTF-8 との間の
+文字コード変換を行うためのコード変換コンテキストを返します。
+クライアント設定ファイルがまだ読み込まれていなかったり、設定ファイルに
+エンコーディングの指定がなかった場合には NULL を返します。
+Based on the information of client configuration context ctx, returns the code conversion context to perform character code conversion between the encoding used on DNS protocol and UTF-8. NULL is returned if the client configuration file has not been loaded or the encoding method is not specified in the configuration file.
+
+
コード変換コンテキストについては
+converter モジュール の項をご覧ください。
+For code conversion context, refer to converter module section.
+
+ +
+const char * +mdn_resconf_ZLD(mdn_resconf_t ctx) ++
クライアント設定コンテキスト ctx の情報を元に、
+多言語ドメイン名と従来のドメイン名とを区別するために一部の
+エンコーディングとともに用いられる ZLD の文字列を返します。
+ZLD を使用しない設定の場合には NULL を返します。
+Based on the information in the ctx client configuration context, returns the ZLD character string used together with some encoding methods to differentiate between multilingual domain names and conventional domain names. NULL is returned when ZLD is not used.
+
mDNkit はデフォルトの設定では ZLD をサポートせず、この関数は常に
+NULL を返します。mDNkit を ZLD をサポートするように設定する方法に
+ついては mDNkit のインストールガイドの
+configure 実行
+の項をご覧ください。
+By default, mDNkit does not support ZLD and this function always returns NULL. For details of how to set mKNkit to support ZLD, refer to configure execute in the mDNkit Installation Guide.
+
+ +
+mdn_normalizer_t +mdn_resconf_normalizer(mdn_resconf_t ctx) ++
クライアント設定コンテキスト ctx の情報を元に、
+ドメイン名を正規化するための正規化コンテキストを返します。
+クライアント設定ファイルがまだ読み込まれていなかったり、設定ファイルに
+正規化方式の指定がなかった場合には NULL を返します。
+Based on the information of client configuration context ctx, returns the normalization context used to normalize domain names.
+NULL is returned if the client configuration file has not been loaded or the normalization method is not specified in the configuration file.
+
正規化コンテキストについては
+normalizer モジュール の項をご覧ください。
+For details of normalization context, refer to the normalizer module section.
+
+
result モジュールはライブラリの各関数が返す
+mdn_result_t型の値を扱うモジュールで、
+値からそのコードに対応するメッセージへの変換を提供します。
+The result module handles the mdn_result_t type value returned by each function in the library and converts the value to the corresponding message code.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+char * +mdn_result_tostring(mdn_result_t result) ++
mdn_result_t型の値 result に対応する
+メッセージ文字列を返します。
+Returns the message character string corresponding to the value result of mdn_result_t type.
+
未定義のコードに対しては unknown result code という文字列が
+返されます。
+An unknown result code character string is returned for undefined code.
+
+
selectiveencode モジュールはゾーンマスタファイル等のテキストの中から
+非ASCII文字を含むドメイン名を探し出すモジュールです。
+もちろんテキストのどの部分がドメイン名なのかを判定することは一般的には
+不可能なので、実際には次のような大きな仮定を置くことによって
+近似的に実現しています。
+The selectiveencode module finds domain names that include non-ASCII characters in text such as zone master files. Generally speaking it is of course impossible to determine which part of the text is the domain name; in actuality, however, the following rough assumptions are used to approximately implement it.
+
具体的には次のようなアルゴリズムを用いてドメイン名の領域検出を行います。
+Specifically, the following algorithm is used to detect the domain name area.
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn_selectiveencode_findregion(const char *s, + char **startp, char **endp) ++
UTF-8でエンコードされた文字列 s を走査して、最初に出現する
+非ASCII文字を含むドメイン名の領域を求め、その先頭を指すポインタを
+startp に、領域の直後の文字を指すポインタを endp に
+それぞれ格納します。
+Scans s UTF-8 encoded character strings and finds the area in the domain that includes the first appearance of a non-ASCII character, then stores a pointer indicating the beginning of the area at startp and a pointer indicating the end of the area in endp.
+
返される値は +mdn_success、 +mdn_notfound +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_notfound
+
+
strhash モジュールは文字列をキーとするハッシュ表を実現するモジュールです。
+ハッシュ表は
+converter モジュールや
+normalizer モジュールなどライブラリの他のモジュールで
+使用されます。
+非常に一般的なハッシュ表の実装であり、特筆すべき点はありません…
+一つだけあります。登録はできますが削除の機能がありません。本ライブラリでは
+必要ないからです。
+The strhash module implements a hash table that uses a character string as a key. The hash table is used by other modules in the library such as the converter module and normalizer module. This is a very general hash table implementation in which registration can be performed but there is no deletion function because it is not needed with this library.
+
+
ハッシュ表のサイズは要素の総数が増えるに従って大きくなります。
+The size of the hash table increases as the total numer of elements increases.
+
+
ハッシュ表は次に示す mdn_strhash_t 型の opaque データとして
+表されます。
+As shown below, the hash table is expressed in opaque data of mdn_strhash_t type.
+
++ ++typedef struct mdn_strhash *mdn_strhash_t; ++
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn_strhash_create(mdn_strhash_t *hashp) ++
空のハッシュ表を作成し、そのハンドルを hashp の指す領域に
+格納します。
+Creates an empty hash table and stores the handle to the area indicated by hashp.
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+ +
+void +mdn_strhash_destroy(mdn_strhash_t hash) ++
mdn_strhash_create で作成した
+ハッシュ表を削除し、確保したメモリを解放します。
+Deletes the hash table created by mdn_strhash_create and releases the allocated memory.
+
+ +
+mdn_result_t +mdn_strhash_put(mdn_strhash_t hash, const char *key, + void *value) ++
mdn_strhash_create で作成した
+ハッシュ表 hash にキー key、値 value の組を
+登録します。
+文字列 key はコピーされますので、この関数の呼び出し後
+key の指すメモリを解放しても、文字列の内容を書き換えても
+影響はありません。これに対して value の内容はコピーされないので
+注意してください (もちろんよく考えてみればコピーされないことは自明ですが)。
+Used to register a key and value set in the hash table created by mdn_strhash_create.
+Since character strings are copied, there is no influence even if the memory indicated by key is released or the contents of the character strings are changed after this function is called. Contrarily, the contents of value are not copied, so use care when working with this item. (If you think carefully about it, it will become obvious that this value is not copied.)
+
同じキーを使用して複数回登録した場合、最後に登録されたものだけが
+有効です。
+When the same key is used for registration more than once, only the most recently registered key is effective.
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn_strhash_get(mdn_strhash_t hash, + const char *key, void **valuep) ++
ハッシュ表 hash からキー key を持つ要素を検索し、
+対応する要素があればその値を valuep に格納します。
+Searches for elements that have key in the hash table; if a corresponding element is found, the value is stored in valuep.
+
返される値は +mdn_success、 +mdn_noentry +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_noentry
+
+ +
+int +mdn_strhash_exists(mdn_strhash_t hash, const char *key) ++
ハッシュ表 hash にキー key を持つ要素があれば
+1を、なければ 0 を返します。
+Returns 1 if there is an element that has the key in the hash table, and returns 0 if no element is found.
+
+
translator モジュールは、与えられたパラメータに従ってドメイン名を
+変換するモジュールです。パラメータとしては次にあげるデータを与えます。
+The translator module converts domain names in accordance with the given parameters. Values can provided for the following parameters.
+
ドメイン名の変換の手続きはやや複雑です。これは次の理由によります。
+The domain name conversion procedure is complicated, for the following reasons:
+
具体的には、次のようなアルゴリズムを使用して変換を行います。
+Specifically, the following algorithm is used for conversion.
+
以上の処理をフローチャートで表したのが次の図です。
+The following flow chart explains the above procedure.
+
+
++ ++
本モジュールはエンコーディング変換に
+converter モジュールを、また正規化に
+normalizer モジュールをそれぞれ使用します。
+This module uses the converter module for encoding and the normalizer module for normalization.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn_translator_translate(mdn_converter_t local_converter, + mdn_converter_t local_alternate_converter, + const char *local_ZLD, + mdn_normalizer_t normalizer, + mdn_converter_t target_converter, + mdn_converter_t target_alternate_converter, + const char *target_ZLD, + const char *from, char *to, size_t tolen) ++
与えられたパラメータにしたがってドメイン名 from を変換し、
+結果を to と tolen で指定される領域に格納します。
+Converts the domain name produced by from per the specified parameters and stores the result in the area specified by to and tolen.
+
ローカルエンコーディング、ローカル代替エンコーディング、
+ターゲットエンコーディングおよびターゲット代替エンコーディングは
+エンコーディングの名称ではなく、
+対応するconverter モジュールの
+コード変換コンテキスト local_converter、
+alternate_converter および target_converter で
+指定します。
+Local encoding, local alternate encoding, target encoding and target alternate encoding are not the actual names of types of encoding and are specified by the corresponding code conversion context, which is defined by the following converter module variables: local_converter,alternate_converter and target_converter.
+
ターゲット代替エンコーディング target_alternate_converter は、
+target_converter によるターゲットエンコーディングへの変換が、
+ドメイン名がターゲットエンコーディングの文字集合にない文字を含んでいるために
+失敗した時に、ターゲットエンコーディングの代わりに使用されます。
+The target_alternate_converter variable is used instead of the target encoding if conversion to the target encoding by target_converter fails because the domain name contains a character that is not included in the target character set.
+
正規化はnormalizer モジュールの正規化コンテキスト
+normalizer で指定します。
+Normalization is specified by normalization context defined by the normalizer variable of the normalizer module.
+
ローカルZLDおよびターゲットZLDは
+mdn_translator_canonicalZLD
+で標準形式に変換したものでなければなりません。
+The local ZLD and target ZLD must have been converted to the standard format by mdn_translator_canonicalZLD.
+
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_buffer_overflow
+
mdn_invalid_encoding
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn_translator_canonicalZLD(const char *ZLD, + char **canonicalizedp) ++
ZLD ZLD を標準形式に変換し、そのポインタを
+canonicalizedp の指す領域に格納します。
+変換された文字列 (*canonicalizedp) の領域は
+malloc() されていますので、不要になったら free() で
+解放してください。
+Converts ZLD ZLD to the standard format and stores a pointer in the area specified by canonicalizedp. Since the area for the converted character string (*canonicalizedp) is secured by malloc(), release it when it is no longer needed.
+
ここでいう ZLD の標準形式とは次のような形式のものを指します。
+The standard format for ZLD mentioned is as follows:
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+ +
+int +mdn_translator_matchZLD(const char *domain, + const char *ZLD) ++
ドメイン名 domain と ZLD ZLD がマッチするかどうか
+を調べ、マッチすれば1を、しなければ0を返します。
+Checks whether or not the domain variable and ZLD ZLD match, and returns a 1 if they match and a 0 if not.
+
ZLD は
+mdn_translator_canonicalZLD
+で標準形式に変換したものでなければなりません。
+The ZLD must have been converted to the standard format by mdn_translator_canonicalZLD.
+
+
unicode モジュールは、
+UnicodeData.txt
+に記述されている、Unicode の各種文字属性を取得するモジュールです。なお、
+Unicode.txt に記述されているデータの意味、およびファイル形式については
+UnicodeData File Formatをご覧ください。
+The unicode module obtains various character properties of Unicode described in UnicodeData.txt. For details of the data described in Unicode.txt and the file format, refer to UnicodeData File Format.
+
+
本ライブラリの多くのモジュールは Unicode のデータを UTF-8エンコードされた
+文字列形式で扱いますが、このモジュールは unsigned long 型の
+データとして扱います。含まれる値は UCS-4 です。
+Many modules in this library handle Unicode data as UTF-8 encoded character strings but this module handles Unicode data as unsigned long type data. Includes UCS-4 values.
+
+
+このモジュールでは Unicode 文字の大文字小文字の相互変換機能も
+提供しています。 これは
+
+Unicode Technical Report #21: Case Mappings で
+定義されているものです。
+Unicode 文字の中にはごく一部ですが大文字小文字の変換をする際に
+文脈情報を必要とするものがあり、これは次のような列挙型のデータで指定します。
This module provides a mutual conversion function between uppercase and lowercase Unicode characters. This is defined by
+Unicode Technical Report #21: Case Mappings.
+Among Unicode characters, a few characters require context information when uppercase is converted to lowercase. This is specified by the following enumeration type data.
+
+
+typedef enum {
+ mdn__unicode_context_unknown,
+ mdn__unicode_context_final,
+ mdn__unicode_context_nonfinal
+} mdn__unicode_context_t;
+
+
+文脈が FINAL の場合には mdn__unicode_context_final を、また
+NON_FINAL の場合には mdn__unicode_context_nonfinal を指定します。
+mdn__unicode_context_unknown は文脈情報がわからない (調べていない)
+ことを示します。
+文脈情報に関して詳しくは上記文献をご覧ください。以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+int +mdn__unicode_canonicalclass(unsigned long c); ++
Unicode 文字 c の Canonical Combining Class を求めます。
+Canonical Combining Class が定義されていない文字については 0 を返します。
+Obtains Canonical Combining Class for Unicode character c.
+0 is returned for characters for which Canonical Combining Class is not defined.
+
+ +
+mdn_result_t +mdn__unicode_decompose(int compat, + unsigned long *v, size_t vlen, + unsigned long c, int *decomp_lenp) ++
Unicode 文字 c を UnicodeData.txt のCharacter
+Decomposition Mapping にしたがって decompose し、その結果を
+v および vlen で指定される領域に書き込みます。
+compat の値が真なら Compatibility Decomposition を、
+偽ならCanonical Decomposition を行います。
decompose は再帰的に行われます。つまりCharacter Decomposition Mappingにしたがって分解した各文字についてさらに decompose 処理が行われます。
+
Decomposes Unicode characters c in accordance with Character +Decomposition Mapping of UnicodeData.txt and writes the result in the area specified by v and vlen. When the value of compat is true, Compatibility Decomposition is performed and when false, Canonical Decomposition is performed. Decompose is performed recursively, i.e. each character resolved in accordance with Character Decomposition Mapping is further decomposed. + +
返される値は +mdn_success、 +mdn_notfound、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_notfound
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn__unicode_compose(unsigned long c1, + unsigned long c2, unsigned long *compp) ++
c1 と c2 の2文字の Unicode 文字のシーケンスを
+UnicodeData.txt のCharacter Decomposition Mapping にしたがって
+compose し、その結果を compp の指す領域に書き込みます。
+必ず Canonical Composition が行われます。
+Composes a sequence of the two Unicode characters c1 and c2 per the Character Decomposition Mapping in UnicodeData.txt and writes the result in the area specified by compp. Canonical Composition is always peformed.
+
返される値は +mdn_success、 +mdn_notfound +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_notfound
+
+ +
+int +mdn__unicode_iscompositecandidate(unsigned long c) ++
Unicode文字 c から始まる Canonical Composition が存在するか
+どうかを調べ、存在する可能性があれば 1 を可能性がなければ 0 を返します。
+これはヒント情報であり、1が返ってきたとしても実際には Composition が
+存在しないこともあり得ます。逆に 0 が返ってくれば確実に存在しません。
+Checks whether or not Canonical Composition that begins with Unicode character c exists. 1 is returned if existence is possible, and 0 if not. If 1 is returned, it is possible that Composition does not actually exist; however, when 0 is returned, it definitely does not exist.
+
Unicode の全文字の中で Canonical Composition の先頭となる文字は数
+少ないので、mdn__unicode_compose の検索のオーバヘッドを減らすためにあらかじめデータをスクリーニングする目的に
+使用することができます。
+As there are only a small number of Unicode characters that can begin Canonical Composition, this can be used for pre-screening of data in order to decrease the search overhead of mdn__unicode_compose.
+
+ +
+mdn_result_t +mdn__unicode_toupper(unsigned long c, mdn__unicode_context_t ctx, + unsigned long *v, size_t vlen, int *convlenp) ++
Unicode文字 c を UnicodeData.txt の Uppercase Mapping
+情報および SpecialCasing.txtの情報にしたがって大文字に変換し、結果を
+v の指す領域に格納します。vlen はあらかじめ
+v に確保した領域の大きさです。変換結果の文字数は
+*convlenp に返されます。
+変換結果が複数の文字になることがあることに注意してください。
+またロケール依存の変換は行いません。
+Converts Unicode characters c to uppercase in accordance with the Uppercase Mapping information in UnicodeData.txt and SpecialCasing.txt, and stores the result in the area specified by v. vlen is the size of the area that is secured for v beforehand. The number of characters in the conversion result is returned to *convlenp. Note that the conversion result may be greater than one character and that locale-dependent conversion is not performed.
+
+
ctx は文字 c の出現する
+文脈情報です。
+ほとんどの文字では変換の際に文脈情報は不要なため、
+通常は mdn__unicode_context_unknown を指定しておくことができます。
+もし文脈情報が必要な場合、本関数は戻り値として mdn_context_required
+を返すので、文脈情報を取得してから改めて呼び出すことが可能です。
+文脈情報の取得には
+mdn__unicode_getcontext を使用します。
+ctx is context information where character c appears.
+Since most characters do not require context information when they are converted, usually mdn__unicode_context_unknown can be specified.
+When context information is necessary, this function returns mdn_context_required as the return value, and it is possible to call it again after obtaining the context information. To obtain context information, mdn__unicode_getcontext is used.
+
+
もし対応する大文字が存在しない場合には c がそのまま
+v に格納されます。
+If no corresponding uppercase character exists, c is stored in v as is.
+
+
返される値は +mdn_success、 +mdn_context_required、 +mdn_buffer_overflow +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_context_required
+
mdn_buffer_overflow
+
+ +
+mdn_result_t +mdn__unicode_tolower(unsigned long c, mdn__unicode_context_t ctx, + unsigned long *v, size_t vlen, int *convlenp) ++
Unicode文字 c を UnicodeData.txt の Uppercase Mapping
+情報および SpecialCasing.txtの情報にしたがって小文字に変換し、結果を
+v の指す領域に格納します。vlen はあらかじめ
+v に確保した領域の大きさです。変換結果の文字数は
+*convlenp に返されます。
+変換結果が複数の文字になることがあることに注意してください。
+またロケール依存の変換は行いません。
+Converts Unicode character c to lowercase in accordance with Uppercase Mapping information of UnicodeData.txt and SpecialCasing.txt information, and stores the result in the area specified by v. vlen is the size of area that is secured for v beforehand. The number of characters of the conversion result is returned to *convlenp.
+
+
ctx は文字 c の出現する
+文脈情報です。
+ほとんどの文字では変換の際に文脈情報は不要なため、
+通常は mdn__unicode_context_unknown を指定しておくことができます。
+もし文脈情報が必要な場合、本関数は戻り値として mdn_context_required
+を返すので、文脈情報を取得してから改めて呼び出すことが可能です。
+文脈情報の取得には
+mdn__unicode_getcontext を使用します。
+ctx is context information where character c appears.
+Since most characters do not require context information when they are converted, usually mdn__unicode_context_unknown can be specified.
+When context information is necessary, this function returns mdn_context_required as the return value, and it is possible to call it again after obtaining the context information.
+To obtain context information,
+mdn__unicode_getcontext is used.
+
+
もし対応する小文字が存在しない場合には c がそのまま
+v に格納されます。
+If no corresponding uppercase character exists, c is stored in v as is.
+
+
返される値は +mdn_success、 +mdn_context_required、 +mdn_buffer_overflow +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_context_required
+
mdn_buffer_overflow
+
+ +
+mdn__unicode_context_t +mdn__unicode_getcontext(unsigned long c) ++
大文字小文字変換で用いられる文脈情報を返します。
+文脈情報を取得するには次のようにします。
+まず大文字小文字変換の対象文字に続く次の文字を取得し、この関数を
+呼び出します。もし返される値が mdn__unicode_context_final
+あるいは mdn__unicode_context_nonfinal のいずれかであれば
+それが求める文脈情報です。
+mdn__unicode_context_unknown の場合にはさらに続く文字を取得し、
+この関数を呼び出します。このようにして mdn__unicode_context_final
+か mdn__unicode_context_nonfinal かいずれかの値が得られるまで
+処理を繰り返します。もし文字列の最後まで来た場合には、文脈はmdn__unicode_context_final となります。
+Returns context information used for conversion of uppercase/lowercase characters.
+To obtain context information, first the character following the uppercase/lowercase character conversion target character is obtained and this function is called. If the return value is mdn__unicode_context_final or mdn__unicode_context_nonfinal, that context information is the context information to obtain.
+If mdn__unicode_context_unknown is returned, the next character is obtained and the function is called. In this way, processing continues until either the value of mdn__unicode_context_final or mdn__unicode_context_nonfinal is obtained. When processing reaches the end of the character string, mdn__unicode_context_final becomes the context.
+
+
具体的にはこの関数は次のような処理を行います。
+Unicode 文字 c の "General Category" 属性を参照し、
+それが "Lu" "Ll" "Lt" のいずれかであれば
+mdn__unicode_context_nonfinal を、"Mn" であれば
+mdn__unicode_context_unknown を、それ以外であれば
+mdn__unicode_context_final を返します。
+Specifically, this function does the following.
+Refers "General Category" properties of Unicode character c and if it is "Lu", "Ll" or "Lt" mdn__unicode_context_nonfinal is returned, if it is "Mn" mdn__unicode_context_unknown is returned, and if it is other than the above, mdn__unicode_context_final is returned.
+
+
unormalize モジュールは、Unicode で定義されている標準の正規化を
+行うモジュールです。Unicode の正規化は
+Unicode Technical Report #15: Unicode Normalization Forms
+で定義されています。本モジュールはこの文書にあげられた4つの正規化形式を
+実装しています。
+The unormalize module performs the standard normalization defined by Unicode. Normalization of Unicode is defined in Unicode Technical Report #15: Unicode Normalization Forms. This module implements the four normalization forms mentioned in this document.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn__unormalize_formc(const char *from, char *to, size_t tolen) ++
UTF-8でエンコードされた文字列 from に対して
+正規化 Unicode Normalization Form C を適用し、その結果を
+to および tolen で指定される領域に書き込みます。
+Applies Unicode Normalization Form C normalization to a UTF-8 encoded from character string and writes the result in the area specified by to and tolen.
+
返される値は +mdn_success、 +mdn_invalid_encoding、 +mdn_buffer_overflow、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_invalid_encoding
+
mdn_buffer_overflow
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn__unormalize_formd(const char *from, char *to, size_t tolen) ++
UTF-8でエンコードされた文字列 from に対して
+正規化 Unicode Normalization Form D を適用し、その結果を
+to および tolen で指定される領域に書き込みます。
+Applies Unicode Normalization Form D normalization to a UTF-8 encoded from character string and writes the result in the area specified by to and tolen.
+
返される値は +mdn_success、 +mdn_invalid_encoding、 +mdn_buffer_overflow、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_invalid_encoding
+
mdn_buffer_overflow
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn__unormalize_formkc(const char *from, char *to, size_t tolen) ++
UTF-8でエンコードされた文字列 from に対して
+正規化 Unicode Normalization Form KC を適用し、その結果を
+to および tolen で指定される領域に書き込みます。
+Applies Unicode Normalization Form KC normalization to a UTF-8 encoded from character string and writes the result in the area specified by to and tolen.
+
返される値は +mdn_success、 +mdn_invalid_encoding、 +mdn_buffer_overflow、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_invalid_encoding
+
mdn_buffer_overflow
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn__unormalize_formkd(const char *from, char *to, size_t tolen) ++
UTF-8でエンコードされた文字列 from に対して
+正規化 Unicode Normalization Form KD を適用し、その結果を
+to および tolen で指定される領域に書き込みます。
+Applies Unicode Normalization Form KC normalization to a UTF-8 encoded from character string and writes the result in the area specified by to and tolen.
+
返される値は +mdn_success、 +mdn_invalid_encoding、 +mdn_buffer_overflow、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_invalid_encoding
+
mdn_buffer_overflow
+
mdn_nomemory
+
utf5 モジュールはドメイン名のエンコーディング方式の一つとして
+提案されている
+UTF-5 エンコーディング
+の基本処理を行うモジュールです。
+The utf5 module performs basic processing for the proposed UTF-5 domain name encoding system.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+int +mdn_utf5_getwc(const char *s, size_t len, + unsigned long *vp) ++
UTF-5でエンコードされた長さ len バイトの文字列 s の
+先頭の文字を取り出し、UCS-4 に変換して vp の指す領域に格納すると
+ともに、文字の (UTF-5エンコードでの) バイト数を返します。
+もし len が短すぎて文字の途中で終わっていたり、エンコーディングが
+間違っている場合には 0 が返されます。
+Extracts the leading character of length len byte UTF-5 encoded character string s, converts it to UCS-4 and stores it in the area specified by vp and also returns the number of bytes in the (UTF-5 encoded) character strintg. 0 is returned if len is too short and ends in the middle of a character or the encoding is invalid.
+
+ +
+int +mdn_utf5_putwc(char *s, size_t len, unsigned long v) ++
UCS-4 文字 v をUTF-5エンコーディングに変換し、s
+および len で指定される領域に書き込むとともに、書き込んだバイト数を
+返します。ただし len が短すぎて書き込めない場合には0を返します。
+Converts UCS-4 characters v to UTF-5 encoding, writes them in the area specified by s and len and returns the number of bytes written. 0 is returned if len is too short to write.
+
書き込んだUTF-5文字列はNULL 文字で終端されていません。
+The written UTF-5 character string is not terminated with a NULL character.
+
+
utf8 モジュールはUTF-8 でエンコードされた文字列の基本処理を行う
+モジュールです。
+The utf8 module performs the basic processing of UTF-8 encoded character strings.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+int +mdn_utf8_mblen(const char *s) ++
UTF-8 文字列 s の先頭文字の長さ(バイト数)を返します。
+もし s が指すバイトが UTF-8 の先頭バイトとして正しくないものである
+場合には 0 を返します。
+Returns the length (number of bytes) of the leading character in the UTF-8 character string s. 0 is returned if the leading byte indicated by s is not valid for UTF-8.
+
この関数は s の先頭バイトのみを調べて長さを返します。したがって
+2バイト目以降に不正なバイトがある可能性が存在します。特に途中に NULL バイトが
+ある可能性もあるので、s が正当な UTF-8 文字列であることが確実では
+ない場合には気をつける必要があります。
+This function returns the length by checking the leading byte of s; there is therefore a possibility of invalid byte in the 2nd and later byte. In particular, NULL bytes may exist in the middle, so you have to be careful when it is not certain that s is a valid UTF-8 character string.
+
+ +
+int +mdn_utf8_getmb(const char *s, size_t len, char *buf) ++
長さ len バイトの UTF-8 文字列 s の先頭の1文字をbuf にコピーし、コピーしたバイト数を返します。もし len が短すぎたり、s が指す文字が UTF-8 として正しくない場合にはコピーは行わず、0 を返します。
+Copies the leading character of s UTF-8 character strings of length len and returns the number of copied bytes.
+
buf は任意の UTF-8 エンコーディングの文字が保持できる大きさ
+でなければなりません。すなわち、6バイト以上の長さを持っている必要があります。
+buf must be large enough to hold any UTF-8 encoding, i.e. it must be 6 bytes or larger.
+
書き込んだUTF-8文字列は NULL 文字で終端されていません。
+The written UTF-8 character string is not terminated with a NULL character.
+
+ +
+int +mdn_utf8_getwc(const char *s, size_t len, + unsigned long *vp) ++
mdn_utf8_getmb とほぼ同じですが、
+s から取り出した文字を
+UCS-4に変換して vp の指す領域に格納するところが異なります。
+This is almost same as mdn_utf8_getmb with the difference being that characters extracted from s are converted to UCS-4 and stored in the area indicated by vp.
+
+ +
+int +mdn_utf8_putwc(char *s, size_t len, unsigned long v) ++
UCS-4 文字 v を UTF-8 エンコーディングに変換して、
+s および len で指定される領域に書き込むとともに、
+書き込んだバイト数を返します。v の値が不正であったり
+len が短すぎた場合には 0 を返します。
+Converts UCS-4 character v to UTF-8 encoding, writes it in the area specified by s and len and returns the number of written bytes. 0 is returned when the value of v is invalid or len is too short.
+
書き込んだUTF-8文字列は NULL 文字で終端されていません。
+The written UTF-8 character string is not terminated with a NULL character.
+
+ +
+int +mdn_utf8_isvalidstring(const char *s) ++
NULL 文字で終端された文字列 s が正しい UTF-8 エンコーディング
+であるかどうか調べ、正しければ 1 を、正しくなければ 0 を返します。
+Checks whether or not character string s terminated with a NULL character is valid UTF-8 encoding and returns 1 if so and 0 if not.
+
+ +
+char * +mdn_utf8_findfirstbyte(const char *s, + const char *known_top) ++
文字列 known_top 中の s が指すバイトを含む
+UTF-8 文字の先頭バイトを調べて返します。その文字が正しい UTF-8
+エンコーディングではない場合、known_top から s までの
+間に先頭バイトがなかった場合には NULL を返します。
+In the character string known_top, checks the leading byte of UTF-8 characters including the byte indicated by s and returns it. NULL is returned if there are any incorrectly encoded UTF-8 characters or there is no leading byte between known_top and s.
+
+
util モジュールは他のモジュールで使われるユーティリティー的な
+機能を提供するモジュールです。
+現在のところは大文字小文字の区別をしない文字列照合の機能のみを
+提供しています。
+The util module provides utility type functions used by other modules. The only function currently provided is a character string collation function that does not differentiate between uppercase and lowercase characters.
+
+
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+int +mdn_util_casematch(const char *s1, const char *s2, size_t n) ++
文字列 s1 と s2 の先頭から最大 n バイトを
+比較し、同一かどうかを判定します。
+ASCII 文字の大文字と小文字 (つまり A から Z と a から z) は同一とみなします。
+同一であれば 1 を、違っていれば 0 を返します。
+これは多くのシステムで用意されている strcasencmp と返り値の仕様を
+除けばほぼ同様の機能を提供する関数です。
+Compares the maximum n bytes from the beginning of character strings s1 and s2 and determines whether or not they are identical. Uppercase and lowercase ASCII characters (i.e. A to Z and a to z) are assumed to be the same. 1 is returned if they are found to be identical and 0 is returned if not. With the exception of the return value specifications, this function provides almost the same features as strcasencmp, which is provided in many systems.
+
+ +
ZLDrule モジュールはドメイン名と ZLD とのマッチングを行うモジュールです。
+ドメイン名に使用される可能性のある ZLD のリストとそれぞれの ZLD に対応した
+エンコーディングのリストを持ち、与えられたドメイン名とのマッチングを行って
+マッチした ZLD とエンコーディングを返します。
+The ZLDrule module matches the domain name and ZLD. It has a list of ZLDs that are probably used for domain names and the list of encodings corresponding to each ZLD, and performs matching with the given doman name, then returns the matched ZLD and encoding.
+
+
ZLDrule モジュールはマッチングのために「コンテキスト」という概念を用います。
+マッチングに先立ってまずコンテキストを作成し、それに対して
+ZLD とエンコーディングを登録していきます。
+そして実際にドメイン名とマッチングを行う際にはこのコンテキストを用いて
+マッチングに使用するZLD とエンコーディングのリストを指定します。
+コンテキストの型は
+mdn_ZLDrule_t 型であり、次のような opaque 型として定義されています。
+The ZLDrule module uses "context" concept for matching. Prior to matching, a context is created and ZLD and encoding are registered for the context. When domain name matching is performed, this context is used to specify the ZLD and encoding lists used for matching. The type of context is mdn_ZLDrule_t and is defined as the following opaque type.
+
+
++ ++typedef struct mdn_ZLDrule *mdn_ZLDrule_t; ++
以下にモジュールの提供するAPI関数を示します。
+This module provides the following API functions.
+
+
+mdn_result_t +mdn_ZLDrule_create(mdn_ZLDrule_t *ctxp) ++
ZLDのマッチングを行うためのコンテキストを作成し、
+ctxp の指す領域に格納します。
+Creates a context for ZLD matching and stores it in the area indicated by ctxp.
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+ +
+void +mdn_ZLDrule_destroy(mdn_ZLDrule_t ctx) ++
mdn_ZLDrule_create で作成した
+コンテキスト ctx を削除し、確保したメモリを解放します。
+Deletes the context created by mdn_ZLDrule_create and releases the allocated memory.
+
+ +
+mdn_result_t +mdn_ZLDrule_add(mdn_ZLDrule_t ctx, const char *ZLD, + const char **encodings, int nencodings) ++
mdn_ZLDrule_create で作成した
+コンテキスト ctx に、ZLD ZLD と
+encodings および nencodings で指定される
+エンコーディングリストの組を登録します。
+Registers the ZLD and encoding list set specified by encodings and nencodings in context ctx created by mdn_ZLDrule_create.
+
空の ZLD、つまり "" や "." は任意のドメイン名にマッチします。
+したがってZLDとして空の値を指定することによって、いずれの
+ZLD にもマッチしなかった場合のデフォルトのエンコーディングを指定することが
+可能です。
+Empty ZLDs such as "" or "." match all domain names, therefore, by specifying an empty value for ZLD the default encoding can be specified in those cases in which no ZLD match is found.
+
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_nomemory
+
+ +
+mdn_result_t +mdn_ZLDrule_select(mdn_ZLDrule_t ctx, const char *domain, + char **ZLDp, mdn_converter_t *convctxp) ++
コンテキスト ctx に含まれている ZLD のリストと
+ドメイン名 domain とのマッチングを試みます。マッチングは
+ZLDが長い (ZLD を構成するラベルの数が多い) ものから順に行われます。
+Attempts to match the ZLD list contained in context ctx and domain name domain. Matching is executed starting from the longest ZLD (a ZLD consisting of many labels).
+
マッチするZLDがあった場合、ZLDp の指す領域に、マッチした
+ZLD へのポインタが格納されます。返されるポインタはすでに
+mdn_translator_canonicalZLD
+によって標準形式になっているので、そのまま
+mdn_translator_translate への
+引数として渡すことができます。
+When a ZLD match is found, the pointer to the ZLD match is stored in the area specified by ZLDp. Since the return pointer has already been converted to the standard form by mdn_translator_canonicalZLD, it can be passed as the argument as is.
+
マッチしたZLD に対応するエンコーディングが一つだけなら、そのエンコーディング
+に対応するコード変換コンテキストが convctxp の指す領域に
+格納されます。
+対応するエンコーディングが複数あれば、リストの先頭から順に
+domain がそのエンコーディングとして正しいかどうかを調べます。
+もし正しいものがあれば、最初に見つかったもののコード変換コンテキストが
+convctxp の指す領域に格納されます。正しいものがなければ
+convctxp には何も書き込まれず、mdn_invalid_encodingが
+返されます。
+When only one encoding method corresponds to the matched ZLD, the code conversion context corresponding to that encoding method is stored in the area specified by convctxp. If there is more than one valid encoding method, a check is performed from the top of the list to determine whether or not domain is valid for the encoding. Of the valid encoding methods found, the code conversion context of the first one found is stored in the area specified by convctxp. If no valid encoding method is found, nothing is written in convctxp and mdn_invalid_encoding is returned.
+
マッチする ZLD がなければ mdn_notfoundを返して処理を終了します。
When there is no ZLD match, mdn_notfound is returned and processing ends.
+
返される値は +mdn_success、 +mdn_notfound、 +mdn_invalid_encoding +のいずれかです。 +
One of the following values is returned:
+
mdn_success
+
mdn_notfound
+
mdn_invalid_encoding
+
+
+ +
mdnconv はネームサーバの設定ファイル named.conf や +ゾーンマスタファイルのためのコードセット (エンコーディング) 変換ツールです。 +
mdnconv is a code set (encoding) conversion tool for the named.conf configuration or zone master files used with name servers. +
mdnconv は引数で指定されたファイル、あるいは標準入力から +テキストを入力し、オプションで指定されたコードセット変換および正規化を +実行し、結果を標準出力に書き出します。 +
mdnconv receives the file specified by an argument or text entered using the keyboard, executes the code set conversion and normalization specified by the option, and writes the result in standard output. + +
具体的な使い方に関しては利用者ガイドの +named.conf、 +ゾーンマスタファイルの作成の項をご覧ください。 +
For detailed information about usage, refer to named.conf, Creating a Zone Master File in the User's Guide. + +
+ +
+++% mdnconv [オプション...] [ファイル...] ++
++ ++% mdnconv [Option...] [File...] ++
指定しなかった場合には現在のロケールからデフォルトのコードセットを + 求めます。 +
When not specified, the default code set is obtained from the current locale. +
+
指定しなかった場合には
+ クライアント設定ファイルの
+
+ サーバエンコーディングエントリ
+ に設定されているコードセットが使用されます。
+
When not specified, the code set specified in server encoding entry of the client configuration file is used.
+
+
For individual normalization methods, refer to the normalizer module of the MDN library. +
このオプションは複数指定することが可能です。複数指定した場合には、 + 指定した順に正規化が行われます。 +
With this option, more than one method can be specified. When multiple methods are specified, normalization takes place in the order of the specification. + +
このオプションを指定しなかった場合には + クライアント設定ファイルの + 正規化エントリに + 指定されている正規化方式が使用されます。 +
When this option is not specifed, the normalization method specified in normalization entry of the client configuration file is used. +
+
このオプションを指定しなかった場合には + クライアント設定ファイルの + サーバ ZLD エントリに + 指定されている値が使用されます。 +
When this option is not specified, the value specified in the server ZLD entry of the client configuration file is used. +
+
+
+
+++# "#" で始まる行はコメント +sjis Shift_JIS +euc-jp EUC-JP ++
++ ++# Lines that begin with a "#" are comments +sjis Shift_JIS +euc-jp EUC-JP ++
+ +
mdnconv が行う変換処理をステップごとに記述します。 +
The steps performed during conversion processing by mdnconv are described below. + +
+
+
通常は行全体を UTF-8 に変換しますが、入力コードセットが + "RACE" の場合には、RACE エンコーディングを識別するプリフィックスを用いて + RACE エンコードされた部分のみを取り出して UTF-8 に変換します。 +
Usually, the entire line is converted to UTF-8. However, when the input code set is "RACE", a prefix that identifies RACE encoding is used to extract the RACE encoded part for conversion to UTF-8. +
+
+
+
取り出された部分のみを以降の正規化等の処理対象とします。 +
Only the extracted part is the processing target for the subsequent normalization and other processing. +
+
+
+
+
+
+
+
+ +
runmdn は BIND-4 あるいは BIND-8 をベースとした +リゾルバライブラリを持つクライアントを、 +再コンパイルなしに多言語ドメイン名を扱えるようにするためのコマンドです。 +
The runmdn command allows clients that use a BIND-4 or BIND-8 based resolver library to support multilingual domain names without re-compiling. +
+ +
+++% runmdn コマンド [引数...] ++
++ ++% runmdn Command [Argument...] ++
例えば telnet コマンドで多言語ドメイン名を扱うためには +次のようにします。 +
For example, multilingual domain names can be supported using a telnet command as follows. +
+++% runmdn telnet ログイン.どこかの会社.jp ++
++ ++% runmdn telnet ログイン.どこかの会社.jp ++
runmdn は共有ライブラリのプリロード機構を用いて、標準の +リゾルバライブラリに含まれる関数の一部を、多言語ドメイン名の処理機能を持つ +別のバージョンに動的に置換えることで、クライアントでの多言語ドメイン名の +処理を実現します。 +
runmdn implements processing of multilingual domain names by the client using the pre-load mechanism of the common library, and dynamically replaces a part of function included in the standard resolver library with another version that has a multilingual domain name processing function. + +
多くのシステムでは共有ライブラリのプリロードは環境変数 +LD_PRELOAD を用いて実現されています。この環境変数にプリロードしたい +共有ライブラリファイルのパス名を指定すると、クライアントの実行時に、 +アプリケーションに標準の共有ライブラリがリンクされる前に +指定したライブラリがリンクされます。これによって標準のライブラリ関数を +置換えることができます。 +
In many systems, pre-loading of the common library is implemented using an environmental variable LD_PRELOAD. By specifying the path name of the common library file to pre-load in this environmental variable, when the client executes, the specified library is linked before the standard common library of the application is linked. Because of this, the standard library function can be replaced. + +
したがって、runmdn の実体は、この環境変数を設定し、引数で +指定されたコマンドを起動するだけのシェルスクリプトであり、実際に +多言語ドメイン名の処理を行うのはアプリケーションにリンクされる +共有ライブラリ libmdnresolv です。 +
Therefore, in reality runmdn is a shell script that sets this environmental variable and invokes the commands specified by arguments, and actual multilingual domain name processing is performed by the shared library libmdnresolv linked to the application. + +
libmdnresolv をリンクすることにより、BIND4 あるいは BIND8 ベースの +リゾルバライブラリで用いられている次の関数が置き換わります。 +
By linking libmdnresolv, the following functions used by BIND4 or BIND8 based resolver library are replaced. +
++ ++dn_comp +dn_expand +res_hnok +res_ownok +res_mailok +res_dnok ++
それぞれの変更点を簡単に記述します。 +
Changes in each function are briefly explained below. +
エンコーディング変換や正規化、ZLD の処理等はすべて +MDN ライブラリ (libmdn) の +res モジュールを使用しています。 +
For all processing such as encoding conversion, normalization and ZLD, res module of MDN library (libmdn) is used. +
+現在の実装では libmdnresolv は MDN ライブラリ (libmdn) を +呼び出すのではなく、libmdn 自体を内部に抱え込むような形態になっていますが、 +これは単なる実装上の都合からそうなっているだけで、論理的には MDN +ライブラリの機能を呼び出しているといってよいでしょう。 ++ +
In the current implementation, libmdnresolv does not call the MDN library (libmdn) but holds libmdn itself internally. This is for convenience in implementation, but logically, the MDN library function is being called. +
また使用するエンコーディングや正規化の設定は +クライアント設定ファイルの設定を +利用します。 +
Also, use "setup"in client configuration filefor encoding or normalization setup. + +
runmdn にはいくつかの制限があり、どんなシステムでも使えるわけでは +ありません。 +
There are certain restrictions on runmdn and it cannot be used in every system. +
mDNkit は次のようなコンポーネントから構成されます。 +
The mDNkit is comprised of the following components. + +
+
This is an encoding conversion tool for zone master files or named.conf files. These locally-encoded files are converted to the DNS protocol encoding used by the multilingualized DNS server, and normalization is performed at the same time. +
+
This patch adds to BIND-9 the ability to support multilingual domain names. + This patch adds encoding conversion of multilingual domain names and normalization functions to the BIND-9 resolver. Because of this, multilingual domain names will be supported without using dnsproxy. + Also, tools such as dig will be able to support multgilingual domain names. +
+
This command allows support of multilingual domain names in BIND-4 or BIND-8 based applications, without re-compiling. + By dynamically linking the MDN library when the application is executed, encoding conversion of multilingual domain names and normalization functions are added to the resolver linked to the application. Because of this, multilingual domain names can be handled without using dnsproxy. +
+
This is a Wrapper DLL for WINSOCK that allows Windows-based applications to support multilingual domain names. + Usually, Windows applications resolve domain names with WINSOCK. + mDN Wrapper intercepts the WINSOCK call and performs encoding conversion and normalization of multilingual domain names. + The same thing can be done with dnsproxy; however, when mDN Wrapper is used different local encoding used by applications can be accepted. +
+
This library is used by the above components, and provides the following multilingual domain name-related functions. +
+
各コンポーネントがどこでどのように使われるのかを示したのが次の2枚の図です。 +
The following two diagrams illustrate how and where each component is used. + +
1枚目は多言語ドメイン名の処理を dnsproxy を利用して行う場合の構成図です。 +
The first diagram depicts multilingual domain name processing using dnsproxy. +
+
++ ++
2枚目は dnsproxy を使用せず、クライアント側のリゾルバで多言語ドメイン名の +処理を行う場合の構成図です。 +
The second diagram depicts multilingual domain name processing using the client side resolver without using dnsproxy. +
+
++ ++
図中、イタリック体の部分が本キットに含まれるコンポーネントです。 +
In the diagrams, the italicized parts are compoments included in the kit. + +
図の上半分は SJIS など、ローカルエンコーディングが使用される +世界で、下半分が UTF-8 など、多言語化された DNS が使用する +DNS プロトコル上のエンコーディングが使用される世界です。 +本キットが提供するコンポーネントはこれらの世界をつなぐためのものです。 +
Local encoding such as SJIS is used in the upper half of the diagram, and multilingual DNS protocal encoding such as UTF-8 is used in the lower half of the diagram. +The components provided by this kit serve as a bridge between these two worlds. + + + diff --git a/contrib/idn/mdnkit/doc/en/spec/wrapper.html b/contrib/idn/mdnkit/doc/en/spec/wrapper.html new file mode 100644 index 0000000000..f67ce750ad --- /dev/null +++ b/contrib/idn/mdnkit/doc/en/spec/wrapper.html @@ -0,0 +1,728 @@ + + + + +
+
+ +
+ラッパーDLL は、アプリケーションと元のDLL との間に割り込んで、 +アプリケーションからのDLL の呼び出しを横取りして、 +本来のDLL とは異なった処理をさせるものです。 +
+Positioned between the application and the original DLL, the wrapper DLL hooks the application DLL call and operates different processing than that in the original DLL. +
+++
+アプリケーションからのDLL の呼び出しはラッパーに渡されます。 +ラッパーはそこで、付加的な処理を行なって、 +元のDLL のエントリを呼び出します。 +また、元のDLL の処理結果は一旦ラッパーに返され、 +ここでも付加的な処理を行なって、 +最終的な結果がアプリケーションに返されることになります。 +
+The application DLL call is passed to the wrapper. +The wrapper performs additional processing and calls the original DLL entry. +Next, the processing result of the original DLL is returned to the wrapper and the wrapper again performs additional processing, then the final result is returned to the application. +
+mDN wrapper では、WINSOCK DLLの +
++に対するラッパーDLL を提供して、 +多言語ドメイン名の名前解決ができるようにします。 ++
++ WSOCK32.DLL WINSOCK V1.1 + WS2_32.DLL WINSOCK V2.0
+With mDN Wrapper, to provide name resolution of multilingual domain names, a wrapper DLL is provided for the following WINSOCK DLLs: + +
+++
++ WSOCK32.DLL WINSOCK V1.1 + WS2_32.DLL WINSOCK V2.0
+++
++ 注 : ++ 16ビット版のWINSOCK (WINSOCK.DLL) は対象外です。 + +
++ Note : ++ The 16-bit version of WINSOCK (WINSOCK.DLL) is not supported. +
+
+mDN Wrapper はWINSOCK の名前解決に関連したAPI についてのみ +付加的な処理を行ないます。 +処理の対象となるWINSOCK APIは以下のものです。 +
+mDN Wrapper performs additional processing on only those APIs that are associated with WINSOCK name resolution. +The following WINSOCK APIs are subject to processing. +
| gethostbyaddr |
| gethostbyname |
| WSAAsyncGetHostByAddr |
| WSAAsyncGetHostByName |
+
| WSALookupServiceBeginA |
| WSALookupServiceNextA |
| WSALookupServiceEnd |
+アプリケーションによっては、 +これらのAPI を使わないで独自にドメイン名の解決を行なうものもあります。 +例えば、nslookupは、これらのAPI を使わないで、 +内部で独自にDNS リクエストの生成、解釈を行なっています。 +当然のことながら、これらのアプリケーションについては、 +mDN Wrapper では多言語化対応させることはできません。 +
+Some applications independently resolve domain names without using these APIs. +For example, nslookup internally generates and interprets DNS requests independently. Naturally, mDN Wrapper does not provide multilingual domain name support to these applications. +
+++
++ 注 : ++ dnsproxyはネットワーク上でDNS のリクエスト、 + レスポンスについて多言語化しますので、 + これらのアプリケーションについても多言語化させることができます。 + 必要に応じて適時使い分けるといいでしょう。 + + Note : ++ dnsproxy makes DNS request/response multilingual on the network and also can make these applications multilingual. + It is recommended they be used as needed. + 注 : ++ WINSOCK 2.0 には、WIDE CHARACTER ベースの名前解決のAPI として + ++
+ もありますが、これらについてはラップしません。 + これらのAPI はマイクロソフト仕様による国際化に対応したものですから、 + そのフレームワーク上で使うべきものです。 + これらについてはmDN Kit によって他の多言語フレームワークに + 変換してしまうのは危険ではないか、と判断しました。 ++ WSALookupServiceBeginW + WSALookupServiceNextW Note : ++ WINSOCK 2.0 has the following APIs for WIDE CHARACTER based name resolution. + ++
+ However, these are not wrapped. + These APIs are internationalized for Microsoft specifications and therefore should be used within that framework. + We determined that it is dangerous to use mDN Kit to convert these APIs to another multilingual framework. ++ WSALookupServiceBeginW + WSALookupServiceNextW
+
+上記以外のWINSOCK API については、mDN Wrapper はなにもしないで、 +元のWINSOCK API を呼び出します。 +WINSOCK DLL にはドキュメントされていないエントリも含まれています。 +それらのエントリについては、呼び出しパラメタ等が判らないので、 +ラッパー内のコードから元のDLL のエントリを呼び出すことができません。 +そこで、mDN Wrapper は上記以外のエントリについては、 +function forwarding によって、 +DLL の呼び出しが元のDLL にフォワードされるようにしています。 +
+Regarding WINSOCK APIs other than those above, mDN Wrapper does not do anything and calls the original WINSOCK API. +WINSOCK DLL includes entries that are not documented. +Regarding those entries, since call parameters, etc. are not known, it is not possible to call the original DLL entries using codes inside the wrapper. +Therefore, for the entries other than the above, mDN Wrapper uses 'function forwarding' to forward calling of a DLL to the original DLL. +
+'function forwarding' を使う場合には、 +ラッパーDLL 作成時にフォワード先のDLL 名を明示的に指定する必要があり、 +そのDLL 名はラッパー自身とは別の名前、 +すなわち元のDLL とも別の名前、になっていなければなりません。 +mDN wrapper では、元のWINSOCK DLL を名前を変えてコピーし、 +それをフォワード先のDLL として使用するものとします。 +
+When 'function forwarding' is used, it is necessary to explicitly specify the forward destination DLL name when the wrapper DLL is created. The DLL name must be different from the wrapper itself, that is, a different name that the original DLL. mDN wrapper copies the original WINSOCK DLL as a different name and uses it as the forward destination DLL. +
+++
++ wsock32.dll -> wsock32o.dll + ws2_32.dll -> ws2_32o.dll
+ラッパーDLL は元のWINSOCK DLL と同じ名前で作成されます。 +従ってmDN wrapper がインストールされた状態では、 +
+A wrapper DLL is created with the same name as the original WINSOCK DLL. +Therefore, when mDN Wrapper has been installed, their names are as follows: +
++となります。 ++
++ wsock32.dll mDN Wrapper for WINSOCK V1.1 + ws2_32.dll mDN Wrapper for WINSOCK V2.0 + wsock32o.dll Original WINSOCK V1.1 DLL + ws2_32o.dll Original WINSOCK V2.0 DLL
+
+ドメイン名の変換は、以下のタイミングで行なわれる必要があります。 +
+Conversion of domain names must be carried out in the following sequence: +
+
+++
+- DNS へのリクエスト時 +
- When request is sent to DNS +
- +
+
++ ローカルエンコーディング -> DNS エンコーディング + Local encoding -> DNS encoding - DNS からの応答受信時 +
- When response is received from DNS +
- +
+
++ DNS エンコーディング -> ローカルエンコーディング + DNS encoding -> local encoding
+同期API においては、 +ローカルエンコーディングからDNS エンコーディングへの変換は、 +元のAPI を呼び出す前に行われ、 +DNS エンコーディングからローカルエンコーディングへの変換は、 +元のAPI から復帰してきたところで行なわれます。 +
+With synchronous API, conversion from local encoding to DNS encoding is performed before the original API is called and conversion from DNS encoding to local encoding is performed when control is returned from the original API. +
+しかし、WINSOCK の以下のAPI は非同期API で、 +DNS からの応答受信前に復帰してしまいます。 +
+However, the following WINSOCKs are asynchronous APIs and control is returned before response is received from the DNS. +
+++
+- WSAAsyncGetHostByAddr +
- WSAAsyncGetHostByName +
+これらのAPI においては、名前解決の完了は、 +Windows へのメッセージによって通知されます。 +このため、 +DNS エンコーディングからローカルエンコーディングへの変換を行なうには、 +ラッパーは通知先のウィンドウプロシジャのメッセージキューをフックして、 +この完了メッセージを捕獲する必要があります。 +
+With those APIs, the completion of name resolution is notified via the message to Windows. For that reason, in order to convert from DNS encoding to local encoding, the wrapper needs to hook the message queue of the window procedure to which notification is sent and capture the completion message. +
+そこで、非同期API が呼び出された場合には、mDN Wrapper は、 +通知先のウィンドウプロシジャ(これはAPI のパラメタで指示されます)に +フックを設定します。 +フックが完了メッセージ(これもAPI のパラメタで指示されます)を検出したなら、 +フックは結果の格納領域(これもAPI のパラメタで指示されています)のドメイン名を、 +DNS 側のエンコーディングからローカルエンコーディングに変換するものとします。 +
+Therefore, when an asynchronous API is called, mDN Wrapper sets the hook (this is specified by the parameter of the API) to the window procedure to which notification is sent. +When the hook detects the completion message (this is also specified by the parameter of the API), the hook converts the domain name in the storage area of the result (this is also specified by the paramter of the API) from the DNS side encoding to local encoding. +
+
+WINSOCK DLL はWindows のシステムディレクトリに置かれています。 +WINSOCK を確実にラップするには、システムディレクトリにおいて +
+The WINSOCK DLL is placed in the system directory of the Windows. +To surely wrap WINSOCK, the following need to be performed in the system directory; +
++を行なう必要があります。 ++
+- オリジナルWINSOCK DLL の名前の変更 +
- Change the names of original WINSOCK DLLs: +
- +
+ren wsock32.dll wsock32o.dll +ren ws2_32.dll ws2_32o.dll ++- ラッパーDLL の導入 +
- Copy Wrapper DLLs: +
- +
+copy somewhere\wsock32.dll wsock32.dll +copy somewhere\ws2_32.dll ws2_32.dll +copy another DLLs also ++
+しかし、システムディレクトリでこのようなDLL の置き換えを行なうのは +大変危険な操作になります。 +
+However, this kind of replacement of DLLs in the system directory is a very dangerous operation. +
+++
++ a) ++ DLL を入れ替えた状態で、もういちど同じ操作を行なうと、 + オリジナルのWINSOCK DLL が失われてしまうことになります。 +
Once the DLL is replaced, if the same operation is repeated again, the original WINSOCK DLL will be lost. ++ b) ++ サービスパックやアプリケーションなどで、 + WINSOCK DLL を再導入するものがありますが、 + これによってもWINSOCK が利用不能になることがあります。 +
Some service packs and applications re-introduce WINSOCK DLLs. This may also disable WINSOCK. +
+このような状態になると、ネットワーク機能が全く使えなくなったり、 +最悪はWindows の起動すらできなくなる可能性があります。 +
+When such status occurs, it is possible that the entire network function will become disabled, or, in the worst case, Windows will not boot. +
+そこで、mDN Wrapper では、上のようなシステムレベルのラップではなく、 +アプリケーションに対するラップを基本機能として提供するものとします。 +
+Therefore, mDN Wrapper shall provide application wrapping as a basic function, not at the system level. +
+Windows において、DLL は、基本的には +
+Basically, in Windows, DLLs are searched in the following order: +
+++
++ アプリケーションのロードディレクトリ + Load directory of application + %SystemRoot%\System32 + %SystemRoot%\System32 + %SystemRoot% + %SystemRoot% + PATH で指示されるディレクトリ + Directory specified by PATH
+の順序で検索されて、最初に見つかったものがロードされます。 +ですから、一般的には、 +DLL をアプリケーションのロードディレクトリにインストールすれば、 +そのアプリケーションからのWINSOCK の呼び出しをラップすることができます。 +
+and the first one found is loaded. +Because of that, in general, installing the DLL in the load directory of the application enables calling of WINSOCK from the application to be wrapped. +
+ただし、いくつかのアプリケーション、DLL では、 +検索パスを経由せずに特定のDLL をリンクするようになっているものがあります。 +このような構成のアプリケーション、DLL が使われた場合には +mDN Wrapper では対処することはできません。 +
+However, some applications and DLLs have a specific DLL linked without going through the search path. mDN Wrapper cannot handle this structure of application or DLL. +
+++
++ 注 : ++ Netscapeは特定DLL にバインドされているようで、 + アプリケーションディレクトリへのインストールではラップできません。 + WINSOCK DLL 自体もシステムディレクトリの関連DLL に + バインドされているようです。 + 一方、Internet ExploreやWindows Media Playerは + 標準のサーチパスに従っているので、 + ラップすることができます。 + + Note : ++ Netscape seems to be bound to a specific DLL and wrap cannot be performed by installing the wrapper DLL in the application directory. + WINSOCK DLL itself seems to be bound to the related DLL of the system directory. + On the other hand, because Internet Explorer and Windows Media Player follow the standard search path, wrap can be performed. +
+
+WINSOCK 2.0 をサポートしているWindows には、 +WINSOCK の1.1 と2.0 のそれぞれに対応するDLL があり、 +WINSOCK 1.1 のAPI の呼び出しは +2.0 の同じエントリにリダイレクトされるようになっています。 +
+Versions of windows that support WINSOCK 2.0 have DLLs that correspond to WINSOCK 1.1 and 2.0, respectively. Calling of the WINSOCK 1.1 API is re-directed to the same entry for 2.0. +
+++
+この場合には1.1 に対する呼び出しも2.0 に対する呼び出しも、 +ともにV2.0用のDLL に渡されるので、 +2.0用のラッパーDLL 側だけで +エンコーディングの変換を行なうようにするべきでしょう。 +
+In this case, calling of 1.1 and 2.0 are both passed to the DLL of V2.0. Therefore, conversion of encoding should be performed at the wrapper DLL side of 2.0 only. +
+一方、WINSOCK 1.1 しかサポートしていない場合(Win95)には、 +1.1 に対応したDLL しかありません。 +
+On the other hand, when only WINSOCK 1.1 is supported (Win95), there is only a DLL that corresponds to 1.1. +
+++
+この場合には必然的に1.1 用のラッパーDLL で +エンコーディングを変換しなければなりません。 +
+In that case, naturally the wrapper DLL for 1.1 is used for encoding conversion. +
+mDN Wrapepr がwindows のシステムディレクトリにインストールされた場合には、 +上の通りに動作するので、 +
+When mDN Wrapper is installed in the Windows system directory, the operation is as shown above, therefore, conversion must be performed as follows. +
++する必要があります。 ++
++ WINSOCK 2.0 あり 2.0 ラッパーで変換 + WINSOCK 2.0 exists 2.0 wrapper is used for conversion + WINSOCK 1.1 のみ 1.1 ラッパーで変換 + WINSOCK 1.1 only 1.1 wrapper is used for conversion
+しかし、 +アプリケーションディレクトリにインストールされた場合には動作が変わってきます。 +Windows 付属の WINSOCK 1.1 DLLは、 +システムディレクトリのWINSOCK 2.0 にバインドされているため、 +アプリケーションディレクトリ側のWINSOCK 2.0 ラッパーDLL には +リダイレクトされてきません。 +このため、アプリケーションディレクトリへのインストールにおいては、 +1.1DLL、2.0DLLの両方でエンコーディングを変換する必要があります。 +
+However, when the wrapper DLL is installed in the application directory, the operation is different. +Since WINSOCK 1.1 DLL attached to the Windows is bound to WINSOCK2.0 located in the system directory, calling of the WINSOCK 1.1 API is not re-directed to the WINSOCK2.0 wrapper DLL at the application directory side. +For that reason, when the wrapper DLL is installed in the application directory, it is necessary to convert encoding for both the 1.1 and 2.0 DLL. +
+このようなDLL 間のバインディングはドキュメントされていませんので、 +環境、バージョンによっては異なった動作をするかも知れません。 +そこでmDN Wrapper では、レジストリ値によって、 +ラッパーDLL のどこで変換を行なうかを決定するようにして、 +インストール先による差異、あるいはバージョンによる差異を吸収するようにします。 +
+Such binding between DLLs is not documented and operation may differ depending on the environment and version being used. +Therefore, with mDN Wrapper, the registry value is used to determine which wrapper DLL is used for conversion so that differences related to the installation location or version are neutralized. +
+mDN Wrapper 用のレジストリ設定は +
+The registry setting for mDN Wrapper is placed under the following directory: +
++以下に配置されます。エンコーディング変換を行なう位置については、 +この直下のレジストリ値 Where(REG_DWORD) によって決定します。 +有効な値は、 ++
++ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\MDN + HKEY_CURRENT_USER\SOFTWARE\JPNIC\MDN
The location for encoding conversion is determined by the Registry Where value (REG_DWORD) under the above. +The effective values are as follows: +
+レジストリ Where (REG_DWORD) ++の4通りです。 +アプリケーションディレクトリにインストールする場合には「0」を、 +システムディレクトリにインストールする場合には「1」を設定する必要があります。 +レジストリ値が存在しない場合には「0」を想定します。 +これはアプリケーションディレクトリへのインストールを標準としたものです。 +
Registry Where (REG_DWORD) ++
++ 0 WINSOCK 1.1、WINSOCK 2.0 の両方で変換する + 0 Converted at both WINSOCK 1.1 and WINSOCK 2.0 are converted + 1 WINSOCK 2.0 があれば、WINSOCK 2.0だけで変換する + 1 When WINSOCK 2.0 exists, converted only at WINSOCK 2.0 + WINSOCK 1.1 だけの場合には WINSOCK 1.1 で変換する + When only WINSOCK 1.1 exists, converted only WINSOCK 1.1 + 2 WINSOCK 1.1 だけで変換する + 2 Converted only at WINSOCK 1.1 only + 3 WINSOCK 2.0 だけで変換する + 3 Converted at WINSOCK 2.0
When the wrapper DLL is installed in the application directory, "0" needs to be set and when installed in the system directory, "1" needs to be set. +If no value is set in the registry, "0" is assumed. This is based on installation in the application directory. +
+
+ラッパーDLL では、解決しようとするドメイン名を、 +マシンのローカルエンコーディングからDNS サーバのエンコーディングに変換し、 +また、DNS が返してきたドメイン名(DNS サーバのエンコーディング)を +マシンのローカルエンコーディングに戻します。 +
+Wrapper DLL converts the domain name to be resolved from the local encoding used by the machine to the DNS server encoding and returns the domain name (DNS server encoding) returned from the DNS to the encoding used by the local machine. +
+現在、DNS 側の多言語化エンコーディングについては、 +いくつもの方式が提案されています。 +ラッパーDLL はそれらのDNS 側エンコーディングのどれかひとつに +変換するように構成されます。 +このDNS 側エンコーディングはレジストリで指示されます。 +このレジストリには、mDN Wrapper のインストール時に +デフォルトエンコーディング(現時点ではRACE)が設定されます。 +当然、このレジストリは、後で他のものに変更することもできます。 +
+With respect to multilingual encoding at the DNS side, a number of methods have been proposed. +Wrapper DLL is structured to convert encoding to one of those DNS side encodings. +This DNS side encoding is specified by the registry. +In this registry, the default encoding (currently, it is RACE) is set when mDN Wrapper is installed. +Naturally, this registry can be changed to some other encoding method. +
+mDN Wrapper 用のレジストリ設定は +
+The registry setting for mDN Wrapper is placed under the following directory. +
++以下に配置されます。 +DNS 側のエンコーディングはレジストリ値 Encoding (REG_SZ)で指示されます。 +このエンコーディング名は、libmdnで認識されるものでなければなりません。 ++
++ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\MDN + HKEY_CURRENT_USER\SOFTWARE\JPNIC\MDN
+レジストリ Encoding (REG_SZ) ++
Registry encoding (REG_SZ) ++DNS サーバ側のエンコーディング名を設定します ++
Set DNS server side encoding name. +
+一方、アプリケーションが使用しているローカルエンコーディングは、 +通常はプロセスのコードページから求めます。 +ラッパーDLL が使用する 'iconv' ライブラリは、 +windows のコードページ名を +エンコーディング名として受付けることができるので、 +コードページ名をそのままローカルエンコーディング名として使用します。 +
+On the other hand, the local encoding used by the application is usually derived from the code page of the process. +Since the 'iconv' library used by Wrapper DLL can accept the code page name of the Windows as the encoding name, the code page name is used as the local encoding name as is. +
+しかし、アプリケーションによっては、 +特定の多言語化エンコーディングで +ドメイン名をエンコーディングしてしまうものもあります。 +例えば、IEではドメイン名をUTF-8 で表記するように +指示することができるようになっています。 +UTF-8 によるエンコーディングは、 +提案されている多言語化方式のひとつですが、 +多言語化されたDNS サーバは他のエンコーディングしか受付けないかも知れません。 +
+However, some applications encode domain names using a specific multilingual encoding method. For example, with Internet Explorer, you can specify that domain names are to be expressed in UTF-8. UTF-8 encoding is one of the proposed multilingual methods, but multilingual DNS server may accept only other encoding. +
+このような状況に対処するため、mDN Wrapper は、 +ローカルエンコーディングとして +プログラム特有のエンコーディングも受付けることができるようにします。 +このようなプログラム特有のローカルエンコーディングは +レジストリ記載されるものとします。 +
+In order to handle this situation, mDN Wrapper is able to accept program-specific encoding as local encoding. Such program-specific local encoding shall be written in the registry. +
+mDN Wrapper 用のプログラム特有のレジストリ設定は +
Registry setting unique to the program for mDN Wrapper is placed under the following directory using the program name (execution module file name) as the key. +
++以下に、プログラム名(実行モジュールファイル名)をキーとして配置されます。 +例えば、Internet Explore の場合には、実行モジュール名のIEXPLOREをキーとして ++
++ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\MDN\PerProg + HKEY_CURRENT_USER\SOFTWARE\JPNIC\MDN\PerProg
For example, with Internet Explorer it is placed under the following directory using IEXPLORE of the execution module name as the key. +
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\MDN\PerProg\IEXPLORE ++以下に置かれます。ローカルエンコーディング名は、レジストリ値Encoding (REG_SZ)で指示します。これもlibmdnで認識されるものでなければなりません。 +
The local encoding name is specified by the Registry Encoding value (REG_SZ). +This also must be one that can be recognized by libmdn. +
+レジストリ Encoding (REG_SZ) ++ +
Registry Encoding (REG_SZ) ++アプリケーションプログラム特有のエンコーディング名 +(デフォルトのエンコーディング以外を必要とする場合)を指定します。 ++Indicates the encoding name unique to the application program (when other than default encoding is required). +
When mDN Wrapper does not operate as expected, the operation log can be very useful in resolving the problem. With mDN Wrapper, the following settings can be made with the registry setting. +
+ログレベル、ログファイルともに次のレジストリの下で設定されます。 +
+Both the log level and log file are set under the following registry. +
+HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\MDN+
+HKEY_CURRENT_USER\SOFTWARE\JPNIC\MDN +
+ログレベルはレジストリ値 LogLevel (REG_DWORD) で指定します。定義されている +値は次の通りです。 +
+The log level is specified usingg the LogLevel registry value (REG_DWORD). The defined values are as follows. +
+ログファイルはログを出力するファイルのパス名を指定するもので、 +レジストリ値 LogFile (REG_SZ) で指定します。デフォルトは +mDN Wrapper をインストールしたディレクトリの下の "mdn_wrapper.log" です。 +
+Log file is used to specify the path to the file to which the log is to be output. +The LogFile (REG_SZ) registry value is used to specify the path. The default is "mdn_wrapper.log" under the directory where mDN Wrapper is installed. +
+なお、ログレベルとログファイルはコンフィギュレーションプログラムを使用しても +設定することができます。 +
+Note that the configuration program can be used to set the log level and log file settings. +
+
+
+mDN Wrapper の設定情報は、HKEY_LOCAL_MACHINE、HKEY_CURRENT_USERの
+
+ Software\JPNIC\MDN ++以下に格納されます。mDN Wrapperは最初にHKEY_LOCAL_MACHINEの設定を読み込み、HKEY_CURRENT_USER側にも設定があれば、これで上書きします。通常は、HKEY_LOCAL_MACHINE 側だけを設定します。ユーザ個別に異なった設定を使いたい場合のみ、HKEY_CURRENT_USERを設定するようにしてください。 +
+mDN Wrapper configuration information stored under +
+ Software\JPNIC\MDN ++
+of HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER. mDN Wrapper first loads the setting of HKEY_LOCAL_MACHINE and overwrites the setting using the setting at HKEY_CURRENT_USER side, if any. Usually, only the HKEY_LOCAL_MACHINE side is set. The HKEY_CURRENT_USER side is also set only when it is desired to use different setting for each user. +
+特に、コンフィギュレーションプログラムは常に HKEY_LOCAL_MACHINE の +設定しか読み書きしません。コンフィギュレーションファイルを使用して +設定を行う場合には気をつけてください。 +
+In particular, the configuration program reads and writes only the settings of HKEY_LOCAL_MACHINE. Be careful when using the configuration file to set settings. +
+
+全体の共通の設定と、プログラム個別設定とがあります。 +
+There are common settings and program-specific settings. +
+ Software\JPNIC\MDN\Where 変換位置 + 0:WINSOCK1.1 WINSOCK2.0の両方で + 1:WINSOCK2.0 があればそちらで + 2:WINSOCK1.1 だけで + 3:WINSOCK2.0 だけで + Software\JPNIC\MDN\Encoding DNS側エンコーディング名 + Software\JPNIC\MDN\Normalize 正規化の方式 + Software\JPNIC\MDN\LogLevel ログレベル + Software\JPNIC\MDN\LogFile ログファイル ++
+ Software\JPNIC\MDN\Where Conversion location + 0:Both WINSOCK1.1 and WINSOCK2.0 + 1:At WINSOCK2.0 when exists + 2:At WINSOCK1.1 only + 3:At WINSOCK2.0 only + Software\JPNIC\MDN\Encoding DNS side encoding name + Software\JPNIC\MDN\Normalize Method of normalization + Software\JPNIC\MDN\LogLevel Log level + Software\JPNIC\MDN\LogFile Log file ++
+変換位置、およびプログラム側のエンコーディングは +プログラム毎に特定することもできます。 +これらは、以下のキーハイブの下に、 +プログラム名をキーとする値で設定します。 +
+Conversion location and program side encoding can be specified for each program.These are set under the following key hive using the value using the program name as the key. +
+ Software\JPNIC\MDN\PerProg\<name>\Where + Software\JPNIC\MDN\PerProg\<name>\Encoding ++指定されていない場合には、 +
++とみなします。 ++
++ Where 0 1.1、2.0 の両方で変換 + Where 0 Converts at both 1.1 and 2.0 + Encoding プロセスのコードページ + Encoding Code page of process
mDNkit documents are currently available only in Japanese. + +
+
+
See LICENSE.txt for the license of this kit. + + diff --git a/contrib/idn/mdnkit/doc/ja/guide/bind9.html b/contrib/idn/mdnkit/doc/ja/guide/bind9.html new file mode 100644 index 0000000000..aa99e3efb8 --- /dev/null +++ b/contrib/idn/mdnkit/doc/ja/guide/bind9.html @@ -0,0 +1,176 @@ + + + + +
++mDNkit では bind9 用のパッチファイルを提供しています。 +このパッチを適用することにより、 +bind9 において多言語ドメイン名を扱うことが可能になります。 + +
+具体的には、このパッチは bind9 に次のような機能を追加します。 +
bind9 へのパッチの適用方法は、パッチファイルの先頭に記載してあります。 +インストールガイドの +bind9 用パッチの適用とインストールも +ご覧ください。 + +
+ +
このパッチの適用により、DNS サーバである named に対して、 +UTF-8 文字の透過機能が追加されます。 + +
bind9 の named ではドメイン名の処理はほとんど8ビットスルーになって +いるのですが、named 内のドメイン名の内部表現からテキスト表現への +変換部分は8ビットスルーになっておらず、ASCII 文字以外 +はバックスラッシュでクォートされ、\DDD という形式の表現に +変換されてしまいます。 + +
これは DNS プロトコル上で用いられるエンコーディングとして UTF-8 を +使用する場合に問題となります。 + +
本パッチでは、変換しようとする文字がUTF-8 文字の +場合にはバックスラッシュによるクォートをせずそのまま透過させる機能を +追加しました。 +この動作は named の設定ファイル (named.conf) で切り替えることができます。 +デフォルトは互換性のため透過しない設定になっています。 +もしDNS プロトコル上で用いるエンコーディングとして UTF-8 を用いる場合には、 +設定ファイルの options セクションの allow-utf8 パラメータを +次のように指定してください。 + +
+
+options {
+ ...
+ allow-utf8 yes;
+ ...
+};
+
+
+
+DNS プロトコル上で用いられるエンコーディングとして RACE 等の +ASCII 互換エンコーディングを +使用する場合には、この設定は不要です。 + +
bind9 のリゾルバは、bind8 までのものとは全く異なり、 +lightweight resolver ライブラリと呼ばれるアプリケーションに +リンクされるライブラリと、lightweight resolver デーモンと呼ばれる +サーバから構成されています。 + +
本パッチを適用することにより、このリゾルバに多言語ドメイン名の +処理機能が加わります。具体的には次のような機能が追加されます。 + +
DNS プロトコル上で用いられるエンコーディングや使用する正規化方式の指定は +あらかじめコンフィギュレーションファイルで設定しておきます。 +このファイルの設定方法については +mDNkit リゾルバのコンフィギュレーション +をご覧ください。 + +
以下に、パッチによって多言語化される名前解決用 API 関数の一覧を示します。 +多言語化された API 関数は、従来の ASCII ドメイン名に加え、 +非 ASCII ドメイン名を扱うことができます。 + +
引数の型や返り値の型に変更はありません。 +パッチを当てる前と同様の呼び出し方法で、従来の ASCII ドメイン名と、 +非 ASCII ドメイン名の両方を扱うことができます。 + +
本パッチを適用した bind9 リゾルバは +MDN ライブラリ を利用してエンコーディング +変換や正規化を行います。従って bind9 リゾルバを使用したクライアントを +コンパイルする場合、MDN のライブラリ libmdn をリンクする必要が +あります。もしあなたのシステムが iconv() をサポートしていない +場合には、iconv() のライブラリも合わせてリンクする必要があります。 + +
+ +
bind9 には DNS の問い合わせツールとして dig、host、nslookup という +コマンドが付属します。bind9 パッチを適用することにより、これらはいずれも +多言語ドメイン名が扱えるようになります。具体的には以下の機能が +付加されます。 +
DNS プロトコル上で用いられるエンコーディングや使用する正規化方式の指定は +あらかじめコンフィギュレーションファイルで設定しておきます。 +このファイルの設定方法については +mDNkit リゾルバのコンフィギュレーション +をご覧ください。 + + + diff --git a/contrib/idn/mdnkit/doc/ja/guide/bindconfig.html b/contrib/idn/mdnkit/doc/ja/guide/bindconfig.html new file mode 100644 index 0000000000..f9ae6d9955 --- /dev/null +++ b/contrib/idn/mdnkit/doc/ja/guide/bindconfig.html @@ -0,0 +1,322 @@ + + + + +
+DNSサーバにて多言語ドメイン名を扱うための設定方法について +解説します。とはいっても従来の ASCII ドメイン名の場合の設定方法と +大きく変わるわけではありません。注意すべき点は次の2点だけです。 +
DNSサーバの設定の手順は、およそ以下の通りです。 + +
+ +最後のファイル作成に関しては、エンコーディングとして UTF-5 を +使用したときに特有の問題があり、これを +
設定で使用するエンコーディング変換ツール mdnconv の外部仕様 +および内部処理の詳細に関しては、 +mdnconv の仕様書をご覧ください。 + +
また、クライアントからこれらの DNS サーバにアクセスするためには、 +多言語ドメイン名用パッチを当てた bind9、 +runmdn コマンド、 +mDN Wrapper などを使用してクライアント側で +エンコーディング変換や正規化を行うか、あるいは +エンコーディング変換を行うプロキシサーバである dnsproxy を通す必要があります。 +dnsproxy の設定については +DNS Proxy Server のコンフィギュレーションで説明します。 + +
+ +
まず DNS の設定に先だって、DNS サーバで使用するドメイン名の +エンコーディングおよび正規化方式を決める必要があります。 + +
評価しようとする DNS の多言語化方式が決まっていれば、 +その方式に合わせることになります。 +現在提案されている方式の中から、使用するエンコーディング・正規化を +いくつか紹介します。これ以外の方式も多数提案されています。詳しくは +参考文献をご覧ください。 + +
+
+
+
エンコーディングとして UTF-5 を採用した場合には、 +ZLD (zero level domain) を付けることで従来のドメイン名と区別する必要が +あります。したがって ZLD を何にするかも決定する必要があります。 + +
その他 mDNkit がサポートしているエンコーディング・正規化方式については +MDN ライブラリの仕様を参照してください。 +
もちろん、1台の DNS サーバに複数のエンコーディングを持たせることも可能 +です。この場合はゾーン毎に異なるエンコーディングを割り当てることになる +でしょう。ただし mDNkit を用いて多言語ドメイン名の扱いを可能にした +クライアントや dnsproxy は DNS サーバ側のエンコーディングが単一である +ことを仮定しているので、例えば dnsproxy の場合にはエンコーディング毎に +複数の dnsproxy を起動するなどのテクニックが必要です。 + +
+ +
エンコーディングとして ASCII 互換エンコーディング (ACE: ASCII Compatible +Encoding) である RACE、UTF-5 を用いる場合には、エンコード結果は従来の +ホスト名として正当な文字列になるので、現在使用中の DNS サーバをそのまま +使うことができます。しかし ASCII 互換エンコーディング以外のエンコーディング、 +特に UTF-8 を用いる場合には、多言語ドメイン処理を付加するパッチを当てた +bind9 の DNS サーバ (named) を使用するか、 +8ビットスルーパッチを当てた bind8 の DNS サーバを用意する必要があります。 + +
それぞれのパッチの当て方およびインストールの方法については +bind9 用パッチの適用とインストール および +bind8 用パッチの適用とインストール を +ご覧ください。 + +
+ +
named.conf やゾーンマスタファイル書き方自体は、 +多言語ドメイン名と従来のドメイン名で変わるところはありません。 +単にドメイン名に漢字などを含めることができるかどうかだけの違いです。 + +
DNS サーバ自体にエンコーディング変換機能は備わっていないので、 +DNS の読み込む named.conf ファイルやゾーンマスタファイルの +エンコーディングはエンコーディング・正規化方式の決定で +決定したエンコーディングに合わせる必要があります。 +mdnconv はこのような目的のために設計されたコード変換ツールです。 + +
RACE や UTF-5 なら、ASCII 文字が編集できるエディタがあれば直接入力 +することも可能ですが、例えば「こんにちは.世界.」と入力する代わりに +bq--gbjzg23bn4.bq--3bhbm5km. +などといった暗号のような文字列を (しかも正確に) 入力しなければならず、 +変換ツールを使用するほうがはるかにに簡単です。 + +
UTF-8 ならばエディタによっては直接編集可能なものがあるので、それを +使うこともできます。しかしそのエディタも正規化までは多分してくれない +でしょうから、やはりツールでエンコーディング変換することをお勧めします。 + +
例えば次のようなコマンドを実行すると EUC-JP で書かれたゾーンマスタファイル +db.somezone.euc を RACE エンコーディングの db.somezone.race +に変換し、同時に Unicode Normalization Form C による正規化を適用する +ことができます。 + +
++ ++% mdnconv -noconf -in EUC-JP -out RACE -normalize unicode-form-c \ + db.foo.euc > db.foo.race ++
-in オプションで入力テキストのエンコーディングを、 +-out で出力テキストのエンコーディングを、 +そして -normalize で正規化方式を指定します。 +オプションの一覧とどのような値が指定できるかについては、 +mdnconv の仕様書をご覧ください。 + +
ではこの逆に RACE エンコーディングから EUC-JP への変換ができるかというと、 +RACE エンコーディングの場合には可能です。ただしこれは mdnconv が +RACE エンコーディング専用の特別な処理を備えているためで、 +一般的には ASCII 互換エンコーディングからローカルエンコーディングへの変換は +できないということを覚えておいてください。 +これは、入力された文字列の中で ASCII 互換エンコーディングを用いて +表記されている個所とそうでない通常の ASCII 表記の場所を区別できないからです。 +これについては mdnconv の仕様書の +変換処理の詳細を参照してください。 + +
以上のことから、ゾーンマスタファイル等 DNS サーバが読み込むファイル +の作成と管理には次のような方法をとるのがよいと考えられます。 +まずローカルエンコーディングを用いて記述した版を用意して、これに対して +編集やバージョン管理を行います。 +そして mdnconv を用いてエンコーディング変換と正規化を行い、 +DNS サーバの使用するエンコーディング版のファイルを生成して、これを +DNS サーバが読み込むためのファイルとして使用します。 + +
とはいってもローカルエンコーディング版のファイルを改訂するたびに +mdnconv を実行してサーバエンコーディング版のファイルを作るのは面倒です。 +この場合例えば make コマンドを使用すれば変換を自動化することができます。 + +
例えばローカルエンコーディング版のファイル名にサフィックス .lc、 +UTF-8 エンコーディング版にサフィックス .utf8、 +RACE エンコーディング版にサフィックス .race をつけるとします。 +すると次のような Makefile を書くことにより、ローカルエンコーディング版を +更新したら make を実行するだけで変換を自動的に行うことができます。 + +
++ ++.SUFFIXES: .lc .utf8 .race + +.lc.utf8: + mdnconv -in $(LOCALCODE) -out UTF-8 $(NORMALIZE) $< > $@ +.lc.race: + mdnconv -in $(LOCALCODE) -out RACE $(NORMALIZE) $< > $@ + +LOCALCODE = EUC-JP +NORMALIZE = -normalize unicode-form-c -normalize unicode-lowercase + +TARGETS = db.foo.utf8 db.bar.race + +all: $(TARGETS) ++
1つの DNS サーバに異なるエンコーディングの複数のゾーンのマスタを +させようとした場合、named.conf に複数のエンコーディングを +混在させなくてはならない状況になることがあります。残念ながらこれは +mdnconv では無理なので、include ディレクティブ等を使って +ファイルを分割し、1つのファイルに複数のエンコーディングが +混在しないようにしてください。 + +
最後にもう1つ、UTF-5 特有の問題について説明します。 + +
+ +
DNS サーバで使用するドメイン名のエンコーディングを UTF-5 にした場合には +いくつかの問題が生じます。 + +
+ +UTF-5 は ASCII 互換エンコーディングの一つなので、UTF-5 でエンコードされた +ドメイン名はそのままでは従来の ASCII のドメイン名と区別できません。 +同じく ASCII 互換エンコーディングの一つである RACE では、ドメイン名の +各ラベルの先頭に特定のプリフィックス (bq--) をつけることによって +従来のドメイン名と (一応) 識別できるのですが、 +UTF-5 にはこのような機構がないため、ZLD という概念を使用して従来のドメイン +名との識別を可能にしています。 + +
ZLD (zero level domain) とはドメイン名の最後につける +トップレベルドメインのことで、例えば utf5. という +トップレベルドメインを作り、 +UTF-5 エンコーディングのドメイン名はすべてこのドメインのサブドメインとする +ことで、従来のドメイン名との区別を可能にします。実際には このトップレベル +ドメインはローカルエンコーディングから UTF-5 エンコーディングへの変換を行う +場所 (現在の mDNkit では dnsproxy) で自動的に付加され、また UTF-5 から +ローカルエンコーディングに戻すときに自動的に除去されるので +アプリケーションにはこのドメインは見えません。アプリケーションにとっての +トップレベルドメインよりさらに上位ドメインに位置するので zero level domain +なわけです。もちろん DNS サーバからは ZLD は隠されておらず、したがって +DNS サーバの設定では ZLD を意識しなければなりません。 + +
さて、このように UTF-5 エンコーディングでは ZLD が必須ですが、 +mdnconv によるローカルエンコーディングから UTF-5 エンコーディングへの変換 +の際には、ドメイン名の ZLD の部分とそうでない部分を明確に区別する +必要があります。例えば www.ニック.日本.utf5. というドメイン名を +UTF-5 に変換すると N7N7N7.J0CBJ0C3J0AF.M5E5M72C.utf5 となります +(ただし ZLD は utf5. だとします)。先頭の www は +UTF-5 に変換しますが、ZLD 部分は変換しません。このため mdnconv は +ZLD がなんであるかをあらかじめ知っておく必要があります。このために +-zld というオプションが用意されています。 +このオプションは、ゾーンマスタファイル等に書かれたドメイン名が +指定された ZLD にマッチした時に、マッチした部分を出力エンコーディングへの +変換対象から外すという働きをします。ただしドメイン名と ZLD がマッチするのは +
++ ++www.ニック.日本.utf5. +www.ニック.日本 +utf5.ニック.日本. ++
さらに mdnconv の -auto オプション +を併用するとある程度 ZLD を自動付加させることができ、 +この場合ゾーンマスタファイルにいちいち ZLD を書く必要がなくなります。 +ただし確実に付加できるわけではないので、このオプションには頼らない方が +よいでしょう。 + +
+ +
mdnconv は、デフォルトでは非 ASCII 文字を1文字以上含むドメイン名のみを +出力エンコーディングに変換します。つまり ASCII のみからなるドメイン名は +変換しません。これは従来の ASCII ドメイン名と多言語ドメイン名を混在させた +時に、ASCII ドメイン名までが UTF-5 などに変換されてしまうのを防ぐための +処置です。 + +
ところが多言語ドメイン名の中に ASCII 文字のみから構成されるラベルが +ある場合、それが単独でゾーンマスタファイルに出現するとこの処置のために +そのラベルが UTF-5 に変換されないという問題が生じます。 +例えばドメイン名 www.ニック.日本.utf5. の A レコードを +ゾーンマスタファイルに記述するときに、次のように書いてしまうと +www の部分が UTF-5 に変換されません。 + +
++ ++$ORIGIN ニック.日本.utf5. +... +www IN A 10.9.8.7 ++
このような場合、FQDN で記述するなどして、非 ASCII 文字が含まれる +ようにしてやる必要があります。 + + + diff --git a/contrib/idn/mdnkit/doc/ja/guide/clientconfig.html b/contrib/idn/mdnkit/doc/ja/guide/clientconfig.html new file mode 100644 index 0000000000..0cdd40d2f0 --- /dev/null +++ b/contrib/idn/mdnkit/doc/ja/guide/clientconfig.html @@ -0,0 +1,130 @@ + + + +
++DNS Proxy Server (dnsproxy) は、基本的には +多言語ドメイン名に対応していないクライアントから +多言語化対応したDNSサーバを利用できるようにするものです。 +
+ある手法の多言語ドメイン名に対応しているクライアントから +他の手法で多言語化対応したDNSサーバを利用するためにも使用できます。 ++
+実際にあるクライアントで多言語ドメイン名を使うことができるかどうかは、 +そのクライアントがドメイン名をどのように扱うかによります。 +クライアントが、ドメイン名を、クライアント側のエンコーディングで +なにもチェック/加工しないで使用しているなら、 +dnsproxyを経由することによって、多言語ドメイン名が利用可能になります。 +しかし、クライアント側でドメイン名のシンタックスを厳密にチェックしていたり、 +ある種の変換を行なっているような場合には、dnsproxyは役に立ちません。 +
+ここでは、いくつかの代表的なクライアントについて、 +dnsproxyによる多言語ドメイン名が使うことができるかどうか、 +どうすれば多言語ドメイン名を使うことができるようになるか、 +を説明します。 +
+ +
+ +
+UNIXの場合、DNSへの要求は、多くの場合resolverを経由して送られます。 +しかし、標準的なresolverはnon-ASCIIのドメイン名を受付けません。 +この問題に対処するため、mDNkitにはbin8のresolver +(およびnslookup、named)を8-bit throughにするためのパッチが +付属しています。まずは、bind8にこのパッチを適用し、 +8-bit throughのresolverを使って再リンクしてください。 +詳しくはインストールガイドの +前準備、 +bind 用パッチの適用とインストールを +ご覧ください。 +
+ +
+標準的なnslookupはnon-ASCIIのドメイン名を受付けません。 +mDNkitのbind8への8-bit throughパッチを適用して作成された +nslookupなら、多言語ドメイン名を使用することが可能になります。 +詳しくはインストールガイドの +前準備、 +bind 用パッチの適用とインストールを +ご覧ください。 + +
+Squid経由でWebにアクセスするような場合には、non-ASCII文字を含む +ドメイン名はsquidによってエラーとされます。 +mDNkitにはsquidを8-bit through にする +(シンタックスチェックを外す)パッチが含まれています。 +これを適用したsquidであれば、多言語ドメイン名を受付けるようになります。 +詳しくはインストールガイドの +前準備、 +squid 用パッチの適用とインストールを +ご覧ください。 + +
+残念ながら、入力時点でnon-ASCII文字は拒否されてしまいます。 +
+ +
+Windowsのresolver(WINSOCK)は、non-ASCIIのドメイン名を通すようです。 +クライアント内でのチェック、変換が行なわれなければ問題なく +多言語ドメイン名を使うことができます。通常は +
+ client-translation . Shift_JIS ++とすればOKです。 +
+ +
+残念ながら、ホスト名の入力時点で、non-ASCII文字を含むホスト名は +拒否されるようです。ls による一覧表示は動作します。 + +
+Version 4.7 は問題なく動作しました。 +
+ただ、HTTPプロキシサーバを使われている場合には、その +プロキシサーバが多言語ドメイン名に対応しているかどうかが +問題になりますのでご注意ください。 +
+ +
+IEには多言語ドメイン名への対応が一部含まれています。 +
+ ツール + インターネットオプション + いつもUTF-8としてURLを送信する ++しかし、これを使うと、余分なところまでUTF-8で +エンコードしてしまうようで、dnsproxyでは使用できません。 +逆に、これをオフにして、 +
+ client-translation . Shift_JIS ++とすれば、dnsproxy経由で多言語ドメイン名が使えるようになります。 +
+ですが、IEの場合には、webページ内に埋め込まれたURLについては、 +そのページのエンコーディングに合わせたエンコーディングに変換して +DNSの問合せを行なうようになっていますので、Shift_JIS以外で +記述されたWebページ上の多言語ドメイン名についてはクエリーが +失敗してしまいます。 + + + diff --git a/contrib/idn/mdnkit/doc/ja/guide/dnsproxy.html b/contrib/idn/mdnkit/doc/ja/guide/dnsproxy.html new file mode 100644 index 0000000000..d05a9ed9f3 --- /dev/null +++ b/contrib/idn/mdnkit/doc/ja/guide/dnsproxy.html @@ -0,0 +1,122 @@ + + + + +
+dnsproxy は文字通り DNS のプロキシサーバとして動作する +プログラムです。クライアントと本物の DNS サーバの間で両者の間の +通信データ (DNS プロトコルメッセージ) の変換を行います。 + +
クライアントからローカルエンコードされた多言語ドメイン名を含む +DNS要求を受け取ると、DNSメッセージ中のドメイン名を +多言語化対応したDNS サーバが受付けられる標準エンコーディングに変換し、 +DNS サーバに送出します。 +エンコーディングの変換と同時に正規化も行います。 +また逆に DNS サーバからの応答メッセージを受信すると、その中に +含まれる多言語ドメイン名をクライアント側で認識できるローカル +エンコーディングに変換し、クライアントに返します。 + +
dnsproxy はこのようなメカニズムによって一般のクライアントが +多言語ドメイン名を扱うことを可能にします。 + +
具体的には、 +
+ +
dnsproxy を使用するには、専用のコンフィギュレーションファイルで +使用するエンコーディングや正規化の方法を設定しておく必要があります。 +このファイルの設定方法については +DNS Proxy Server のコンフィギュレーション +をご覧ください。 + +
+ +
dnsproxy を使用するためにはあらかじめ設定が必要です。 +DNS Proxy Server のコンフィギュレーション +をご覧ください。 + +
dnsproxy は以下のコマンド行オプションを受け付けます。 +
dnsproxy は、エンコーディング変換や正規化の機能を持たない +一般のクライアントが多言語ドメイン名を扱うことを可能にします。 +クライアントではローカルコードで記述されたドメイン名を、 +そのまま多言語ドメイン名として使うことができるようになります。 + +
しかしそれにはクライアントがドメイン名に対して独自のチェックや変換を +行なっていなければ、という前提条件があります。 +問題はこの点にあり、 +クライアントによっては、ドメイン名のシンタックスを厳密にチェックしていたり、 +独自の手法で部分的に多言語化していたりするものがあります。 +このようなクライアントであれば、dnsproxyを使っても +多言語ドメイン名を使うことはできません。 + +
UNIXの場合は、DNSへの要求は通常リゾルバライブラリを経由して送られますが、 +既存のリゾルバはドメイン名のシンタックスをチェックしていて、 +ドメイン名にnon-ASCIIコードが含まれているとエラーとして +はじかれてしまいます。 +この問題に対処するために、mDNkitには、bind8付属のリゾルバライブラリを +8ビット透過にするためのパッチが付属しています。このパッチを適用した +リゾルバライブラリを組み込めば、クライアントからのローカルコードによる +多言語ドメイン名がdnsproxyに渡されて、多言語化DNSサーバと組み合わせて +使用することができるようになります。 +Windowsの場合には、リゾルバ(WINSOCK)は8ビット透過になっていますので、 +この問題はありません。 + +
残る問題は、アプリケーションでのチェックや変換ですが、 +これは対象となるクライアントが多数ありますし、また、 +ソースが公開されていないものについては手の出しようがありませんので、 +基本的には、mDNkitには含まれていません。しかし、 +DNSのチェックに多用されるnslookup(in bind8)と、 +汎用のproxyとして使用されることの多いsquidについては、 +ドメイン名のチェックを外すためのパッチが含まれています。 + +
dnsproxy を使用してどのようなアプリケーションが多言語ドメイン名を +扱えるようになるのかをまとめた +文書を用意してありますので、 +こちらをご覧ください。 + + + \ No newline at end of file diff --git a/contrib/idn/mdnkit/doc/ja/guide/guide.html b/contrib/idn/mdnkit/doc/ja/guide/guide.html new file mode 100644 index 0000000000..9be7bcd579 --- /dev/null +++ b/contrib/idn/mdnkit/doc/ja/guide/guide.html @@ -0,0 +1,320 @@ + + + +
++mDNkitのガイドは以下のドキュメントから構成されています。 +
+一般ユーザの方はまずmDNkitの紹介をご覧ください。 +そのあと、使用する多言語ドメイン処理方式 (あなたのシステムで +利用できる処理方式についてはシステム管理者にお尋ねください) に応じて +bind9 パッチ、 +runmdn、 +mDN Wrapper、 +dnsproxy のいずれかをご覧ください。 + +
+本キットをインストールするシステム管理者の方はすべてのガイドに +一通り目を通しておくことをお勧めします。 + +
+本キットはフリーソフトウェアです。本キットの使用、再配布等に関する +条件については LICENSE.txt を +ご覧ください。 + +
+mDNkitは、既存のDNSサーバ(bind8/9)、既存のクライアントで、 +多言語ドメイン名を使うために提案されている各種の方式を試験的に +評価してみることができるようにするための +パッチ、ツール、ライブラリをまとめたものです。 +
+従来、ドメイン名には、英字、数字(およびハイフン)しか使えませんでした。 +多言語化されたドメイン名とは、ドメイン名としてこれらに加えて日本語など +いろいろな言語の文字を使えるようにしたものです。 +その実現方式として、現在インターネットドラフトでいくつかの +提案がなされています。(参考文献 参照) +
+ +
+DNS で多言語ドメイン名を使えるようにするには、まず DNS サーバ間で +多言語ドメイン名として使用する標準エンコーディング (コードセット) を +決める必要があります。 +現在提案されている方式は、いずれもISO10646 をベースとした +エンコーディングで、大きく次の2つに分けられます。 +
+1. の方法は、エンコード結果が従来のドメイン名としても使える文字列になるので、 +多言語ドメイン名を既存のDNSが受付けることができる文字列で +表現することができます。この場合、DNSサーバ自体は +既存のものがそのまま使えます。 +
+2.の方法では、DNS サーバをそのエンコーディングに対応するように +改造する必要があります。 +
+いずれの方式に関しても、DNS サーバの持つドメイン名のデータはあらかじめ +そのエンコーディングで用意する必要があります。 +
+一方、アプリケーションは一般的には SJIS 等のローカルエンコーディングを +使用するので、多言語ドメイン名を使えるようにするためにはどこかで +エンコーディングの相互変換をする必要があります。 +
+つまりアプリケーションは多言語ドメイン名をローカルエンコーディングで +扱い、DNS サーバは標準エンコーディングで扱うので、 +クライアントと DNS サーバの間のどこかでアプリケーションの指定した +ローカルエンコーディングのドメイン名を標準エンコーディングのドメイン名へ +変換し、 +また DNS サーバからの応答に含まれる標準エンコーディングのドメイン名を +クライアントで表示可能なローカルエンコーディングに戻さなければなりません。 +
+このためには次の3種類の方法が考えられます。 +
+ +
+ +
++ +ただし b. の方式は DNS サーバに不必要に複雑な機構を持ち込むこと、負 +荷を高めることなどの問題があり好ましくないため、本キットでは a. と +c. の2通りの方法を提供します。 +
+mDNkitは、既存のDNSサーバ、クライアントを、最小限の改造で +複数の方式の多言語ドメイン名を +実際に試してみることができるようにするものです。 +
+ +
多言語ドメイン名を扱うためには、エンコーディング変換の他にも重要な +機能があります。それはドメイン名の正規化です。 + +
すでに述べたように、DNS サーバ間で使用されるドメイン名のエンコーディング +として提案されている方式はいずれも ISO10646 をベースとしていますが、 +ISO10646 では見かけ上全く同一の文字を表す方法が複数ある場合があります。 +このような文字に対してその表現方法を1つに統一しないと、ユーザが +正しい (と思える) ドメイン名を入力したにも関わらず、名前解決ができない +という不都合が生じることになります。 + +
また、従来の ASCII ドメイン名では、ドメイン名のマッチングの際に大文字と +小文字は同一視されていました。これをそのまま多言語ドメイン名にも適用する +ことは、マッチングの処理効率などの点で問題があり、あらかじめすべて小文字 +あるいは大文字に統一するのがより効率的だと考えられます。 + +
このようにドメイン名をあらかじめ設定した基準にしたがって標準形に変換するのが +正規化です。基本的には正規化はエンコーディング変換と同時に行われるので、 +エンコーディング変換と同じく +
多言語ドメイン名を扱う方法のあるべき姿は、クライアント側の +リゾルバライブラリなどにエンコーディングの変換や正規化の機能を +持たせることによって、DNS プロトコルにはローカルエンコーディングの +データを一切載せないことだと考えられます。 +この処理方法を実現するために mDNkit ではいくつかの方式を提供しています。 + +
+++
+ +
+++
+ +
++ ++
runmdn コマンドと mDN Wrapper は、既存のアプリケーションを変更せずに +多言語ドメイン名の機能を付加しようとするものですが、実際にはいくつかの +制限事項があり、どのようなアプリケーションにも適用できるものではありません。 +詳しくはそれぞれの解説をご覧ください。 + +
また bind9 パッチといえども、例えばアプリケーションが独自に +ドメイン名の文字チェックを実行して英数字とハイフン以外の文字を含む +ドメイン名をエラーにしていたりする場合には無力です。 + +
すでに述べたように、エンコーディング変換や正規化は +クライアント側で実行するのが理想的だと考えられますが、 +実際問題としてソースが公開されていないためそのような改良のできない +クライアントや、特殊なリゾルバを持っていて runmdn が適用できないクライアントが +存在します。 + +
そこで mDNkit では、クライアントからローカルエンコードされた +多言語ドメイン名を含むDNS要求を受け取り、多言語化対応した +DNS サーバが受付けられる標準エンコーディングのドメイン名に変換し、 +また逆に DNS サーバからの応答の多言語ドメイン名を +クライアント側で認識できる形式に戻す DNS proxy サーバを +用意しました。 + +
dnsproxyを使うと、 +クライアント側がドメイン名のチェックや変換を +行なっていなければ、クライアント側のローカルコードで記述された +ドメイン名を、そのまま多言語ドメイン名として使うことができる +ようになります。 +
++ ++
+ +
+DNS サーバ側のゾーンマスタファイルや named.conf ファイル上のドメイン名は、 +あらかじめ、規定されたエンコーディングに変換されている必要があります +(前述の理由により +DNS サーバに変換機能を持たせる方法はここでは考えません)。 +
+mDNkitでは、管理者はこれらのファイルをローカルエンコーディングで +作成して必要に応じて変換して使うものと想定し、 +ローカルエンコーディングから +多言語ドメイン名で必要とするエンコーディングへの +変換ツールmdnconvを提供します。 + +
++ ++
| 注: | ++ ローカルエンコーディングで記述されたゾーンマスタ + ファイルを多言語エンコーディングへ変換することはできますが、 + 多言語エンコーディングによっては逆変換が + できないことがあります。 + これは、エンコーディングによってはそのエンコーディングで + エンコードされた文字列と通常の ASCII 文字列が + 区別できず、ファイルのどの部分を逆変換すべきか判定できない + ものがあるためです。 + しかし、DNSの管理のためには、 + 逆方向の変換も必要になると思いますので、一部のエンコーディングに + 対しては逆変換をサポートしています。 + | +
+ +
+DNS サーバの使用するエンコーディングによっては、 +DNSサーバ自体がドメイン名を8ビット透過で扱うことを +要求するものもあります。 +このようなエンコーディングへの対処のために +mDNkitにはbind8を8ビット透過にするためのパッチが +含まれています。このパッチはbind8に含まれている +nslookup、resolverについても8ビット透過にします。 + +
bind9 の DNS サーバは本来8ビット透過になっていますが、 +ドメイン名を内部形式からテキスト形式に変換する際、8ビット文字を +`\DDD' という表現に変換してしまうので、これを抑制して UTF-8 文字は +そのまま透過するようにする機能が bind9 パッチには含まれています。 + +
+ +
mDNkit のコンパイルおよびインストール方法について解説します。 +ここではソースからのインストール方法について説明します。 +バイナリパッケージの配布も予定されていますが、 +それらのインストール方法に関してはそれぞれのパッケージを参照してください。 + +
本ドキュメントでは Unix 用のコンパイルとインストール方法について +説明します。Windows 用の mDN Wrapper のインストール +方法に関しては mDN Wrapper のセットアップの +項をご覧ください。 + +
ソース配布からのインストール手順はおよそ次のようになります。 + +
インストールの後は、DNS サーバの設定 +および mDNkit リゾルバのコンフィギュレーション +、さらに dnsproxy を使用する場合には +DNS Proxy Server のコンフィギュレーション +を参照して設定を行ってください。 + +
ソース配布に含まれているパッチを適用する場合には、 +それぞれ次の手順にしたがってください。 +
+ +mDNkit は EUC や SJIS など様々なローカルエンコーディングで記述された +ドメイン名のエンコーディングを変換するために、汎用のコードセット変換 +ユーティリティである iconv() を使用します。 +そこで、FreeBSD など iconv() が標準で組み込まれていないシステムでは、 +mDNkit のインストールに先立って iconv() をインストール +しなければなりません。また、mDNkit は iconv() が +UTF-8 エンコーディングをサポートしていることを要求します。システム付属の +iconv() が UTF-8 をサポートしていない場合にはやはり +外部のパッケージをインストールする必要があります。 + +
iconv() のフリーな実装としては、例えば libiconv +
+があり、ソースを上記のページから入手することができます。 +これは LGPL に基づいたフリーソフトウェアで、多くの Unix 系 OS の +もとで動作します。このパッケージのインストール方法については、上記ページか、 +あるいはソース配布に含まれる INSTALL.generic ファイルをご覧ください。 + +
+ +
mDNkit は bind9 に対するパッチを提供しており、これによって +多言語ドメイン名を扱うことのできる bind9 のリゾルバおよびサーバを +作成することができます。本キットに含まれるパッチは BIND 9.0.0 に +対するものです。ソースは以下の場所からダウンロードすることができます。 + +
++ +
dnsproxy を利用してクライアントアプリケーションが +多言語ドメイン名を使用できるようにするためには、 +名前解決を行うリゾルバライブラリを 8bit スルーにする必要があります。 +また DNS サーバでも、多言語ドメイン名のエンコーディングとして + ASCII 互換エンコーディングである UTF-5 や RACE 以外の、 +例えば UTF-8 などのエンコーディングを使用するためには、 +8bit スルーの DNS サーバを使用する必要があります。 + +
mDNkit にはこのために +BIND 8.2.2-P7 および BIND 8.2.3-T6B を 8bit スルーにする +パッチが含まれています。パッチを適用した bind8 を使用したい場合には +あらかじめいずれかのバージョンのソースを用意してください。 +ソースは以下の場所からダウンロードすることができます。 + +
+ ++ +
Web のキャッシュサーバである Squid は、そのままでは多言語 +ドメイン名が入力されるとそれをエラーにしてしまい、使用することができません。 +このためmDNkit には +Squid-2.3.STABLE3 を +8bit スルーにするパッチが含まれています。Squid を多言語ドメイン名で使用 +したい場合にはこのソースも用意してください。 + +
+ +
mDNkit に関する最新情報は以下の場所から入手可能で、 +最新の配布ソースのダウンロードもできます。 +
+ +入手した mDNkit の配布ソースを展開します。 +配布ソースのファイル名を mdnkit-X.Y.tar.gzとすると +次のようにして展開できます。 + +
++ ++% gunzip mdnkit-X.Y.tar.gz +% tar -xf mdnkit-X.Y.tar ++
展開すると、mdnkit-X.Yというディレクトリが作られますので、 +そこに移動してください。 +
++ ++% cd mdnkit-X.Y ++
以降の説明では、このディレクトリを $MDNTOP という名前で +参照します。環境変数 $MDNTOP を設定しておくと便利でしょう。 +
++ ++% setenv MDNTOP `pwd` (csh 系のシェルの場合) +% MDNTOP=`pwd`; export MDNTOP (sh 系のシェルの場合) ++
+ +
まず mDNkit の本体である、 +
のコンパイルを実行します。 + +
まず、mDNkit のトップディレクトリ +($MDNTOP の指すディレクトリ) に移動し、 +configure スクリプトを実行します。 +configure はヘッダファイルやライブラリの有無など、システム毎の +特徴を調べ、コンパイル環境を適切に設定するためのツールです。 + +
++ ++% cd $MDNTOP +% ./configure ++
システムに iconv() が組み込まれていて、かつコンパイル時に +特別なオプションを使用しないなら上記のようになにも引数を指定せずに +実行すればよいのですが、そうではない場合、オプションや環境変数で +configure の動作を変えることができます。 + +
configure に指定できるオプションの中で mDNkit に +直接関係するものは以下の通りです。 + +
例えば前準備に挙げた + iconv のパッケージをインストールした場合、デフォルトでは + /usr/local/lib の libiconv にインストールされるので、 +
++ と指定すればよいでしょう。libiconv が共有ライブラリの時には、 + -R オプションも指定して ++--with-iconv="-L/usr/local/lib -liconv" ++
+++--with-iconv="-L/usr/local/lib -R/usr/local/lib -liconv" ++
とする必要があるかもしれません。 +
+ +
+ +
+ +
+ +
+ +
なお、ZLD 機能のサポートの有無は dnsproxy や runmdn が設定ファイルを + 読み込む際の振る舞い (ZLD の指定を無視するかどうか) に影響します。 + mDNkit が提供するライブラリ自体は、 + (設定ファイルを読み込むための一部のモジュールを除いて) + このオプションによって動作が変わることはなく、常に ZLD の処理を + 行うようになっています。 +
+ +
+ +
+ +
+ +
+ +
+ +
この他にも configure にはいろいろなオプションを指定することが +できます。 +
+++% ./configure --help ++
で指定可能なオプションの一覧を表示させることができます。 + +
また、関係する環境変数は次の通りです。 + +
+++% setenv CFLAGS -I/usr/local/include ++
また sh 系のシェルの場合には +
+++% CFLAGS=-I/usr/local/include; export CFLAGS ++
とします。 +
CFLAGS はこの他にも C コンパイラの最適化オプションを + 指定するためにも使えます。CFLAGS に -O を指定すれば + 最適化ありでコンパイルされます。 + +
configure を実行することにより、あなたのシステム環境に合わせて +調整された Makefile その他のファイルが生成されます。 + +
+ +
configure 実行によって、システム環境に +合った Makefile が生成されているので、コンパイルはトップディレクトリ +($MDNTOP の指すディレクトリ) で +make コマンドを実行するだけです。 + +
++ ++% make ++
+ +
コンパイルが終了したら、実行ファイルなどのインストールを行います。 +インストールの前にスーパーユーザになってください。 + +
++ ++% su ++
あとは make install を実行すれば、必要なファイルが +システムにインストールされます。 + +
++ ++# make install ++
インストールされるファイルは以下の通りです。 + +
dnsproxy は、デフォルトでは /usr/local/sbin に + インストールされます。 + インストール先を変えるには + configure の --sysconfdir + オプションを使用します。 +
mdnconv および runmdn は、 + デフォルトでは /usr/local/bin にインストールされます。 + インストール先を変えるには + configure の --bindir + オプションを使用します。 +
+ +
デフォルトでは /usr/local/man/man8 (dnsproxy.8)、 + /usr/local/man/man1 (mdnconv.1、runmdn.1)、 + /usr/local/man/man5 (mdnres.conf.5) + にそれぞれインストールされます。 + インストール先を変えるには、configure の + --mandir オプションを使用します。 +
+ +
このファイルの設定方法に関しては + DNS Proxy Server のコンフィギュレーション + を参照してください。 +
このファイルの設定方法に関しては + mDNkit リゾルバのコンフィギュレーション + を参照してください。 +
いずれもデフォルトでは /usr/local/etc にインストールされます。 + インストール先を変えるには、configure の + --sysconfdir オプションを使用します。 +
+ +
いずれのライブラリもデフォルトでは /usr/local/lib に + インストールされます。 + インストール先を変えるには + configure の --libdir + オプションを使用します。 +
+ +
+ +
展開したソースの中の +$MDNTOP/patch/bind9/bind-9.0.0-patch が +BIND 9.0.0 に多言語ドメイン名の処理機能を付加するパッチです。 +パッチの当て方はこのファイルの先頭にも書いてありますが、簡単に紹介すると、 +次のようになります。 + +
+++% cd /somewhere/.../bind-9.0.0 ++
+++% patch -p0 < $MDNTOP/patch/bind9/bind-9.0.0-patch ++
パッチを当てると、トップディレクトリに README.mdnkit という +ファイルが作られます。コンパイルの前にこのファイルを読んでください。 + +
そのあとコンパイルとインストールを行います。方法は README.mdnkit +に書かれています。このファイルにも書かれていますが、 +configure コマンドの実行時に +--with-mdn オプションをつけることを忘れないでください。 +このオプションをつけないと多言語ドメイン名の処理機能は付加されません。 +
++ ++% ./configure --with-mdn ++
bind9 用のパッチは mDNkit の本体 (特にライブラリとヘッダファイル) がすでに +インストールされていることを前提としています。したがって、この作業は +mDNkit 本体のインストール終了後に実行してください。 + +
+ +
展開したソースの中の +$MDNTOP/patch/bind8/bind-8.2.2-P7-patch が +BIND 8.2.2-P7 に対する 8ビットスルーパッチ、また +$MDNTOP/patch/bind8/bind-8.2.3-T6B-patch が +BIND 8.2.3-T6B に対する 8ビットスルーパッチです。 +パッチの当て方はこれらのファイルの先頭にも書いてありますが、簡単に紹介すると、 +次のようになります。 + +
+++% cd /somewhere/.../bind-8.2.2-P7 ++
+++% patch -p0 < $MDNTOP/patch/bind8/bind-8.2.2-P7-patch ++
パッチを当てたら、あとは通常の BIND のインストール方法にしたがって +コンパイルとインストールを行ってください。インストール方法は BIND の +ソース中の src/INSTALL に書かれています。 + +
bind8 用のパッチは BIND を単に 8ビットスルーにするだけで、mDNkit の +ライブラリ等は使用しません。したがって mDNkit 本体とは独立にコンパイルおよび +インストールすることができます。 +
+ +
展開したソースの中の $MDNTOP/patch/squid/squid-2.3.STABLE3-patch が +Squid 2.3.STABLE3 に対する 8ビットスルーパッチです。 +パッチの当て方はこのファイルの先頭にも書いてありますが、簡単に紹介すると、 +次のようになります。 + +
+++% cd /somewhere/.../squid-2.3.STABLE3 ++
+++% patch -p1 < $MDNTOP/patch/squid/squid-2.3.STABLE3-patch ++
パッチを当てたら、あとは通常の Squid のインストール方法にしたがって +コンパイルとインストールを行ってください。インストール方法は +Squid のソースに含まれる INSTALL ファイルに書かれています。 + +
Squid 用のパッチも bind8 用のパッチと同様単に 8ビットスルーにするだけで、 +mDNkit のライブラリ等は使用しません。 +したがって mDNkit 本体とは独立にコンパイルおよび +インストールすることができます。 + + + diff --git a/contrib/idn/mdnkit/doc/ja/guide/proxyconfig.html b/contrib/idn/mdnkit/doc/ja/guide/proxyconfig.html new file mode 100644 index 0000000000..15938c464d --- /dev/null +++ b/contrib/idn/mdnkit/doc/ja/guide/proxyconfig.html @@ -0,0 +1,332 @@ + + + +
++DNS Proxy Server dnsproxyを使うには、 +いくつかの情報を設定する必要があります。 +ここでは、これらの情報の設定方法と意味とを説明します。 +
+設定情報はコンフィギュレーションファイルに記載されます。 +コンフィギュレーションファイルは、 +dnsproxyの起動時にコマンドラインで指示することができます。 +
++コマンドラインで指示しなかった場合には +デフォルトのコンフィギュレーションファイルが使用されます。 +デフォルトのコンフィギュレーションファイルは、ディレクトリ ++% dnsproxy -config <config-file> ++
+ /usr/local/etc ++の下の +
+ dnsproxy.conf ++です。ディレクトリは、mDNkit作成時に +
+ configure --sysconfdir=DIR ++で指示することもできます。 +詳しくは、インストールガイドの +configure 実行の +ところをご覧ください。 + +
+コンフィギュレーションファイルはテキストファイルで、 +以下のコンフィギュレーションデータを指定します。 + +
+dnsproxyがクライアントからの要求を受付ける +ネットワークアドレス、ポート番号を指定します。 +
+ listen <address> ++<address>は以下のいずれかの形式で指示します。 +
++省略された場合には ++
++ <IP address>:<port number> + :<port number> + <IP address>
++が使用されます。 ++
++ IP address 0.0.0.0 # INADDR_ANY + port number 53
+dnsproxy経由でDNSサーバを使用するクライアントは、 +ここで指示したアドレス、ポートをDNSサーバとして設定します。 +クライアント側ではポート番号を変更できないものが多いので +ポート番号はデフォルトの53をそのまま使った方がよいでしょう。 +
+ +
+dnsproxyが、DNS要求を転送し、応答を受け取る本来のDNSサーバの +ネットワークアドレス、ポート番号を指定します。 +
+ forward <address> [ bind4compat ] ++<address>の形式は上のlistenのものと同じです。 +
+オプションの bind4compatが指示された場合には、 +UDPでリクエストを転送する時に、ソースアドレスとして、 +listenで指示されたアドレス/ポートを使用します。 +これはbind4にある機能で、UDPポートについての +アクセス制限下で運用することを想定したものです。 +このオプションが指示されなかった場合には、 +1024以上のソースポートが使用されます。 +
+ +
+dnsproxyが実行ログを出力するファイル名を指定します。 +
+ log-file <path> ++ログファイル名は、 +以下のコマンドラインオプションで指定することもできます。 +両方指定した場合にはコマンドラインオプションの指定のほうが優先されます。 +
+ dnsproxy -logfile <address> ++指定されなかった場合には、 +
+ /tmp/dnsproxy.log ++に書き込まれます。 +
+なお、実行ログは常に追記されていきますので、 +適当な時を見計らって消すことをお勧めします。 +
+また、dnsproxy にハングアップシグナル (SIGHUP) を送ると +いったんログファイルを閉じて、再度オープンするようになっています。 +ログファイルをアーカイブする場合に便利な機能です。 +
+ +
+ログのレベルを設定します。 +
+ log-level <level> ++レベルとして指定できる値は次の通りです。 +
+++
+- none
- 一切ログを記録しません。ログがないと不具合が生じた場合の +原因解明が難しくなりますので、できればこのレベルは指定しないでください。 +
- fatal
- 致命的なエラーが生じたときにのみログを出力します。 +
- warn
- 警告メッセージにもログに記録します。これがログレベルを +指定しなかったときのデフォルトです。 +
- trace
- 実行トレースメッセージもログに出力します。 +このレベルを指定すると dnsproxy の動作がかなり詳細に記録されるので +障害が発生した場合の原因究明には便利ですが、大量のログが出力されるので +普段は指定しない方がよいでしょう。 +
+ +
+クライアント側でのドメイン名のエンコーディングを指示します。 +
+ client-translation <ZLD> <Encoding> ++多言語ドメイン名に対応していないクライアントの場合には、 +通常、クライアントのローカルエンコーディングになっています。 +そのような場合には +
+ client-translation . Shift_JIS ++という形で、<ZLD>無しで指示します。 +
+多言語ドメイン名の手法によっては、 +クライアント側で多言語ドメイン名を通常のDNSでも +受付けられる形式にエンコードして、それを通常のドメイン名と +区別するために ZLD (Zero Level Domain) を付加するものがあります。 +そのような場合には、付加されるZLDとその時のドメイン名の +エンコーディング方法とを対応付けることにより、 +他の多言語ドメイン名手法のDNSサーバを利用することが +できるようになります。 +
+ client-translation .i-dns.net UTF-5 ++クライアント側のドメイン名のエンコーディングは、 +ZLD が異なっていれば、複数指定することができます。 +
+なお、mDNkit のデフォルトの設定では ZLD の指定はできないように +なっています。ZLD を使用するためには、mDNkit のコンパイルの際、 +configure コマンドに +--enable-zld +を指定する必要があります。 +この指定をせずに mDNkit をコンパイルした場合には、ZLD の指定は +すべて無視されます。 +
+クライアントから送られてきたDNS要求のドメイン名は、 +ここで指示したエンコーディングから、内部的に使用される +UTF-8エンコーディングに変換されます。 +そして、後述の正規化、サーバ側エンコーディングへの変換が +行なわれてDNSサーバに送出されます。また、DNSサーバからの +応答は、逆に元のエンコデーィングに戻されてクライアントに +返されます。 +
+ここで指定可能なエンコーディング名は、mDNkit付属のlibmdnおよび +使用するiconv ライブラリに依存します。 +iconv ライブラリによって、エンコーディング名が異なっている +ことがありますので、ライブラリのマニュアルをご覧になって +使用可能なエンコーディング名を確認してください。 +付属のlibmdnでは、iconvが提供するエンコーディングの他に、 +多言語化DNS用に提案されている +
++をサポートしています。 ++
++ UTF-5 +draft-jseng-utf5-01.txt ++ RACE +draft-ietf-idn-race-02.txt ++ BRACE +draft-ietf-idn-brace-00.txt ++ LACE +draft-ietf-idn-lace-00.txt +
+ +
DNS サーバから返されたドメイン名がクライアントのローカルエンコーディングに +変換できない文字を含んでいた場合に、ローカルエンコーディングの代わりに使用する +エンコーディングを指定します。 +
+ alternate-encoding <Encoding> ++指定するエンコーディングは必ず「ASCII互換エンコーディング (ACE)」と呼ばれる、 +変換結果が従来のドメイン名として使用可能な文字 (英数字およびハイフン) だけ +からなるエンコーディングでなければなりません。たとえば ASCII 互換 +エンコーディングの一つである RACE を指定する場合には次のように指定します。 +
+ alternate-encoding RACE ++
+ +
+ドメイン名の正規化手法を指定します。 +
+ normalize <scheme> ... ++正規化手法は複数指定可能で、左側から順に適用されていきます。 +
+クライアントから送られてきたDNS要求のドメイン名は、 +内部的に使用されるUTF-8エンコーディングに変換された上で、 +ここで指示した正規化が適用されます。 +使用可能な正規化手法はmDNkitに含まれるlibmdnに依存しています。 +どのような正規化手法があるかは、 +libmdnのマニュアルの +normalizer モジュール +に記載されています。 +
+ +
+DNSサーバ側のドメイン名エンコーディング方法を指示します。 +
+ server-translation <ZLD> <Encoding> ++ZLDが不要なエンコーディングであれば、省略値として'.'を指示します。 +
+ server-translation . UTF-8 ++ZLDを必要するエンコーディングでは、ZLDとエンコーディング名の +両方を指定します。 +
+ server-translation .i-dns.net UTF-5 ++指定可能なエンコーディングは、前出のclient-translationでの +ものと同じです。 +
+ +
dnsproxy が動作するユーザを指定します。 +
+ user-id <user> ++
通常、dnsproxy は特権ポートを使用するためルート権限で起動させる必要が +ありますが、ルート権限のままで動作させるのはセキュリティ上好ましくありません。 +この指定により、dnsproxy は特権ポートを作成したあとサービスを開始する前に +指定したユーザの権限で動くようになります。 +
<user> にはユーザ名あるいはユーザ ID 番号を指定することができます。 +
+ +
dnsproxy が動作するグループを指定します。 +
+ group-id <user> ++これは user-id エントリと似ていますが、ユーザの代わりにグループを +指定する点が異なります。 +
<group> にはグループ名あるいはグループ ID 番号を指定することが +できます。 +
+ +
dnsproxy が動作する際のルートディレクトリを指定します。 +
+ root-directory <path> ++
これもセキュリティ対策の一つです。dnsproxy が動作する際のルートディレクトリ +を指定することで、そのディレクトリの外にはアクセスできないようにします。 +この指定により、dnsproxy はサービスを開始する前に、chroot() +システムコールを用いて指定したディレクトリをルートディレクトリとして +設定します。 +
<path> にはルートとして設定したいディレクトリ名を指定します。 + +
多言語ドメイン名の方式の提案、関連 RFC、 +ソフトウェア等、mDNkit に関連する参考文献の +リストです。 + +
JPNIC の多言語ドメイン名に関する技術解説のページにある + +関連資料も合わせてご覧ください。 + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
mDNkit が提供するツール、コマンドのうち、dnsproxy 以外のもの、 +つまり runmdn と mdnconv は共通の設定ファイルを参照します。 +また bind9 パッチも同じ設定ファイルを参照します。 + +
このファイルには mDNkit を利用したクライアントあるいはリゾルバが +必要とするいくつかの情報を設定する必要があります。 +例えば正規化の方式や DNS プロトコル上で用いられるドメイン名のエンコーディング +方法などをこのファイルで指定します。 +ここでは、これらの情報の設定方法と意味とを説明します。 + +
また、アプリケーションの使用するローカルエンコーディングは +アプリケーションの動作するロケール情報から取得します。これについても +合わせて説明します。 + +
+mDNkit の設定は、コンフィギュレーションファイルによって行われます。 +mDNkit をデフォルトの設定でコンパイルした場合には、 +このコンフィギュレーションファイルのパス名は +
++となります。ディレクトリ部分、つまり /usr/local/etc は +mDNkit の設定時にオプションで +変更が可能です。 + ++/usr/local/etc/mdnres.conf ++
mDNkit をインストールすると、このファイルのサンプルファイルが +
++(デフォルトの設定の場合) にインストールされます。このサンプルファイルには +設定項目とその説明が書かれていますので、コンフィギュレーションファイル +作成の参考にしてください。 + ++/usr/local/etc/mdnres.conf.sample ++
+ +
+コンフィギュレーションファイルは通常のテキストファイルで、 +以下のコンフィギュレーションデータを指定します。 + +
+server-encoding encoding ++encoding にエンコーディング名を指定します。 + +
++ +なお、アプリケーション側のローカルエンコーディングはロケールによって +決まるので、client-encoding というエントリはありません。 +ローカルエンコーディングに関しては後述します。 ++
+- [設定例] +
- +
+server-encoding RACE +server-encoding UTF-8 ++
+ +
+server-zld ZLD ++ZLD で使用する ZLD を指定します。 + +
+++
+- [設定例] +
- +
+server-zld zld.to.be.used ++
+ +
+normalize scheme... ++scheme で正規化の方式の名称を指定します。 + +
正規化の方式として以下のものが指定できます。 + +
++ ++
++ ascii-lowercase +ASCII の大文字を小文字に正規化 + ascii-uppercase +ASCII の小文字を大文字に正規化 + unicode-lowercase +Unicode の大文字を小文字に正規化 + unicode-uppercase +Unicode の小文字を大文字に正規化 + unicode-form-c +Unicode normalization form C + unicode-form-kc +Unicode normalization form KC + ja-kana-fullwidth +半角カナ文字を全角カナ文字に正規化 + ja-alnum-halfwidth +全角英数字およびマイナス記号を半角文字に正規化 + ja-compose-voiced-sound +全角ひらがなカタカナとそれに続く濁点半濁点を1文字にまとめる正規化 + ja-minus-hack +全角マイナス記号をハイフン ('-') に正規化 + ja-delimiter-hack +全角ピリオドおよび句点を半角のピリオド ('.') に正規化
++ ++
+- [設定例] +
- +
+normalize unicode-lowercase unicode-form-kc ++
+alternate-encoding encoding ++encoding に代替エンコーディングの名称を指定します。 + +
+代替エンコーディングは、 +ASCII 互換エンコーディングでなくてはなりません。 +
+ +
++ ++
+- [設定例] +
- +
+alternate-encoding RACE ++
+alias-file path ++path に定義ファイルのパス名を指定します。 + +
++ +別名の定義ファイルは通常のテキストファイルであり、1行に1つずつ +別名を定義します。各行の形式は次の通りです。 ++
+- [設定例] +
- +
+alias-file /some/where/mdnalias.txt ++
++エンコーディング名 <元の名前> の代わりに <別名> が +使えるようになります。 + ++<別名> <元の名前> ++
+ローカルエンコーディングについては、ロケールから推測して自動判定するため、 +コンフィギュレーションファイルでは、 +ローカルエンコーディングを設定するエントリはありません。 + +
+ただし、以下のようなケースのときには自動判定ができません。 + +
+このような場合には環境変数 MDN_LOCAL_CODESET を設定することで、 +ローカルエンコーディングの設定を行うことができます。 +例えばローカルエンコーディングを EUC-JP に設定する場合には、 +あらかじめ次のような設定をしておきます。 + +
++ ++
+- [設定例] +
- +
+
+- sh 系のとき +
- +
+$ MDN_LOCAL_CODESET=EUC-JP +$ export MDN_LOCAL_CODESET ++- csh 系のとき +
- +
+% setenv MDN_LOCAL_CODESET EUC-JP ++
指定する値はローカルエンコーディング名で、これはシステムの +iconv() 関数 (より正確には iconv_open()) が +受け付ける名前で指定します。この名前は iconv の実装によって +それぞれ異なりますので、具体的な値については iconv の +ドキュメントを参照してください。 + +
もしあなたが単一のローカルエンコーディングしか使用していないのであれば、 +このような設定を .profile や .cshrc 等に入れておくことを +お勧めします。 + + + diff --git a/contrib/idn/mdnkit/doc/ja/guide/runmdn.html b/contrib/idn/mdnkit/doc/ja/guide/runmdn.html new file mode 100644 index 0000000000..8fa4584e1c --- /dev/null +++ b/contrib/idn/mdnkit/doc/ja/guide/runmdn.html @@ -0,0 +1,111 @@ + + + + +
+runmdn は bind4 あるいは bind8 をベースとした +リゾルバライブラリを持つ Unix クライアントを、 +再コンパイルなしに多言語ドメイン名を扱えるようにするためのコマンドです。 +具体的には、名前解決用の API (例えば gethostbyname) が +アプリケーションのローカルエンコーディング (EUC-JP 等) で表現された +ホスト名を受け付けるようになります。またこれらの API が多言語ホスト名を +ローカルエンコーディングで返すようになります。 + +
runmdn を使用してクライアントが多言語ドメイン名を扱えるように +する方法は、mDNkit が提供する方法の中で最も手間がかからず簡単なものですが、 +システムによっては使用できなかったり、コマンドによっては効果がなかったり +します。これらの制限に関しては制限事項の項を +ご覧ください。 + +
+ +
runmdn を使用するには、mDNkit のクライアント共通設定ファイル +で使用するエンコーディングや正規化の方法を設定しておく必要があります。 +このファイルの設定方法については +mDNkit リゾルバのコンフィギュレーションを +ご覧ください。 + +
また、runmdn はアプリケーションのローカルエンコーディングを自動的に +推測しますが、推測に失敗する場合もあります。そのような場合の対処方法は +ローカルエンコーディングについてをご覧ください。 + +
+ +
runmdn の使い方は極めて簡単で、アプリケーションの起動コマンドの +先頭にコマンド名 runmdn をつけるだけです。 + +
++ ++% runmdn コマンド [引数...] ++
例えば telnet コマンドを使用してホスト「私の会社.jp」に +接続するには次のようにします。 + +
++ ++% runmdn telnet 私の会社.jp ++
runmdn は、mDNkit が提供している方法の中で最も手軽にクライアントが +多言語ドメインを扱えるようにするものですが、どのようなクライアントにも +適用できるわけではありません。 + +
runmdn はシステムの持つ共有ライブラリの動的リンク機構 +(ライブラリのプリロード機能) を利用し、 +クライアントアプリケーションの実行時に、アプリケーションにリンクされている +リゾルバライブラリの一部の関数を多言語ドメイン名を扱う機能を持たせた +バージョンのものと置き換えてしまうことによって多言語ドメイン名の処理を +実現します。置き換える関数は bind4 および bind8 をベースとするリゾルバ +が内部で使用している関数です。 + +
したがって runmdn が動作するには次のようないくつかの制限があります。 +
これらの制限により runmdn が使用できない場合は、mDNkit が提供する他の +方法 (dnsproxy や bind9 パッチ など) をご利用ください。 + + + diff --git a/contrib/idn/mdnkit/doc/ja/guide/wrapper.html b/contrib/idn/mdnkit/doc/ja/guide/wrapper.html new file mode 100644 index 0000000000..f2e78db6e2 --- /dev/null +++ b/contrib/idn/mdnkit/doc/ja/guide/wrapper.html @@ -0,0 +1,412 @@ + + + + +
++ +
+Windows で多言語ドメイン名を扱えるようにするためには、 +Windows 上のクライアントアプリケーションにおいて、 +解決しようとする名前のエンコーディングを、 +DNS サーバが受付ける形式のものに変換する必要があります。 +これは、Windows 上のアプリケーションが、 +きちんと多言語ドメイン名を扱えるようになっていなければならない、 +ということであり、本来はそれぞれのプログラムの作成者が行なうべきことです。 +
+しかし、標準が決まっていない現状では、 +プログラム作成者にこのような対応を期待するのは無理なので、 +既存のアプリケーションを多言語ドメイン名対応させるための +トリックが必要になります。 +mDNkitに含まれるdnsproxyサーバはそのための一つの方法です。 +ここでは、もう一つの方法、mDN Wrapper を提示します。 +
+Windows において、多くの場合、ドメイン名解決の要求はWINSOCK DLL +に渡されます。そこで、WINSOCK DLL を多言語ドメイン名対応のものに置き +換えてやれば、既存のプログラムからでも多言語ドメイン名を使うことがで +きるようになります。 +
+ +
+*注意* +もし古いバージョンの mDN Wrapper がすでにインストールされているマシンに +新しいバージョンをインストールする場合には、まず +バージョンアップ時の注意をご覧ください。 +
+mDN Wrapper をインストールするには"setup.exe" を実行します。 +セットアッププログラムは次のような処理を行います。 +
+
+
+
+
+
+
| PerProg\<progname>\Where | REG_DWORD | 変換位置 | +
| PerProg\<progname>\Encoding | REG_SZ | エンコーディング名 | +
+エンコーディング名は通常コンフィギュレーションプログラムによって設定されます。 +変換位置の指定は、標準インストールでは不要です。 +システムディレクトリへのインストールを行なった場合には、 +レジストリエディタで環境に合わせて設定する必要があります。 +
+
+
+アンインストールするには、コントロールパネルの「アプリケーションの追 +加と削除」で、「mDN Wrapper」を選択して削除(「追加と削除」ボタン) +します。 +
+ +
+コンフィギュレーションプログラムは、 +アプリケーションを特定して mDN Wrapper を適用したり、 +適用を解除するためのツールです。 +
+起動すると以下のような画面が表示されます。 +
+
++リストボックスには、その時点で mDN Wrapper が適用されているプログラムが +表示されます。 +最初に実行した場合には空になっています。右側のボタンを押すことにより、 +操作を行うことができます。 + +
+
++最初に、mDN Wrapper を適用したいプログラムの実行ファイル名を設定します。 +直接入力するか、ブラウズボタンでファイルを探してください。 +
+
++次にそのプログラムのローカルエンコーディングを指定します。 +通常は「Default」 でかまいません。 +プログラムが国際化エンコーディングに従っている場合にのみ +「UTF-8」 を指示します。 +
+
++最後に "Wrap" ボタンを押せば、そのプログラムに対して +指定されたエンコーディングで mDN Wrapper が適用されます。 +適用されたプログラムは、最初のウィンドウのリストボックスに反映されます。 +
+
++
++mDN Wrapper の適用が解除されると、そのプログラムは最初のウィンドウの +リストボックスからも削除されます。 +
+
++"Unwrap All" ボタンを押すことによって、 +現在適用されているすべてのプログラムに対して mDN Wrapper の適用を +解除することもできます。 + +
+
++ログレベルは次の中から選ぶことができます。 +
+ログファイルを指定することも可能です。デフォルトでは mDN Wrapper を +インストールしたディレクトリの "mdn_wrapper.log" になっています。 +"Browse.." ボタンを押せばブラウズ用のダイアログを利用して選択することが +できます。 + +
+また、このダイアログではログファイルの内容を見ることと、ログファイルを +削除することが可能です。それぞれ "View"、"Delete" ボタンを押してください。 +"View" ボタンを押すとメモ帳が起動して、ログファイルの内容を表示します。 + +
+"OK" ボタンを押すとダイアログの設定が有効になります。設定を変えたくない +場合には "Cancel" ボタンを押してください。 + +
+
++ダイアログ最上部のパネルでプログラムに対する mDN Wrapper の適用モードを +指定することができます。選択できる値とその意味は次の通りです。 +
+中段のパネルでは正規化の方式を設定することができます。左側のリストボックスに +使用する正規化の名称が入っており、右側のリストボックスには使用可能な +正規化の名称が入っています。右側のリストボックスから追加したい正規化を +選択し、"Add" ボタンを押すと左側のリストボックスに追加されます。 +また、左側のリストボックスで削除したい正規化を選択して "Remove" ボタンを +押せば削除することができます。"Clear" ボタンを押すとすべての正規化が +削除され、また "Reset" ボタンによりデフォルトの設定に戻すことができます。 + +
+3段目のパネルでは DNS サーバ側のエンコーディング名を指定することができます。 +デフォルトは "RACE" ですが、他のエンコーディングを使用したい場合には +ここで指定してください。 + +
+以上の設定は "OK" ボタンを押すことにより有効になります。設定を変えずに +ダイアログを終了したい場合には "Cancel" ボタンを押してください。 + +
+ +
+ラッパーDLL は、元のWINSOCK のDLL のバージョンに強く依存します。 +これは、非公開のエントリも含めて +すべてのエントリを提供する必要があるためです。 +このためWINSOCK DLL のバージョンが変わると、 +mDN Wrapper が動作しなくなる可能性があります。 +
+今回作成されたmDN Wrapper は、 +
++で動作を確認しています。ただ、将来にわたって動作する保証はありません。 ++
++ WinNT4.0 SP6a (WINSOCK 1.1 + 2.0) + Win98 (WINSOCK 1.1 + 2.0) + Win95 OSR2 (WINSOCK 1.1)
+
+Windows では、DNS だけではなく、 +WINSやLMHOSTS によってもドメイン名、ホスト名の解決が行なわれます。 +mDN Wrapper を使った場合には、ドメイン名の変換が、 +これらの方式へのディスパッチを行なう場所よりも上位層で行なわれるので、 +これらのすべての方式について、 +ドメイン名、ホスト名の変換が行なわれることになります。 +このため、Windows が、WINSやLMHOSTS を使っている場合には、 +予期しない問題が発生する可能性があります。 +これについては、mDN Wrapper を使う場合には、 +名前解決にDNS だけを使用することをお勧めします。 +
+
+WINSOCK 2.0 の名前解決API +
++は、ドメイン名以外でも使用できる、 +汎用の名前解決用のAPI として定義されています。 +現時点では、これらはもっぱらドメイン名の解決で使用されていますが、 +他の名前(例えばサービス名)の解決にも使用できることになっています。 ++
++ WSALookupServiceBeginW + WSALookupServiceNextW + WSALookupServiceEnd
+mDN Wrapper は、名前の対象の如何にかかわらず、 +名前のエンコーディングを変換してしまうので、 +これらのAPI が、ドメイン名以外の解決に使われている場合には、 +問題を引き起こす可能性があります。 +
+
+アプリケーションによっては、 +ドメイン名の解決にこれらのAPI を使用しないものもあります。 +例えば、'nslookup'は、これらのAPI を使用しないで、 +直接DNS サーバと通信してしまいます。 +このようなアプリケーションについては、 +mDN Wrapper は役に立ちません。 +
+
+アプリケーションによっては、標準のDLL サーチパスに従わないで、 +特定のパスのDLL にバインドされているものがあります。 +よく使われるプログラムの中では、Netscape Communicator がそうなっています。 +このようなプログラムについては、 +標準のインストール/コンフィギュレーションでは mDN Wrapper を適用することは +できません。 +
+このようなプログラムについて、どうしても mDN Wrapper を適用する必要があるなら、 +システムディレクトリへのインストールを行なうことができます。 +ただし、このインストールは大変危険で、 +場合によってはシステムを再起動不能にしてしまう可能性もあります。 +
+
+これらの制限事項が問題になる場合には、 +代替手段として'dnsproxy'を使うこともできます。 +これは、DNS サーバとのトランザクションを中継するので、 +上で問題になったようなことを回避することができます。 +
+ただし、'dnsproxy'は、ラッパーよりも複雑な設定が必要ですし、 +また、呼び元のプログラムを特定することができませんので、 +プログラム固有のローカルエンコーディングを取り扱うことはできません。 +しかし、上記の制限事項が問題になるようなケースでは、 +ラッパーの代わりに使用するといいかもしれません。 +
古いバージョンの mDN Wrapper がすでにインストールされているマシンに +新しいバージョンをインストールする際には、次のことに気をつけてください。 + +
+
mDNkit のドキュメントは以下のような3部構成となっています。 + +
+
+
mDNkit ユーザーズガイドおよび mDNkit 仕様書の内容は +mDNkit バージョン 1.2 に対応しています。 + +
関連するドキュメントおよび関連ソフトウェアなどへのポインタをまとめた +参考文献のページもご覧ください。 + +
本キットに関するコメントは +idn-cmt@nic.ad.jp +に、またバグレポートは +mdnkit-bugs@nic.ad.jp +にそれぞれお送りください。 + + + diff --git a/contrib/idn/mdnkit/doc/ja/spec/bind9.html b/contrib/idn/mdnkit/doc/ja/spec/bind9.html new file mode 100644 index 0000000000..8c7908b9a4 --- /dev/null +++ b/contrib/idn/mdnkit/doc/ja/spec/bind9.html @@ -0,0 +1,476 @@ + + + + +
++mDNkit に含まれる BIND-9 用のパッチファイルを適用することにより、 +BIND-9 において従来の ASCII 文字によるドメイン名に加え、 +非 ASCII 文字による多言語ドメイン名を扱うことが可能になります。 + +
+具体的には、このパッチは BIND-9 に次のような機能を追加します。 +
+BIND-9 へのパッチの適用方法は、パッチファイルの先頭に記載してあります。 +なおパッチファイルについては、 +対応する BIND のバージョンをよく確認してから、使用してください。 + +
+ +
BIND-9 はそれまでの BIND-8 とはリゾルバの構成が全く異なっています。 +BIND-8 まではリゾルバはアプリケーションにリンクされるライブラリとして +実装されていましたが、 +BIND-9 ではリゾルバの機能の大部分が +lwresd (lightweight resolver daemon) というサーバに移され、 +アプリケーションにリンクされるのはlightweight resolver と呼ばれる +lwresd との通信を行うためのライブラリとなっています。 + +
本パッチはこのアーキテクチャに合わせ、多言語ドメイン名の各処理を +それぞれのコンポーネントに分散させました。以下に各コンポーネントで +実装される機能とコンポーネント間のインタフェースで用いるエンコーディングを +表した図を示します。 + +
++ ++
named における修正は次の一点のみです。 + +
BIND-9 の named ではドメイン名の処理はほとんど8ビットスルーになっており、 +UTF-8 等の MSB のセットされたバイトもそのまま透過します。 +しかし named 内で処理に使用されているドメイン名の内部表現 (dns_name_t) +からテキスト表現への変換部分は8ビットスルーになっておらず、ASCII 文字以外 +はバックスラッシュでクォートされ、\DDD という形式の表現に +変換されてしまいます。 +DNS プロトコル上で用いられるエンコーディングが RACE などの ASCII 互換 +エンコーディングであれば ASCII 以外の文字がドメイン名に現れることはないので +問題ないのですが、UTF-8 を使用する場合には問題となります。 + +
BIND-9 パッチは、この処理を修正し、変換しようとする文字がUTF-8 文字の +場合にはバックスラッシュによるクォートをしないようにします。 +この動作は named の設定ファイル (named.conf) で切り替え可能であり、 +設定ファイルの options セクションの allow-utf8 パラメータで +指定します。DNS プロトコル上で用いるエンコーディングとして UTF-8 を +使用する際には次のように記述してください。 +
+
+options {
+ ...
+ allow-utf8 yes;
+ ...
+};
+
+
+
+lwresd に対しては次のような修正を加えてあります。 + +
これは named に対する修正と同じで、ドメイン名を内部表現から +テキスト表現に変換する際のバックスラッシュによるクォーティングを +行わないようにするものです。 + +
named の場合、これは設定ファイル named.conf のオプションで +切り替えられるようになっていますが、lwresd の場合には自動切り替えに +なっています。lwresd が読み込む +クライアント設定ファイルの +サーバエンコーディングエントリに設定されているコードセット名を参照し、 +それが ASCII 互換エンコーディングでない場合にはバックスラッシュによる +クォートをしないようにします。 + +
lwresd は多言語ドメイン名のエンコーディングとして、クライアント +つまり lightweight resolver ライブラリとの間の通信には UTF-8 を、 +また named との通信には DNS プロトコル上のエンコーディングをそれぞれ +使用します。したがって両者の間のエンコーディング変換を行います。 + +
エンコーディング変換には MDN ライブラリの +res モジュール を使用しています。 +DNS プロトコル上のエンコーディングの指定は +クライアント設定ファイルで行います。 + +
+ +
クライアント側のライブラリは、 +
名前解決用の API 関数はローカルエンコーディングで表された +多言語ドメイン名が扱えるように修正されています。 +また内部実装は、将来 UTF-8 エンコーディングのドメイン名を扱える +API の追加が容易にできるように設計されています。これらについて +この後説明します。 + +
+ ++ +
+パッチによって多言語化される API 関数の一覧です。 + +
+多言語化された API 関数は、従来の ASCII ドメイン名に加え、 +非 ASCII ドメイン名を扱うことができます。非 ASCII ドメイン名として、 +クライアント設定ファイルの内容に応じて、 +新たに以下のようなドメイン名を取り扱うことができるようになります。 + +
+引数の型や返り値の型に変更はありません。 +パッチを当てる前と同様の呼び出し方法で、従来の ASCII ドメイン名と、 +非 ASCII ドメイン名の両方を扱うことができます。 +非 ASCII ドメイン名については、 +ローカルエンコーディングのドメイン名を引数として受け取ることができます。 + +
+これまで上記の API 関数で行なわれていた処理は、 +以降で説明するそれぞれの内部関数に移行し、API +関数は、ドメイン名のエンコーディング情報をこの内部関数に渡す役割をしています。 + +
+ +
+多言語化された API 関数に関連して、以下の内部関数が追加されました。 + +
+追加された内部関数についての仕様は、以下の通りです。 + +
+int +lwres_getaddrinfo_enc(const char *, const char *, const struct addrinfo *, + struct addrinfo **, int) ++
+lwres ライブラリの関数 lwres_getaddrinfo() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_getaddrinfo() との違いは、static 関数である set_order() +関数にエンコードタイプの判定フラグを渡している点のみです。 +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_getaddrinfo() 関数から lwres_getaddrinfo_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+返される値は +EAI_NONAME、EAI_BADFLAGS、EAI_SYSTEM、 +EAI_FAMILY、EAI_SOCKTYPE、EAI_SERVICE、 +EAI_MEMORY、0 +のいずれかです。 +
+ +
+int +lwres_getnameinfo_enc(const struct sockaddr *, size_t, char *, size_t, char *, + size_t, int, int) ++
+lwres ライブラリの関数 lwres_getnameinfo() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_getnameinfo() との違いは、lwres_getnamebyaddr() 関数の呼び出し部を +lwres_getnamebyaddr_enc() 関数に変更している点のみです。 +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_getnameinfo() 関数から lwres_getnameinfo_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+返される値は +ENI_NOSOCKET、ENI_SALEN、ENI_FAMILY、 +ENI_MEMORY、ENI_SYSTEM、ENI_NOHOSTNAME、 +SUCCESS +のいずれかです。 +
+ +
+struct hostent * +lwres_gethostbyname_enc(const char *, int) ++
+lwres ライブラリの関数 lwres_gethostbyname() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_gethostbyname() との違いは、lwres_getipnodebyname() +関数の呼び出し部を lwres_getipnodebyname_enc() 関数に変更している点のみです。 +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_gethostbyname() 関数から lwres_gethostbyname_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+lwres_getipnodebyname_enc() から返って来た hostent +構造体へのポインタを返します。 +
+ +
+struct hostent * +lwres_gethostbyname2_enc(const char *, int, int) ++
+lwres ライブラリの関数 lwres_gethostbyname2() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_gethostbyname2() との違いは、lwres_getipnodebyname() +関数の呼び出し部を lwres_getipnodebyname_enc() 関数に変更している点のみです。 +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_gethostbyname2() 関数から +lwres_gethostbyname2_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+lwres_getipnodebyname_enc() から返って来た hostent +構造体へのポインタを返します。 +
+ +
+struct hostent * +lwres_gethostbyname_r_enc(const char *, struct hostent *, char *, + int, int *, int) ++
+lwres ライブラリの関数 lwres_gethostbyname_r() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_gethostbyname_r() との違いは、lwres_getipnodebyname() +関数の呼び出し部を lwres_getipnodebyname_enc() 関数に変更している点のみです。 +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_gethostbyname_r() 関数から +lwres_gethostbyname_r_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+エラーのときは NULL、正常のときは値が格納された hostent +構造体へのポインタを返します。 +
+ +
+struct hostent * +lwres_gethostbyaddr_enc(const char *, int, int, int) ++
+lwres ライブラリの関数 lwres_gethostbyaddr() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_gethostbyaddr() との違いは、lwres_getipnodebyaddr() +関数の呼び出し部を lwres_getipnodebyaddr_enc() 関数に変更している点のみです。 +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_gethostbyaddr() 関数から lwres_gethostbyaddr_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+lwres_getipnodebyaddr_enc() から返って来た hostent +構造体へのポインタを返します。 +
+ +
+struct hostent * +lwres_gethostbyaddr_r_enc(const char *, int, int, struct hostent *, + char *, int, int *, int) ++
+lwres ライブラリの関数 lwres_gethostbyaddr_r() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_gethostbyaddr_r() との違いは、lwres_getipnodebyaddr() +関数の呼び出し部を lwres_getipnodebyaddr_enc() 関数に変更している点のみです。 +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_gethostbyaddr_r() 関数から +lwres_gethostbyaddr_r_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+エラーのときは NULL、正常のときは値が格納された hostent +構造体へのポインタを返します。 +
+ +
+struct hostent * +lwres_getipnodebyname_enc(const char *, int, int, int *, int) ++
+lwres ライブラリの関数 lwres_getipnodebyname() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_getipnodebyname() との違いは、lwres_getaddrsbyname() +関数の呼び出し部を lwres_getaddrsbyname_enc() 関数に変更している点のみです。 +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_getipnodebyname() 関数から +lwres_getipnodebyname_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+エラーのときは NULL、正常のときは値が格納された hostent +構造体へのポインタを返します。 +
+ +
+struct hostent * +lwres_getipnodebyaddr_enc(const void *, size_t, int, int *, int) ++
+lwres ライブラリの関数 lwres_getipnodebyaddr() に、 +ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 +lwres_getipnodebyaddr() との違いは、lwres_getnamebyaddr() +関数の呼び出し部を lwres_getnamebyaddr_enc() 関数に変更している点のみです。 +
+関数の最後の引数がエンコードタイプの判定フラグで、 +ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 +UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 +lwres_getipnodebyaddr() 関数から +lwres_getipnodebyaddr_enc() 関数を呼び出すときは、 +エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。 +
+エラーのときは NULL、正常のときは値が格納された hostent +構造体へのポインタを返します。 + +
BIND-9 には DNS の問い合わせツールとして dig、host、nslookup という +コマンドが付属します。mDNkit の BIND-9 パッチにより、これらはいずれも +多言語ドメイン名が扱えるようになります。具体的には以下の機能が +付加されます。 +
また DNS の返答に含まれる多言語ドメイン名をローカルエンコーディングに +変換し、表示します。 +
+
+クライアント設定ファイルは、多言語ドメイン名のための各種の設定が +記述されているファイルで、mDNkit を使用して多言語化 (国際化) +したクライアント側のリゾルバが読み込むファイルです。 +このファイルは MDN ライブラリの +resconf モジュール によって読み込まれ、 +多言語ドメインに関する以下のような設定ができます。 + +
+このファイルは通常のテキストファイルで、ファイルの各行 (# +で始まるコメント行と、空行を除いて) は、 +次のような単純なフォーマットで構成されます。 + +
++ ++キーワード 値... ++
+クライアント設定ファイルは、mDNkit をデフォルトの設定でコンパイルした +場合には以下に配置されます。 + +
++ ++/usr/local/etc/mdnres.conf ++
以降、各キーワードごとに設定内容を記述します。 +
+ +
+DNS プロトコル上の多言語ドメイン名のエンコーディングとして使用する +エンコーディング (コードセット名) を指定します。 + +
encoding には、使用するエンコーディング名を記述し、 +次のものが指定できます。 + +
+このエントリは必須エントリであり、必ず記述しなければなりません。 + +
+DNS プロトコル上で使用される多言語ドメイン名のエンコーディング +(server-encoding エントリで指定されたもの) +の中には、多言語ドメイン名と従来の ASCII ドメイン名とを区別するために +ZLD (zero-level domain) というドメインを必要とするものがあります。 +ZLD は通常のトップレベルドメインのさらに上位ドメインに相当します。 +ただしこれは DNS のシステム内部でのみ使われるドメインであり、 +一般ユーザやアプリケーションからは見えないようになっています。 + +
mDNkit のデフォルトの設定では、ZLD は使用できないようになっており、 +設定ファイル中にこのエントリがあると警告メッセージが表示されます。 +このエントリの指定を有効にするには、mDNkit の configure 実行時に +--enable-zld オプションによって ZLD サポートを有効にしておく +必要があります。 +
+ +
+正規化エントリでは、DNS サーバに送る前にドメイン名に適用すべき +正規化の方式を指定します。 + +
+scheme には、正規化形式を記述します。 +以下のものが記述できます。 + +
+正規化形式には複数の形式が指定可能です。複数の形式が指定された場合、 +順序通りに (左から右に) 適用されます。 +
+ +
+mDNkit で多言語化されたリゾルバライブラリは、 +アプリケーションが使用しているローカルコードセットを自動的に決定し、 +DNS の応答メッセージ中のドメイン名を、そのコードセットに変換しようとします。 +しかし、ドメイン名に使用されているある文字がローカルコードセットに +マップされていないために、変換に失敗することもあり得ます。 +例えば日本語コードセットを使用している日本語のアプリケーションが、 +日本語の文字セットに含まれていない中国語の文字を含んだ DNS +応答を受信したような時にこのようなことが起こります。 + +
+代替エンコーディングエントリは、上記のような問題が生じた時に +ローカルコードセットの代わりに使用するコードセットを指定します。 + +
+encoding はコードセット名で、RACE のような +ASCII 互換エンコーディング +を使用しなければなりません。 +
+ +
+エンコーディングエイリアスエントリでは、コードセット名のエイリアスを +記述したファイルのパス名を記述します。 + +
+pathname には、エイリアスファイルへのパス名を指定します。 +このエイリアスファイルは通常のテキストファイルで、 +以下のような形式の行から構成されます。 + +
++ ++alias-name name ++
+alias-name は定義されるエイリアス名で、name は +実際のコードセット名か、定義済のエイリアス名です。 +
+ +
+クライアント設定ファイルにはローカルコードセットを指定するエントリは +存在しません。 +ローカルコードセットはアプリケーションがそのときに使用している +ロケールの情報から決定されるからです。 +ですから、それぞれのアプリケーションがそれぞれ異なるローカルコードセットを +使用することができますし、同一アプリケーションが複数のローカルコードセットを +切り替えながら使用することも可能です。 + +
+mDNkit はロケール情報からアプリケーションの使用しているローカルコードセットを +推測しようとしますが、時には失敗することもあります。 +例えば、C ロケールで動作しているにも関わらず +非 ASCII コードセットを使用しているアプリケーションではロケール情報から +ローカルコードセットを判定することは不可能ですし、mDNkit が知らない +ロケールで動作するアプリケーションの場合にも推測に失敗するでしょう。 + +
+このような場合のために、環境変数 MDN_LOCAL_CODESET によって +アプリケーションのローカルコードセットを強制指定することができるように +なっています。 +この変数にコードセット名 (もしくはそのエイリアス名) +を指定すると、mDNkit はロケールの設定に関わらず、指定したコードセットを +ローカルコードセットとして動作します。 + +
+ +
+以下に、コンフィギュレーションファイルの記述例を示します。 + +
++ + + diff --git a/contrib/idn/mdnkit/doc/ja/spec/dnsproxy.html b/contrib/idn/mdnkit/doc/ja/spec/dnsproxy.html new file mode 100644 index 0000000000..a56a7ecbf5 --- /dev/null +++ b/contrib/idn/mdnkit/doc/ja/spec/dnsproxy.html @@ -0,0 +1,379 @@ + + + + + ++# +# a sample configuration. +# + +# DNS プロトコル上のエンコーディングとして RACE を使用する +server-encoding RACE + +# 正規化の手順として、小文字に変換した後、KC 正規化法を使用する +normalize unicode-lowercase unicode-form-kc + +# 代替エンコーディングとして RACE を使用する +alternate-encoding RACE ++
+ +
+dnsproxyは、クライアントからのローカルコードベースの多言語ドメイン名を +含むDNS要求を受け取り、多言語化対応したDNSが受付けられるドメイン名に +変換し、また逆に、DNSからの応答の多言語ドメイン名を、 +クライアント側で認識できる形式に戻します。 +
+これによって、クライアントは何も改造することなく +各種の多言語ドメイン名を使うことができるようになります。 +また、DNSサーバから見た場合には、クライアント+dnsproxyによって +多言語ドメイン名に対応したクライアントとして動作しているように +見えることになります。 +
+ただし、dnsproxy が正しく動作するには、クライアントのリゾルバライブラリが +ローカルエンコーディングのドメイン名をそのまま透過させ、エラーにならない +ようになっている必要があります。残念ながら現在 UNIX のリゾルバライブラリの +多くは 8ビットスルーではないので、そのままでは dnsproxy を用いても +多言語ドメイン名を扱えるようにはなりません。この場合には +
+++$ dnsproxy [オプション...] ++
+ +
+dnsproxyをデーモンとして起動します。 +
+ +
+コンフィギュレーションファイルを指示します。 +コマンドラインで指示しなかった場合には +デフォルトのコンフィギュレーションファイルが使用されます。 +詳しくはコンフィギュレーションの +項で説明します。 +
+ +
+dnsproxyが実行ログを出力するファイル名を指定します。 +特に指定されなかった場合には、コンフィギュレーションファイルで +指示されたログファイル、あるいはデフォルトのログファイルに +出力されます。 + +
+ +
+設定情報はコンフィギュレーションファイルに記載されます。 +コンフィギュレーションファイルは、 +dnsproxyの起動時にコマンドラインで指示することができます。 +
++コマンドラインで指示しなかった場合には +デフォルトのコンフィギュレーションファイルが使用されます。 +デフォルトのコンフィギュレーションファイルは、ディレクトリ ++% dnsproxy -config <config-file> ++
+ /usr/local/etc ++の下の +
+ dnsproxy.conf ++です。ディレクトリは、mDNkit作成時に +
+ configure --sysconfdir=DIR ++で指示することもできます。 +
+コンフィギュレーションファイルはテキストファイルで、 +以下のコンフィギュレーションデータを指定します。 + +
+dnsproxyがクライアントからの要求を受付ける +ネットワークアドレス、ポート番号を指定します。 +
+ listen <address> ++<address>は以下のいずれかの形式で指示します。 +
++省略された場合には ++
++ <IP address>:<port number> + :<port number> + <IP address>
++が使用されます。 ++
++ IP address 0.0.0.0 # INADDR_ANY + port number 53
+ +
+dnsproxyが、DNS要求を転送し、応答を受け取る本来のDNSサーバの +ネットワークアドレス、ポート番号を指定します。 +
+ forward <address> [ bind4compat ] ++<address>の形式は上のlistenのものと同じです。 +
+オプションの bind4compatが指示された場合には、 +UDPでリクエストを転送する時に、ソースアドレスとして、 +listenで指示されたアドレス/ポートを使用します。 +
+ +
+dnsproxyが実行ログを出力するファイル名を指定します。 +
+ log-file <path> ++ログファイル名は、 +以下のコマンドラインオプションで指定することもできます。 +両方指定した場合にはコマンドラインオプションの指定のほうが優先されます。 +
+ dnsproxy -logfile <address> ++指定されなかった場合には、 +
+ /tmp/dnsproxy.log ++に書き込まれます。 +
+ +
+ログのレベルを設定します。 +
+ log-level <level> ++レベルとして指定できる値は次の通りです。 +
+++
+- none
- 一切ログを記録しません。 +
- fatal
- 致命的なエラーのみ記録します。 +
- warn
- 警告メッセージも記録します +
- trace
- 実行トレースメッセージも記録します。 +
指定しなかった場合のデフォルトは warn です。 +
none を指定した場合、ログファイルは作成されません。 +
trace レベルを指定すると大量のログが出力されるので、短時間で +ログファイルが巨大になる可能性があります。注意してください。 +
+ +
+クライアント側でのドメイン名のエンコーディングを指示します。 +
+ client-translation <ZLD> <Encoding> ++多言語ドメイン名に対応していないクライアントの場合には、 +通常、クライアントのローカルエンコーディングになっています。 +そのような場合には +
+ client-translation . Shift_JIS ++という形で、<ZLD>無しで指示します。 +
+多言語ドメイン名の手法によっては、 +クライアント側で多言語ドメイン名を通常のDNSでも +受付けられる形式にエンコードして、それを通常のドメイン名と +区別するために ZLD (Zero Level Domain) を付加するものがあります。 +そのような場合には、付加されるZLDとその時のドメイン名の +エンコーディング方法とを対応付けることにより、 +他の多言語ドメイン名の手法のDNSサーバを利用することが +できるようになります。 +
+ client-translation .i-dns.net UTF-5 ++クライアント側のドメイン名のエンコーディングは、 +ZLD が異なっていれば、複数指定することができます。 +
+ただし、mDNkit のデフォルトの設定では ZLD の指定はできないように +なっています。ZLD を使用するためには、mDNkit のコンパイルの際、 +configure コマンドに +--enable-zld +を指定する必要があります。 +この指定をせずに mDNkit をコンパイルした場合には、ZLD の指定は +すべて無視されます。 +
+クライアントから送られてきたDNS要求のドメイン名は、 +ここで指示したエンコーディングから、内部的に使用される +UTF-8エンコーディングに変換されます。 +そして、後述の正規化、サーバ側エンコーディングへの変換が +行なわれてDNSサーバに送出されます。また、DNSサーバからの +応答は、逆に元のエンコデーィングに戻されてクライアントに +返されます。 +
+ここで指定可能なエンコーディング名は、mDNkit付属のlibmdnおよび +使用するiconv ライブラリに依存します。 +iconv ライブラリによって、エンコーディング名が異なっている +ことがありますので、ライブラリのマニュアルをご覧になって +使用可能なエンコーディング名を確認してください。 +付属のlibmdnでは、iconvが提供するエンコーディングの他に、 +多言語化DNS用に提案されている +
++をサポートしています。 ++
++ UTF-5 +draft-jseng-utf5-01.txt ++ RACE +draft-ietf-idn-race-02.txt ++ BRACE +draft-ietf-idn-brace-00.txt ++ LACE +draft-ietf-idn-lace-00.txt +
+
DNS サーバから返されたドメイン名がクライアントのローカルエンコーディングに +変換できない文字を含んでいた場合に、ローカルエンコーディングの代わりに使用する +エンコーディングを指定します。 +
+ alternate-encoding <Encoding> ++指定するエンコーディングは必ず「ASCII互換エンコーディング (ACE)」と呼ばれる、 +変換結果が従来のドメイン名として使用可能な文字 (英数字およびハイフン) だけ +からなるエンコーディングでなければなりません。たとえば ASCII 互換 +エンコーディングの一つである RACE を指定する場合には次のように指定します。 +
+ alternate-encoding RACE ++
+
+ドメイン名の正規化手法を指定します。 +
+ normalize <scheme> ... ++正規化手法は複数指定可能で、左側から順に適用されていきます。 +
+クライアントから送られてきたDNS要求のドメイン名は、 +内部的に使用されるUTF-8エンコーディングに変換された上で、 +ここで指示した正規化が適用されます。 +
+次に示す正規化手法を指定することができます。 +
+
それぞれの内容については +libmdnのマニュアルの +normalizer モジュール +を参照してください。 +
+ +
+DNSサーバ側のドメイン名エンコーディング方法を指示します。 +
+ server-translation <ZLD> <Encoding> ++ZLDが不要なエンコーディングであれば、<ZLD> の部分には +'.' を指示します。 +
+ server-translation . UTF-8 ++ZLDを必要するエンコーディングでは、ZLDとエンコーディング名の +両方を指定します。 +
+ server-translation .i-dns.net UTF-5 ++ZLD の指定を有効にするには、mDNkit のコンパイル時の設定が必要です。 +client-translationの項を +ご覧ください。 +
+指定可能なエンコーディングは、前出の +client-translation でのものと同じです。 +
+
dnsproxy が動作するユーザを指定します。 +
+ user-id <user> ++
通常、dnsproxy は特権ポートを使用するためルート権限で起動させる必要が +ありますが、ルート権限のままで動作させるのはセキュリティ上好ましくありません。 +この指定により、dnsproxy は特権ポートを作成したあとサービスを開始する前に +指定したユーザの権限で動くようになります。 +
<user> にはユーザ名あるいはユーザ ID 番号を指定することができます。 +
+
dnsproxy が動作するグループを指定します。 +
+ group-id <user> ++これは user-id エントリと似ていますが、ユーザの代わりにグループを +指定する点が異なります。 +
<group> にはグループ名あるいはグループ ID 番号を指定することが +できます。 +
+
dnsproxy が動作する際のルートディレクトリを指定します。 +
+ root-directory <path> ++
これもセキュリティ対策の一つです。dnsproxy が動作する際のルートディレクトリ +を指定することで、そのディレクトリの外にはアクセスできないようにします。 +この指定により、dnsproxy はサービスを開始する前に、chroot() +システムコールを用いて指定したディレクトリをルートディレクトリとして +設定します。 +
<path> にはルートとして設定したいディレクトリ名を指定します。 + +
+ +
dnsproxy に SIGHUP シグナルを送ると、ログファイルをいったん閉じ、 +再度オープンするという動作を行います。これは次のような手順で +ログをアーカイブできるようにするためです。 +
MDN ライブラリ (libmdn) は多言語ドメイン名の変換に関わる各種の処理を +実装するモジュールの集合です。このライブラリは以下のような機能を +提供します。 + +
文字列のエンコーディングを変換し、その結果を返します。 +MDN ライブラリの内部では、文字列はすべて UTF-8 エンコーディングであるとして +取り扱われます。そこで、このモジュールは +
エンコーディングは大きく分けて、次の2種類があります。 +
このモジュールでは前者のエンコーディング変換のために +iconv() ユーティリティを使用し、後者のエンコーディング変換のためには +独自の変換関数を実装して使用しています。 + +
+ +
与えられた文字列を正規化します。標準では次にあげる正規化をサポートします。 +
DNS プロキシサーバ (dnsproxy) では、クライアントから送られてきた DNS +メッセージに含まれるドメイン名に対してエンコーディング変換や正規化を行い、 +その結果を DNS サーバに送ります。このために以下の機能を提供します。 +
多言語ドメイン名を識別するために ZLD を必要とする方式のために、ZLD に +関する以下の機能を提供します。 +
アプリケーションプログラムが使用しているローカルエンコーディング +(コードセット) を自動判別します。判別は基本的にはアプリケーションのロケール +情報を利用しますが、環境変数で指定することも可能になっています。 + +
+ +
アプリケーションにリンクされるリゾルバライブラリでエンコーディング +変換や正規化を行う場合、使用するエンコーディングや正規化方式は +設定ファイルに記述されます。このファイルを読み込む機能を提供します。 + +
+ +
MDN ライブラリは以下のモジュールから構成されます。 + +
以下にモジュールの呼び出し関係図を示します。ただしほとんどすべての +モジュールから呼び出されている debug モジュールと log モジュール、また +共用関数を納めた util モジュールは +割愛してあります。 + +
++ ++
MDN ライブラリに含まれるすべてのモジュールについて、その仕様を記述 +します。 +まず各モジュールで共通に使用される、関数のリターン値について +説明したあと、モジュール毎に詳細を解説します。 + +
MDNライブラリのほとんど全てのAPI関数は、リターン値として +列挙型であるmdn_result_t 型の値を返します。値の一覧とその意味を +示します。 +
brace モジュールは、多言語ドメイン名のエンコーディング方式の一つとして +提案されている + +BRACE エンコーディング +とUTF-8との間の変換を行うモジュールです。このモジュールは +converter モジュールの +下位モジュールとして実装されており、 +アプリケーションがこのモジュールを直接呼び出すことはありません。 +converter モジュールに対して +BRACE エンコーディング +との変換を要求すると、このモジュールが間接的に呼び出されることになります。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn__brace_open(mdn_converter_t ctx, mdn_converter_dir_t dir) ++
BRACEエンコーディングとの変換をオープンします。実際には何もしません。 +
常に mdn_successを返します。 +
+ +
+mdn_result_t +mdn__brace_close(mdn_converter_t ctx, mdn_converter_dir_t dir) ++
BRACEエンコーディングとの変換をクローズします。実際には何もしません。 +
常に mdn_successを返します。 +
+ +
+mdn_result_t +mdn__brace_convert(mdn_converter_t ctx, mdn_converter_dir_t dir, + const char *from, char *to, size_t tolen) ++
BRACEエンコードされた文字列とUTF-8エンコードされた文字列の相互変換を +行います。 +入力文字列 from を変換し、結果を to と +tolen で指定される領域に書き込みます。 +dir がmdn_converter_l2uなら +BRACEエンコーディングからUTF-8エンコーディングへ、mdn_converter_u2l +ならUTF-8エンコーディングからBRACEエンコーディングへの変換となります。 +
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_nomemory +のいずれかです。 + +
converter モジュールは、文字列のエンコーディング(コードセット)を +変換します。MDN ライブラリは内部処理に UTF-8 エンコーディングの文字列を +使用するため、このモジュールはローカルエンコーディングと UTF-8 との +間の相互変換を行います。 + +
現在サポートされているエンコーディングは次の通りです。 +
また、converter モジュールはドメイン名のエンコーディング変換のために +特別に設計されたもので、一般的なエンコーディング変換には必ずしも適しません。 +例えば UTF-5、RACE、BRACE、LACE エンコーディングはドメイン名の +区切り文字であるピリオドを特別に扱います。 + +
converter モジュールは「コード変換コンテキスト」という概念を用います。 +あるエンコーディングと UTF-8 との相互変換を行うには、まず +そのエンコーディングのコード変換コンテキストを作成します。実際の +コード変換にはエンコーディングを直接指定するのではなく、この +コード変換コンテキストを指定します。コード変換コンテキストの型は +mdn_converter_t 型であり、次のような opaque 型として定義されています。 +
++ ++typedef struct mdn_converter *mdn_converter_t; ++
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn_converter_initialize(void) ++
モジュールの初期化処理を行います。本モジュールの他のAPI関数を呼ぶ前に + 必ず呼び出してください。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn_converter_create(const char *name, mdn_converter_t *ctxp, + int delayedopen) ++
name で指定されるローカルエンコーディングと UTF-8 との間の +コード変換コンテキストを作成、初期化し、ctxp の指す領域に +格納します。 +
ローカルエンコーディングとして、現在のところ +UTF-5、RACE、BRACE、LACE +の変換機能が用意されています。 +これ以外のエンコーディングが指定された場合には、システムの提供する +iconv() ユーティリティを用いて変換が行われます。 +この場合、この関数の呼び出し時にiconv_open() の +呼び出しが行われますが、 +delayedopen が真ならば実際に文字列の変換が行われるまで +iconv_open() の呼び出しが遅延されます。 +
またmdn_converter_register +を用いて新たなローカルエンコーディングを追加することも可能です。 +
返される値は +mdn_success、 +mdn_invalid_name、 +mdn_nomemory、 +mdn_failure +のいずれかです。 +
+ +
+void +mdn_converter_destroy(mdn_converter_t ctx) ++
mdn_converter_create で +作成したコード変換コンテキストを削除し、確保したメモリを解放します。 +
+ +
+mdn_result_t +mdn_converter_convert(mdn_converter_t ctx, + mdn_converter_dir_t dir, const char *from, + char *to, size_t tolen) ++
mdn_converter_create で +作成したコード変換コンテキストを用いて +文字列 from をコード変換し、結果を to に格納します。 +tolen は to の長さです。 +dir は変換の方向の指定で、 +
ISO-2022-JPのように状態をもつエンコーディングを使用した場合、 +iconv() と異なり、この関数の呼び出し間で状態は保存されません。 +変換は毎回初期状態から始まります。 +
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_invalid_name、 +mdn_nomemory、 +mdn_failure +のいずれかです。 +
+ +
+char * +mdn_converter_localencoding(mdn_converter_t ctx) ++
コード変換コンテキスト ctx のローカルエンコーディング名を +返します。 +
+ +
+int +mdn_converter_isasciicompatible(mdn_converter_t ctx) ++
コード変換コンテキスト ctx のローカルエンコーディングが +ASCII互換エンコーディングかどうかを返します。ASCII互換エンコーディングなら +0でない値が、そうでないなら1が返ります。 +
ASCII互換エンコーディング +(ASCII-compatible Encoding) とは、 +そのエンコーディングでエンコードされたドメイン名が +通常のASCIIのドメイン名と区別できない、つまり英数字および +ハイフンのみで構成されるようなエンコーディングのことで、 +具体的には RACE などが相当します。 +これらのエンコーディングは +一般にアプリケーションのローカルエンコーディングとして用いられることは +ありませんが、DNS プロトコル上でドメイン名を表すためのエンコーディングとしては +(従来の DNS サーバ等がなんの変更もなしに使えることもあって) 有力視されている +ものです。 +
+ +
+mdn_result_t +mdn_converter_addalias(const char *alias_name, const char *real_name) ++
エンコーディング名 real_name に対して、alias_name +という別名を登録します。登録した別名は +mdn_converter_create の +name 引数に指定することができます。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn_converter_aliasfile(const char *path) ++
ファイル path で指定されるファイルを読み込み、その内容に +従って別名を登録します。 +
ファイル path は次のような単純な形式の行からなる +テキストファイルです。 +
+ 別名 正式名 ++
また #で始まる行はコメントとみなされます。 +
返される値は +mdn_success、 +mdn_nofile、 +mdn_invalid_syntax、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn_converter_resetalias(void) ++
mdn_converter_addalias +や mdn_converter_aliasfile +で登録した別名をリセットし、別名が全く登録されていない初期状態に +戻します。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn_converter_register(const char *name, + mdn_converter_openproc_t open, + mdn_converter_closeproc_t close, + mdn_converter_convertproc_t convert, + int ascii_compatible) ++
name という名前のローカルエンコーディングと UTF-8との +間のエンコーディング変換機能を追加します。open、close、 +convert は変換等の処理関数へのポインタです。 +ascii_compatible にはこのローカルエンコーディングが +ASCII互換エンコーディングなら1を、そうでなければ0を指定します。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 + +
debug モジュールはデバッグ用出力のためのユーティリティモジュールです。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+char * +mdn_debug_hexstring(const char *s, int maxbytes) ++
文字列 s を16進数表示した文字列を返します。
+maxbytes は表示する最大の長さで、sが これを超えた場合には
+最後に ...が追加されます。
+
返される文字列のメモリ領域は本関数の保持するスタティック変数の +もので、その内容は本関数の次の呼び出し時まで有効です。 +
+ +
+char * +mdn_debug_xstring(const char *s, int maxbytes) ++
文字列 s の中で、コードが128以上のものを\x{HH}形式で
+表示した文字列を返します。
+maxbytes は表示する最大の長さで、s がこれを超えた場合には
+最後に ...が追加されます。
+
返される文字列のメモリ領域は本関数の保持するスタティック変数の +もので、その内容は本関数の次の呼び出し時まで有効です。 +
+ +
+char * +mdn_debug_hexdata(const char *s, int length, int maxlength) ++
長さ length のバイト列 s を16進表示した文字列を
+返します。
+maxbytes は表示する最大のバイト長で、
+length がこれを超えた場合には最後に ...が追加されます。
+
返される文字列のメモリ領域は本関数の保持するスタティック変数の +もので、その内容は本関数の次の呼び出し時まで有効です。 +
+ +
+void +mdn_debug_hexdump(const char *s, int length) ++
長さ length のバイト列 s の16進ダンプを +標準エラー出力に表示します。 + +
dn モジュールは、DNS メッセージ内のドメイン名の展開・圧縮を行うモジュール +です。これはリゾルバライブラリのres_comp およびres_expand に +相当する機能を提供します。 + +
このモジュールは本ライブラリの他のモジュールからのみ利用されることを想定して +設計されています。 + +
ドメイン名の圧縮の際は、次に示すmdn__dn_t 型のコンテキスト情報を +使用します。 +
+
+#define MDN_DN_NPTRS 64
+typedef struct {
+ const unsigned char *msg;
+ int cur;
+ int offset[MDN_DN_NPTRS];
+} mdn__dn_t;
+
+
+
+以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn__dn_expand(const char *msg, size_t msglen, + const char *compressed, char *expanded, + size_t buflen, size_t *complenp) ++
長さ msglen のDNSメッセージ msg 中の +圧縮されたドメイン名 compressed を展開し、 +expanded に結果を格納します。 +buflen は expanded の大きさです。 +また、compressed の長さが *complenp に格納されます。 +
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_message +のいずれかです。 +
+ +
+void +mdn__dn_initcompress(mdn__dn_t *ctx, const char *msg) ++
ドメイン名圧縮用のコンテキスト情報 ctx を初期化します。 +この関数はmdn__dn_compress を呼び出す前に +必ず呼び出す必要があります。 +msg は圧縮したドメイン名を格納するDNSメッセージの +先頭アドレスです。 +
+ +
+mdn_result_t +mdn__dn_compress(const char *name, char *sptr, size_t length, + mdn__dn_t *ctx, size_t *complenp) ++
name の指すドメイン名を圧縮して sptr の指す +場所に格納します。length は sptr の空き領域の長さです。 +圧縮の際は、ctx に入っている以前に圧縮したドメイン名の情報が +参照されます。 +圧縮したドメイン名の長さが complenp に入れられるとともに、 +圧縮に必要な情報が ctx に追加されます。 +
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_name +のいずれかです。 + +
lace モジュールは、多言語ドメイン名のエンコーディング方式の一つとして +提案されている + +LACE エンコーディング +とUTF-8との間の変換を行うモジュールです。このモジュールは +converter モジュールの +下位モジュールとして実装されており、 +アプリケーションがこのモジュールを直接呼び出すことはありません。 +converter モジュールに対して +LACE エンコーディング +との変換を要求すると、このモジュールが間接的に呼び出されることになります。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn__lace_open(mdn_converter_t ctx, mdn_converter_dir_t dir) ++
LACEエンコーディングとの変換をオープンします。実際には何もしません。 +
常に mdn_successを返します。 +
+ +
+mdn_result_t +mdn__lace_close(mdn_converter_t ctx, mdn_converter_dir_t dir) ++
LACEエンコーディングとの変換をクローズします。実際には何もしません。 +
常に mdn_successを返します。 +
+ +
+mdn_result_t +mdn__lace_convert(mdn_converter_t ctx, mdn_converter_dir_t dir, + const char *from, char *to, size_t tolen) ++
LACEエンコードされた文字列とUTF-8エンコードされた文字列の相互変換を +行います。 +入力文字列 from を変換し、結果を to と +tolen で指定される領域に書き込みます。 +dir がmdn_converter_l2uなら +LACEエンコーディングからUTF-8エンコーディングへ、mdn_converter_u2l +ならUTF-8エンコーディングからLACEエンコーディングへの変換となります。 +
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_nomemory +のいずれかです。 + +
localencoding モジュールはロケール情報を利用して、 +アプリケーションの使用しているエンコーディングを推測するモジュールです。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+const char * +mdn_localencoding_name(void) ++
現在のロケール情報を元に、アプリケーションの使用しているエンコーディング名 +(mdn_converter_create() に渡す +名前) を推測して返します。 +
推測は、システムがnl_langinfo() を備えていればそれを利用し、 +そうでなければsetlocale() や環境変数の情報から行われます。 +後者の場合には必ずしも正しいエンコーディング名が得られるとは限りません。 +
ロケール情報から正しい推測ができない場合、もしくはアプリケーションが +ロケールと異なるエンコーディングを用いて動作している場合のために、 +もし環境変数 MDN_LOCAL_CODESET が定義されていれば、 +をアプリケーションのロケールに関わらず、その変数の値をエンコーディング名として +返すようになっています。 + +
log モジュールはMDN ライブラリのログの出力処理を制御するモジュールです。 +ログはデフォルトでは標準エラー出力に書き出されますが、ハンドラを登録する +ことで、別の出力方法に変更することも可能です。 +
またログレベルを設定することも可能です。ログレベルは次の5段階が +定義されています。 +
+
+enum {
+ mdn_log_level_fatal = 0,
+ mdn_log_level_error = 1,
+ mdn_log_level_warning = 2,
+ mdn_log_level_info = 3,
+ mdn_log_level_trace = 4,
+ mdn_log_level_dump = 5
+};
+
+
+
+以下にモジュールの提供するAPI関数を示します。 + +
+void +mdn_log_fatal(const char *fmt, ...) ++
fatal レベルのログを出力します。このレベルは、プログラムの実行が +不可能であるような致命的なエラーの際に用いられます。 +引数はprintf と同じ形式で指定します。 +
+ +
+void +mdn_log_error(const char *fmt, ...) ++
error レベルのログを出力します。このレベルは、 +致命的ではないエラーの際に用いられます。 +引数はprintf と同じ形式で指定します。 +
+ +
+void +mdn_log_warning(const char *fmt, ...) ++
warning レベルのログを出力します。このレベルは警告メッセージを +表示するために用いられます。 +引数はprintf と同じ形式で指定します。 +
+ +
+void +mdn_log_info(const char *fmt, ...) ++
info レベルのログを出力します。このレベルはエラーではなく、 +有用と思われる情報を出力するのに用いられます。 +引数はprintf と同じ形式で指定します。 +
+ +
+void +mdn_log_trace(const char *fmt, ...) ++
trace レベルのログを出力します。このレベルはAPI関数のトレース +情報を出力するのに用いられます。一般にライブラリのデバッグ目的以外で +このレベルのログを記録する必要はないでしょう。 +引数はprintf と同じ形式で指定します。 +
+ +
+void +mdn_log_dump(const char *fmt, ...) ++
dump レベルのログを出力します。このレベルはさらにデバッグ用の +パケットデータダンプなどを出力するのに用いられます。 +一般にライブラリのデバッグ目的以外でこのレベルのログを記録する +必要はないでしょう。 +引数は printf と同じ形式で指定します。 +
+ +
+void +mdn_log_setlevel(int level) ++
ログ出力のレベルを設定します。設定したレベルを超えるレベルの +ログは出力されません。この関数でログレベルを設定しない場合、 +環境変数 MDN_LOG_LEVEL に設定された整数値が使用されます。 +
+ +
+int +mdn_log_getlevel(void) ++
現在のログ出力のレベルを表す整数値を取得して返します。 +
+ +
+void +mdn_log_setproc(mdn_log_proc_t proc) ++
ログの出力ハンドラを設定します。proc はハンドラ関数への +ポインタです。もしハンドラを指定しない場合、あるいは proc に +NULL を指定した場合には、ログは標準エラー出力に出力されます。 +
ハンドラの型 mdn_log_proc_t は次のように定義されています。 +
++level にはログのレベルが、また msg には表示すべき +メッセージ文字列が渡されます。 + ++typedef void (*mdn_log_proc_t)(int level, const char *msg); ++
msgheader モジュールはDNS メッセージのヘッダの解析、および組み立てを +行うモジュールです。 +
解析されたヘッダ情報は、次に示す構造体に入ります。各フィールドは +DNS メッセージヘッダのフィールドにそのまま対応しているので、説明は省略します。 +
+
+typedef struct mdn_msgheader {
+ unsigned int id;
+ int qr;
+ int opcode;
+ int flags;
+ int rcode;
+ unsigned int qdcount;
+ unsigned int ancount;
+ unsigned int nscount;
+ unsigned int arcount;
+} mdn_msgheader_t;
+
+
+
+以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn_msgheader_parse(const char *msg, size_t msglen, + mdn_msgheader_t *parsed) ++
msg と msglen で示されるDNSメッセージのヘッダを +解析し、parsed が示す構造体に格納します。 +
返される値は +mdn_success、 +mdn_invalid_message +のいずれかです。 +
+ +
+mdn_result_t +mdn_msgheader_unparse(mdn_msgheader_t *parsed, + char *msg, size_t msglen) ++
この関数はmdn_msgheader_parse の +逆の処理を行います。つまり、parsed で指定された構造体のデータから +DNSメッセージのヘッダを構成し、msg と msglen で +示される領域に格納します。 +
返される値は +mdn_success、 +mdn_buffer_overflow +のいずれかです。 +
+ +
+unsigned int +mdn_msgheader_getid(const char *msg) ++
msg で指定されるDNSメッセージから ID を取り出して返します。 +この関数はヘッダ全体を解析せずにIDだけ取り出したいときに便利です。 +この関数は、msg の指すデータがDNSメッセージのヘッダ長以上ある +ことを仮定していますので、必ず呼び出し側で確認してから呼び出すように +してください。 +
+ +
+void +mdn_msgheader_setid(char *msg, unsigned int id) ++
msg で指定されるDNSメッセージに id で指定される +ID を設定します。 +この関数も msg の指すデータがDNSメッセージのヘッダ長以上ある +ことを仮定していますので、必ず呼び出し側で確認してから呼び出すように +してください。 + +
msgtrans モジュールはDNS プロキシサーバでの DNS メッセージの変換処理の +大部分を提供するモジュールです。このモジュールは +converter モジュールや +normalizer モジュールなど他の多くのモジュールを +の上位モジュールとして実現されています。 + +
DNSプロキシサーバにおけるメッセージ変換処理はおよそ次のようなものです。 +
まずクライアントからDNSサーバへのメッセージの変換の場合は次の +ようになります。 +
次にDNSサーバからクライアントへのメッセージの変換の場合は次の +ようになります。 +
このように、DNSメッセージの変換に際しては、 +クライアント・サーバ側のZLD、エンコーディング等 +いろいろなパラメータが必要となります。API関数にこれらを指定する際、 +それぞれを別々の引数で指定するのは煩雑なので、次のような構造体を +用いてまとめて渡すようにしてあります。 +
+
+typedef struct mdn_msgtrans_param {
+ int use_local_rule;
+ mdn_zldrule_t local_rule;
+ mdn_converter_t local_converter;
+ mdn_converter_t local_alt_converter;
+ char *local_zld;
+ mdn_converter_t target_converter;
+ mdn_converter_t target_alt_converter;
+ char *target_zld;
+ mdn_normalizer_t normalizer;
+} mdn_msgtrans_param_t;
+
+
+use_local_ruleは、入力側のメッセージのZLDおよびエンコーディングの +判定方法を指定します。 +
もし値が真ならば、これらはlocal_ruleで +指定されるZLDとエンコーディングの集合とメッセージに含まれるドメイン名の +マッチング処理を行い、マッチしたものが使われます。 +これはクライアントからDNSサーバへのリクエストメッセージの変換の際に +用いられます。 +この場合、判定結果がlocal_converterとlocal_zldに +代入されます。 +
一方、local_ruleが偽ならばZLDおよびエンコーディングは +local_converterとlocal_zldで指定されるものがそのまま +使用されます。 +これはDNSサーバからクライアントへのリクエストメッセージの変換の際に +用いられます。 +この場合local_ruleの値は使用されません。 +use_local_rule の値に関わらず、local_alt_converter は +入力側メッセージの代替エンコーディングとして使用されます。 +代替エンコーディングがない場合には NULL を指定します。 +
target_converterとtarget_zldで出力側の +エンコーディングとZLDを指定します。 +target_alt_converterは、target_converterによる +出力側のエンコーディングへの変換が、変換しようとするドメイン名に +出力側の文字集合にない文字が含まれていたために失敗した場合に、 +target_converterの代わりに使用されます。 +なお local_alt_converter と target_alt_converter +に対応するエンコーディングはいずれも +ASCII 互換エンコーディングでなければなりません。 +
normalizerは正規化方式を指定します。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn_msgtrans_translate(mdn_msgtrans_param_t *param, + const char *msg, size_t msglen, + char *outbuf, size_t outbufsize, + size_t *outmsglenp) ++
msg および msglen で指定されるDNSメッセージを +変換パラメータ param にしたがって変換し、結果を +outbuf および outbufsize で示される領域に格納します。 +outmsglenp には変換結果のメッセージ長が格納されます。 +
返される値は +mdn_success、 +mdn_invalid_message、 +mdn_invalid_encoding、 +mdn_buffer_overflow +のいずれかです。 + +
normalizer モジュールは文字列の正規化を行うモジュールです。 +正規化の方式としては現在次のものが用意されています。 +また別の新たな正規化方式を追加登録するためのAPIも用意されています。 +
最後のja-delimiter-hackは句点および全角ピリオドを +ドメイン名のセパレータであるピリオドと見なすようにするもので、 +これは本来多言語ドメイン名のユーザ入力の際の手間および間違いを軽減するために +用意されたものですが、ブラウザによってはピリオドのないドメイン名が +ドメイン名ではなくキーワードと認識されてしまうなどの問題があり、 +またこれはドメイン名の正規化の範囲を逸脱しているとも考えられるので、 +できるだけこの正規化方式の使用は避けるべきです。 + +
正規化方式は複数併用することも可能で、この場合指定した順に適用されます。 + +
normalizer モジュールは「正規化コンテキスト」という概念を用います。 +正規化を行うに先立ってまず正規化コンテキストを作成し、使用する +正規化方式をコンテキストに登録しておきます。 +実際の正規化処理の際には正規化方式ではなく、 +この正規化コンテキストを指定します。 +正規化コンテキストの型は +mdn_normalizer_t 型であり、 +次のような opaque 型として定義されています。 +
++ ++typedef struct mdn_normalizer *mdn_normalizer_t; ++
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn_normalizer_initialize(void) ++
モジュールの初期化処理を行います。本モジュールの他のAPI関数を呼ぶ前に + 必ず呼び出してください。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn_normalizer_create(mdn_normalizer_t *ctxp) ++
正規化用の空のコンテキストを作成し、ctxp の指す領域に格納します。 +返されるコンテキストは空で、正規化方式は一つも含まれていません。 +正規化方式を追加するには +mdn_normalizer_add を用います。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
+ +
+void +mdn_normalizer_destroy(mdn_normalizer_t ctx) ++
mdn_normalizer_create で +作成した正規化コンテキストを削除し、アロケートされたメモリを解放します。 +
+ +
+mdn_result_t +mdn_normalizer_add(mdn_normalizer_t ctx, const char *scheme_name) ++
mdn_normalizer_create で +作成した正規化コンテキストに、scheme_name で指定される +正規化方式を追加します。一つのコンテキストに複数の正規化方式を +追加することができます。 +
返される値は +mdn_success、 +mdn_invalid_name、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn_normalizer_normalize(mdn_normalizer_t ctx, + const char *from, char *to, size_t tolen) ++
UTF-8 でエンコードされた文字列 from に ctx で +指定される正規化方式を適用し、その結果を to と tolen で +指定される領域に書き込みます。 +ctx に複数の正規化方式が含まれている場合、それらが +mdn_normalizer_add で追加した順番に +適用されます。 +
返される値は +mdn_success、 +mdn_invalid_encoding、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn_normalizer_register(const char *scheme_name, + mdn_normalizer_proc_t proc) ++
新しい正規化方式を scheme_name という名前で登録します。 +proc はその正規化方式の処理関数へのポインタです。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 + +
race モジュールは、多言語ドメイン名のエンコーディング方式の一つとして +提案されている +RACE エンコーディング +とUTF-8との間の変換を行うモジュールです。このモジュールは +converter モジュールの下位モジュールとして実装されており、 +アプリケーションがこのモジュールを直接呼び出すことはありません。 +converter モジュールに対して RACE エンコーディング +との変換を要求すると、このモジュールが間接的に呼び出されることになります。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn__race_open(mdn_converter_t ctx, mdn_converter_dir_t dir) ++
RACEエンコーディングとの変換をオープンします。実際には何もしません。 +
常に mdn_successを返します。 +
+ +
+mdn_result_t +mdn__race_close(mdn_converter_t ctx, mdn_converter_dir_t dir) ++
RACEエンコーディングとの変換をクローズします。実際には何もしません。 +
常に mdn_successを返します。 +
+ +
+mdn_result_t +mdn__race_convert(mdn_converter_t ctx, mdn_converter_dir_t dir, + const char *from, char *to, size_t tolen) ++
RACEエンコードされた文字列とUTF-8エンコードされた文字列の相互変換を +行います。 +入力文字列 from を変換し、結果を to と +tolen で指定される領域に書き込みます。 +dir がmdn_converter_l2uなら +RACEエンコーディングからUTF-8エンコーディングへ、mdn_converter_u2l +ならUTF-8エンコーディングからRACEエンコーディングへの変換となります。 +
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_nomemory +のいずれかです。 + +
res モジュールはクライアント側 (リゾルバライブラリやアプリケーション) +で多言語ドメイン名の処理、つまりドメイン名のエンコーディング変換や +正規化を行う際の高レベル API を提供します。 +このモジュールはあとで説明する resconf モジュール +とともに用いることを前提に設計されています。 + +
これらのモジュールの提供する API を使用すれば、 +converter モジュールや +normalizer モジュールなどの関数を直接 +呼び出す必要はありません。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn_res_localtoucs(mdn_resconf_t conf, const char *local_name, + char *ucs_name, size_t ucs_name_len) ++
アプリケーションの使用するローカルエンコーディングで表された +ドメイン名文字列 local_name を UTF-8 に変換し、その結果を +ucs_name に格納します。ucs_name_len で +あらかじめ ucs_name に確保した領域の大きさを指定します。 + +
conf は resconf モジュール の返す +クライアント設定コンテキストです。もし conf が NULL であれば +変換は行われず、local_name の内容がそのまま ucs_name +にコピーされます。 + +
ドメイン名 local_name が従来の ASCII ドメイン名として +正しく (つまり英数字およびハイフンとピリオドから構成される)、かつ +クライアント設定コンテキスト conf に代替エンコーディング +が設定されている場合、ローカルエンコーディングとしての変換を行う前に +代替エンコーディングから UTF-8 の変換を試み、失敗した場合に +ローカルエンコーディングから UTF-8 への変換を行います。これによって、 +mdn_res_ucstolocal が +与えられたドメイン名をローカルエンコーディングに変換できず +代替エンコーディングに変換した場合でも、それを本関数に与えれば +正しい UTF-8 エンコーディングのドメイン名が得られます。 + +
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_name、 +mdn_failure +のいずれかです。 + +
+ +
+mdn_result_t +mdn_res_ucstolocal(mdn_resconf_t conf, const char *ucs_name, + char *local_name, size_t local_name_len) ++
mdn_res_localtoucs の +逆の変換、つまり UTF-8 で表されたドメイン名文字列 ucs_name +をアプリケーションの使用するローカルエンコーディングに変換し、その結果を +local_name に格納します。local_name_len で +あらかじめ local_name に確保した領域の大きさを指定します。 + +
conf は resconf モジュール の返す +クライアント設定コンテキストです。もし conf が NULL であれば +変換は行われず、local_name の内容がそのまま ucs_name +にコピーされます。 + +
もしドメイン名 ucs_name の中にローカルエンコーディングの +文字集合にない文字があって変換に失敗した場合、クライアント設定コンテキスト +conf に代替エンコーディングが設定されていれば、 +ローカルエンコーディングの代わりに代替エンコーディングへの変換が行われます。 +これにより、たとえ DNS サーバからローカルエンコーディングに含まれない文字を +含むドメイン名が返された場合にもエラーとならずに変換が行われます。 +なお、代替エンコーディングに変換された文字列は +mdn_res_localtoucs によって +UTF-8 文字列に戻すことが可能です。 + +
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_name、 +mdn_failure +のいずれかです。 + +
+ +
+mdn_result_t +mdn_res_normalize(mdn_resconf_t conf, const char *name, + char *normalized_name, size_t normalized_name_len) ++
クライアント設定コンテキスト conf にしたがって +UTF-8 で表されたドメイン名 name に対して正規化を実行し、 +その結果を normalized_name に格納します。 +normalized_name_len であらかじめ normalized_name に +確保した領域の大きさを指定します。 + +
もし conf が NULL であれば正規化は行われず、 +name の内容がそのまま normalized_name にコピーされます。 + +
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_nomemory +のいずれかです。 + +
+ +
+mdn_result_t +mdn_res_ucstodns(mdn_resconf_t conf, const char *ucs_name, char *dns_name, + size_t dns_name_len) ++
クライアント設定コンテキスト conf にしたがって +UTF-8 で表されたドメイン名 ucs_name を DNS プロトコル上で +用いられるエンコーディングに変換し、その結果を dns_name に +格納します。 +dns_name_len であらかじめ dns_name_len に +確保した領域の大きさを指定します。 + +
もし conf が NULL であれば変換は行われず、 +ucs_name の内容がそのまま dns_name にコピーされます。 + +
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_invalid_name、 +mdn_failure +のいずれかです。 + +
+ +
+mdn_result_t +mdn_res_dnstoucs(mdn_resconf_t conf, const char *dns_name, char *ucs_name, + size_t ucs_name_len) ++
mdn_res_ucstodns の逆変換、 +つまりクライアント設定コンテキスト conf にしたがって +DNS プロトコル上のエンコーディングで表されたドメイン名 dns_name +を UTF-8 に変換し、その結果を ucs_name に格納します。 +ucs_name_len であらかじめ ucs_name_len に +確保した領域の大きさを指定します。 + +
もし conf が NULL であれば変換は行われず、 +dns_name の内容がそのまま ucs_name にコピーされます。 + +
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_invalid_name、 +mdn_failure +のいずれかです。 + +
resconf モジュールはクライアント側 (リゾルバライブラリやアプリケーション) +で多言語ドメイン名の処理を行う際に参照される +クライアント設定ファイルを読み込み、 +ファイルに記述された設定にしたがった初期化を実行します。また +設定情報を取り出す機能を提供します。 + +
resconf モジュールは「クライアント設定コンテキスト」という概念を用います。 +クライアント設定ファイルに記述された設定はこのクライアント設定コンテキストに +格納され、このコンテキストを引数にして API 関数を呼び出すことによって +設定された値を取り出すことができます。 +クライアント設定コンテキストの型は mdn_resconf_t 型であり、 +次のような opaque 型として定義されています。 +
++ ++typedef struct mdn_resconf *mdn_resconf_t; ++
このモジュールは単体でも使用できますが、 +res モジュールと組み合わせることによって、 +クライアント側での多言語ドメイン名の処理を簡単に行うことができるように +設計されています。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn_resconf_initialize(void) ++
多言語ドメイン名の処理を行う際に必要な初期化を実行します。 +本モジュールの他のAPI関数を呼ぶ前に必ず呼び出してください。 +本モジュールが使用する他のモジュールの初期化もすべて行うので、これ以外の初期化 +関数を呼び出す必要はありません。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn_resconf_create(mdn_resconf_t *ctxp) ++
クライアント設定コンテキストを作成、初期化し、ctxp の指す +領域に格納します。 +初期状態では、まだクライアント設定ファイルの内容は読み込まれていません。 +読み込むためには +mdn_resconf_loadfile を実行する必要があります。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
+ +
+void +mdn_resconf_destroy(mdn_resconf_t ctx) ++
mdn_resconf_create で +作成されたクライアント設定コンテキストを削除し、確保したメモリを解放します。 +
+ +
+mdn_result_t +mdn_resconf_loadfile(mdn_resconf_t ctx, const char *file) ++
file で指定される +クライアント設定ファイルの内容を読み込み、 +設定内容をクライアント設定コンテキスト ctx に格納します。 +file が NULL の場合にはデフォルトのクライアント設定ファイルの +内容を読み込みます。 +
すでに設定ファイルが読み込まれているコンテキストに対して、 +別の設定ファイルの内容を読み込むこともできます。その場合には、 +クライアント設定コンテキストに格納されていた前の設定ファイルの内容は +すべて消え、新たに読み込んだ設定ファイルの内容で置き換わります。 +
返される値は +mdn_success、 +mdn_nofile、 +mdn_invalid_syntax、 +mdn_invalid_name、 +mdn_nomemory +のいずれかです。 +
+ +
+char * +mdn_resconf_defaultfile(void) ++
デフォルトのクライアント設定ファイルのパス名を返します。 +これは mDNkit のコンパイル時の設定によって決まりますが、特に指定しなければ +
++です。 ++/usr/local/etc/mdnres.conf ++
+ +
+mdn_converter_t +mdn_resconf_localconverter(mdn_resconf_t ctx) ++
クライアント設定コンテキスト ctx の情報を元に、 +ローカルエンコーディングと UTF-8 との間の文字コード変換を行うための +コード変換コンテキストを返します。ローカルエンコーディングが判別できなかった +場合には NULL を返します。 +
コード変換コンテキストについては +converter モジュール の項をご覧ください。 +
+ +
+mdn_converter_t +mdn_resconf_alternateconverter(mdn_resconf_t ctx) ++
クライアント設定コンテキスト ctx の情報を元に、 +代替エンコーディングと UTF-8 との間の +文字コード変換を行うためのコード変換コンテキストを返します。 +代替エンコーディングとはドメイン名をローカルエンコーディングに変換することが +できなかった場合に、ローカルエンコーディングの代わりに用いられる +エンコーディングのことです。 +クライアント設定ファイルがまだ読み込まれていなかったり、設定ファイルに +エンコーディングの指定がなかった場合には NULL を返します。 +
コード変換コンテキストについては +converter モジュール の項をご覧ください。 +
+ +
+mdn_converter_t +mdn_resconf_serverconverter(mdn_resconf_t ctx) ++
クライアント設定コンテキスト ctx の情報を元に、 +DNS プロトコル上で用いられるエンコーディングと UTF-8 との間の +文字コード変換を行うためのコード変換コンテキストを返します。 +クライアント設定ファイルがまだ読み込まれていなかったり、設定ファイルに +エンコーディングの指定がなかった場合には NULL を返します。 +
コード変換コンテキストについては +converter モジュール の項をご覧ください。 +
+ +
+const char * +mdn_resconf_zld(mdn_resconf_t ctx) ++
クライアント設定コンテキスト ctx の情報を元に、 +多言語ドメイン名と従来のドメイン名とを区別するために一部の +エンコーディングとともに用いられる ZLD の文字列を返します。 +ZLD を使用しない設定の場合には NULL を返します。 +
mDNkit はデフォルトの設定では ZLD をサポートせず、この関数は常に +NULL を返します。mDNkit を ZLD をサポートするように設定する方法に +ついては mDNkit のインストールガイドの +configure 実行 +の項をご覧ください。 +
+ +
+mdn_normalizer_t +mdn_resconf_normalizer(mdn_resconf_t ctx) ++
クライアント設定コンテキスト ctx の情報を元に、 +ドメイン名を正規化するための正規化コンテキストを返します。 +クライアント設定ファイルがまだ読み込まれていなかったり、設定ファイルに +正規化方式の指定がなかった場合には NULL を返します。 +
正規化コンテキストについては +normalizer モジュール の項をご覧ください。 + +
result モジュールはライブラリの各関数が返す +mdn_result_t型の値を扱うモジュールで、 +値からそのコードに対応するメッセージへの変換を提供します。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+char * +mdn_result_tostring(mdn_result_t result) ++
mdn_result_t型の値 result に対応する +メッセージ文字列を返します。 +
未定義のコードに対しては unknown result code という文字列が +返されます。 + +
selectiveencode モジュールはゾーンマスタファイル等のテキストの中から +非ASCII文字を含むドメイン名を探し出すモジュールです。 +もちろんテキストのどの部分がドメイン名なのかを判定することは一般的には +不可能なので、実際には次のような大きな仮定を置くことによって +近似的に実現しています。 +
具体的には次のようなアルゴリズムを用いてドメイン名の領域検出を行います。 +
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn_selectiveencode_findregion(const char *s, + char **startp, char **endp) ++
UTF-8でエンコードされた文字列 s を走査して、最初に出現する +非ASCII文字を含むドメイン名の領域を求め、その先頭を指すポインタを +startp に、領域の直後の文字を指すポインタを endp に +それぞれ格納します。 +
返される値は +mdn_success、 +mdn_notfound +のいずれかです。 + +
strhash モジュールは文字列をキーとするハッシュ表を実現するモジュールです。 +ハッシュ表は +converter モジュールや +normalizer モジュールなどライブラリの他のモジュールで +使用されます。 +非常に一般的なハッシュ表の実装であり、特筆すべき点はありません… +一つだけあります。登録はできますが削除の機能がありません。本ライブラリでは +必要ないからです。 + +
ハッシュ表のサイズは要素の総数が増えるに従って大きくなります。 + +
ハッシュ表は次に示す mdn_strhash_t 型の opaque データとして +表されます。 +
++ ++typedef struct mdn_strhash *mdn_strhash_t; ++
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn_strhash_create(mdn_strhash_t *hashp) ++
空のハッシュ表を作成し、そのハンドルを hashp の指す領域に +格納します。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
+ +
+void +mdn_strhash_destroy(mdn_strhash_t hash) ++
mdn_strhash_create で作成した +ハッシュ表を削除し、確保したメモリを解放します。 +
+ +
+mdn_result_t +mdn_strhash_put(mdn_strhash_t hash, const char *key, + void *value) ++
mdn_strhash_create で作成した +ハッシュ表 hash にキー key、値 value の組を +登録します。 +文字列 key はコピーされますので、この関数の呼び出し後 +key の指すメモリを解放しても、文字列の内容を書き換えても +影響はありません。これに対して value の内容はコピーされないので +注意してください (もちろんよく考えてみればコピーされないことは自明ですが)。 +
同じキーを使用して複数回登録した場合、最後に登録されたものだけが +有効です。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn_strhash_get(mdn_strhash_t hash, + const char *key, void **valuep) ++
ハッシュ表 hash からキー key を持つ要素を検索し、 +対応する要素があればその値を valuep に格納します。 +
返される値は +mdn_success、 +mdn_noentry +のいずれかです。 +
+ +
+int +mdn_strhash_exists(mdn_strhash_t hash, const char *key) ++
ハッシュ表 hash にキー key を持つ要素があれば +1を、なければ 0 を返します。 + +
translator モジュールは、与えられたパラメータに従ってドメイン名を +変換するモジュールです。パラメータとしては次にあげるデータを与えます。 +
ドメイン名の変換の手続きはやや複雑です。これは次の理由によります。 +
具体的には、次のようなアルゴリズムを使用して変換を行います。 +
以上の処理をフローチャートで表したのが次の図です。 + +
++ ++
本モジュールはエンコーディング変換に +converter モジュールを、また正規化に +normalizer モジュールをそれぞれ使用します。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn_translator_translate(mdn_converter_t local_converter, + mdn_converter_t local_alternate_converter, + const char *local_zld, + mdn_normalizer_t normalizer, + mdn_converter_t target_converter, + mdn_converter_t target_alternate_converter, + const char *target_zld, + const char *from, char *to, size_t tolen) ++
与えられたパラメータにしたがってドメイン名 from を変換し、 +結果を to と tolen で指定される領域に格納します。 +
ローカルエンコーディング、ローカル代替エンコーディング、 +ターゲットエンコーディングおよびターゲット代替エンコーディングは +エンコーディングの名称ではなく、 +対応するconverter モジュールの +コード変換コンテキスト local_converter、 +alternate_converter および target_converter で +指定します。 +
ターゲット代替エンコーディング target_alternate_converter は、 +target_converter によるターゲットエンコーディングへの変換が、 +ドメイン名がターゲットエンコーディングの文字集合にない文字を含んでいるために +失敗した時に、ターゲットエンコーディングの代わりに使用されます。 +
正規化はnormalizer モジュールの正規化コンテキスト +normalizer で指定します。 +
ローカルZLDおよびターゲットZLDは +mdn_translator_canonicalzld +で標準形式に変換したものでなければなりません。 +
返される値は +mdn_success、 +mdn_buffer_overflow、 +mdn_invalid_encoding、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn_translator_canonicalzld(const char *zld, + char **canonicalizedp) ++
ZLD zld を標準形式に変換し、そのポインタを +canonicalizedp の指す領域に格納します。 +変換された文字列 (*canonicalizedp) の領域は +malloc() されていますので、不要になったら free() で +解放してください。 +
ここでいう ZLD の標準形式とは次のような形式のものを指します。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
+ +
+int +mdn_translator_matchzld(const char *domain, + const char *zld) ++
ドメイン名 domain と ZLD zld がマッチするかどうか +を調べ、マッチすれば1を、しなければ0を返します。 +
ZLD は +mdn_translator_canonicalzld +で標準形式に変換したものでなければなりません。 + +
unicode モジュールは、 +UnicodeData.txt +に記述されている、Unicode の各種文字属性を取得するモジュールです。なお、 +Unicode.txt に記述されているデータの意味、およびファイル形式については +UnicodeData File Formatをご覧ください。 + +
本ライブラリの多くのモジュールは Unicode のデータを UTF-8エンコードされた +文字列形式で扱いますが、このモジュールは unsigned long 型の +データとして扱います。含まれる値は UCS-4 です。 + +
+このモジュールでは Unicode 文字の大文字小文字の相互変換機能も +提供しています。 これは + +Unicode Technical Report #21: Case Mappings で +定義されているものです。 +Unicode 文字の中にはごく一部ですが大文字小文字の変換をする際に +文脈情報を必要とするものがあり、これは次のような列挙型のデータで指定します。 +
+
+typedef enum {
+ mdn__unicode_context_unknown,
+ mdn__unicode_context_final,
+ mdn__unicode_context_nonfinal
+} mdn__unicode_context_t;
+
+
+文脈が FINAL の場合には mdn__unicode_context_final を、また
+NON_FINAL の場合には mdn__unicode_context_nonfinal を指定します。
+mdn__unicode_context_unknown は文脈情報がわからない (調べていない)
+ことを示します。
+文脈情報に関して詳しくは上記文献をご覧ください。
+
+以下にモジュールの提供するAPI関数を示します。 + +
+int +mdn__unicode_canonicalclass(unsigned long c); ++
Unicode 文字 c の Canonical Combining Class を求めます。 +Canonical Combining Class が定義されていない文字については 0 を返します。 +
+ +
+mdn_result_t +mdn__unicode_decompose(int compat, + unsigned long *v, size_t vlen, + unsigned long c, int *decomp_lenp) ++
Unicode 文字 c を UnicodeData.txt のCharacter +Decomposition Mapping にしたがって decompose し、その結果を +v および vlen で指定される領域に書き込みます。 +compat の値が真なら Compatibility Decomposition を、 +偽ならCanonical Decomposition を行います。 +
decompose は再帰的に行われます。つまりCharacter Decomposition Mapping +にしたがって分解した各文字についてさらに decompose 処理が行われます。 +
返される値は +mdn_success、 +mdn_notfound、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn__unicode_compose(unsigned long c1, + unsigned long c2, unsigned long *compp) ++
c1 と c2 の2文字の Unicode 文字のシーケンスを +UnicodeData.txt のCharacter Decomposition Mapping にしたがって +compose し、その結果を compp の指す領域に書き込みます。 +必ず Canonical Composition が行われます。 +
返される値は +mdn_success、 +mdn_notfound +のいずれかです。 +
+ +
+int +mdn__unicode_iscompositecandidate(unsigned long c) ++
Unicode文字 c から始まる Canonical Composition が存在するか +どうかを調べ、存在する可能性があれば 1 を可能性がなければ 0 を返します。 +これはヒント情報であり、1が返ってきたとしても実際には Composition が +存在しないこともあり得ます。逆に 0 が返ってくれば確実に存在しません。 +
Unicode の全文字の中で Canonical Composition の先頭となる文字は数 +少ないので、mdn__unicode_compose の +検索のオーバヘッドを減らすためにあらかじめデータをスクリーニングする目的に +使用することができます。 +
+ +
+mdn_result_t +mdn__unicode_toupper(unsigned long c, mdn__unicode_context_t ctx, + unsigned long *v, size_t vlen, int *convlenp) ++
Unicode文字 c を UnicodeData.txt の Uppercase Mapping +情報および SpecialCasing.txtの情報にしたがって大文字に変換し、結果を +v の指す領域に格納します。vlen はあらかじめ +v に確保した領域の大きさです。変換結果の文字数は +*convlenp に返されます。 +変換結果が複数の文字になることがあることに注意してください。 +またロケール依存の変換は行いません。 + +
ctx は文字 c の出現する +文脈情報です。 +ほとんどの文字では変換の際に文脈情報は不要なため、 +通常は mdn__unicode_context_unknown を指定しておくことができます。 +もし文脈情報が必要な場合、本関数は戻り値として mdn_context_required +を返すので、文脈情報を取得してから改めて呼び出すことが可能です。 +文脈情報の取得には +mdn__unicode_getcontext を使用します。 + +
もし対応する大文字が存在しない場合には c がそのまま +v に格納されます。 + +
返される値は +mdn_success、 +mdn_context_required、 +mdn_buffer_overflow +のいずれかです。 +
+ +
+mdn_result_t +mdn__unicode_tolower(unsigned long c, mdn__unicode_context_t ctx, + unsigned long *v, size_t vlen, int *convlenp) ++
Unicode文字 c を UnicodeData.txt の Uppercase Mapping +情報および SpecialCasing.txtの情報にしたがって小文字に変換し、結果を +v の指す領域に格納します。vlen はあらかじめ +v に確保した領域の大きさです。変換結果の文字数は +*convlenp に返されます。 +変換結果が複数の文字になることがあることに注意してください。 +またロケール依存の変換は行いません。 + +
ctx は文字 c の出現する +文脈情報です。 +ほとんどの文字では変換の際に文脈情報は不要なため、 +通常は mdn__unicode_context_unknown を指定しておくことができます。 +もし文脈情報が必要な場合、本関数は戻り値として mdn_context_required +を返すので、文脈情報を取得してから改めて呼び出すことが可能です。 +文脈情報の取得には +mdn__unicode_getcontext を使用します。 + +
もし対応する小文字が存在しない場合には c がそのまま +v に格納されます。 + +
返される値は +mdn_success、 +mdn_context_required、 +mdn_buffer_overflow +のいずれかです。 +
+ +
+mdn__unicode_context_t +mdn__unicode_getcontext(unsigned long c) ++
大文字小文字変換で用いられる文脈情報を返します。 +文脈情報を取得するには次のようにします。 +まず大文字小文字変換の対象文字に続く次の文字を取得し、この関数を +呼び出します。もし返される値が mdn__unicode_context_final +あるいは mdn__unicode_context_nonfinal のいずれかであれば +それが求める文脈情報です。 +mdn__unicode_context_unknown の場合にはさらに続く文字を取得し、 +この関数を呼び出します。このようにして mdn__unicode_context_final +か mdn__unicode_context_nonfinal かいずれかの値が得られるまで +処理を繰り返します。もし文字列の最後まで来た場合には、文脈は +mdn__unicode_context_final となります。 + +
具体的にはこの関数は次のような処理を行います。 +Unicode 文字 c の "General Category" 属性を参照し、 +それが "Lu" "Ll" "Lt" のいずれかであれば +mdn__unicode_context_nonfinal を、"Mn" であれば +mdn__unicode_context_unknown を、それ以外であれば +mdn__unicode_context_final を返します。 + +
unormalize モジュールは、Unicode で定義されている標準の正規化を +行うモジュールです。Unicode の正規化は +Unicode Technical Report #15: Unicode Normalization Forms +で定義されています。本モジュールはこの文書にあげられた4つの正規化形式を +実装しています。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn__unormalize_formc(const char *from, char *to, size_t tolen) ++
UTF-8でエンコードされた文字列 from に対して +正規化 Unicode Normalization Form C を適用し、その結果を +to および tolen で指定される領域に書き込みます。 +
返される値は +mdn_success、 +mdn_invalid_encoding、 +mdn_buffer_overflow、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn__unormalize_formd(const char *from, char *to, size_t tolen) ++
UTF-8でエンコードされた文字列 from に対して +正規化 Unicode Normalization Form D を適用し、その結果を +to および tolen で指定される領域に書き込みます。 +
返される値は +mdn_success、 +mdn_invalid_encoding、 +mdn_buffer_overflow、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn__unormalize_formkc(const char *from, char *to, size_t tolen) ++
UTF-8でエンコードされた文字列 from に対して +正規化 Unicode Normalization Form KC を適用し、その結果を +to および tolen で指定される領域に書き込みます。 +
返される値は +mdn_success、 +mdn_invalid_encoding、 +mdn_buffer_overflow、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn__unormalize_formkd(const char *from, char *to, size_t tolen) ++
UTF-8でエンコードされた文字列 from に対して +正規化 Unicode Normalization Form KD を適用し、その結果を +to および tolen で指定される領域に書き込みます。 +
返される値は +mdn_success、 +mdn_invalid_encoding、 +mdn_buffer_overflow、 +mdn_nomemory +のいずれかです。 + +
utf5 モジュールはドメイン名のエンコーディング方式の一つとして +提案されている +UTF-5 エンコーディング +の基本処理を行うモジュールです。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+int +mdn_utf5_getwc(const char *s, size_t len, + unsigned long *vp) ++
UTF-5でエンコードされた長さ len バイトの文字列 s の +先頭の文字を取り出し、UCS-4 に変換して vp の指す領域に格納すると +ともに、文字の (UTF-5エンコードでの) バイト数を返します。 +もし len が短すぎて文字の途中で終わっていたり、エンコーディングが +間違っている場合には 0 が返されます。 +
+ +
+int +mdn_utf5_putwc(char *s, size_t len, unsigned long v) ++
UCS-4 文字 v をUTF-5エンコーディングに変換し、s +および len で指定される領域に書き込むとともに、書き込んだバイト数を +返します。ただし len が短すぎて書き込めない場合には0を返します。 +
書き込んだUTF-5文字列は NUL 文字で終端されていません。 + +
utf8 モジュールはUTF-8 でエンコードされた文字列の基本処理を行う +モジュールです。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+int +mdn_utf8_mblen(const char *s) ++
UTF-8 文字列 s の先頭文字の長さ(バイト数)を返します。 +もし s が指すバイトが UTF-8 の先頭バイトとして正しくないものである +場合には 0 を返します。 +
この関数は s の先頭バイトのみを調べて長さを返します。したがって +2バイト目以降に不正なバイトがある可能性が存在します。特に途中に NUL バイトが +ある可能性もあるので、s が正当な UTF-8 文字列であることが確実では +ない場合には気をつける必要があります。 +
+ +
+int +mdn_utf8_getmb(const char *s, size_t len, char *buf) ++
長さ len バイトの UTF-8 文字列 s の先頭の1文字を +buf にコピーし、コピーしたバイト数を返します。 +もし len が短すぎたり、s が指す文字が UTF-8 として +正しくない場合にはコピーは行わず、0 を返します。 +
buf は任意の UTF-8 エンコーディングの文字が保持できる大きさ +でなければなりません。すなわち、6バイト以上の長さを持っている必要があります。 +
書き込んだUTF-8文字列は NUL 文字で終端されていません。 +
+ +
+int +mdn_utf8_getwc(const char *s, size_t len, + unsigned long *vp) ++
mdn_utf8_getmb とほぼ同じですが、 +s から取り出した文字を +UCS-4に変換して vp の指す領域に格納するところが異なります。 +
+ +
+int +mdn_utf8_putwc(char *s, size_t len, unsigned long v) ++
UCS-4 文字 v を UTF-8 エンコーディングに変換して、 +s および len で指定される領域に書き込むとともに、 +書き込んだバイト数を返します。v の値が不正であったり +len が短すぎた場合には 0 を返します。 +
書き込んだUTF-8文字列は NUL 文字で終端されていません。 +
+ +
+int +mdn_utf8_isvalidstring(const char *s) ++
NUL 文字で終端された文字列 s が正しい UTF-8 エンコーディング +であるかどうか調べ、正しければ 1 を、正しくなければ 0 を返します。 +
+ +
+char * +mdn_utf8_findfirstbyte(const char *s, + const char *known_top) ++
文字列 known_top 中の s が指すバイトを含む +UTF-8 文字の先頭バイトを調べて返します。その文字が正しい UTF-8 +エンコーディングではない場合、known_top から s までの +間に先頭バイトがなかった場合には NULL を返します。 + +
util モジュールは他のモジュールで使われるユーティリティー的な +機能を提供するモジュールです。 +現在のところは大文字小文字の区別をしない文字列照合の機能のみを +提供しています。 + +
以下にモジュールの提供するAPI関数を示します。 + +
+int +mdn_util_casematch(const char *s1, const char *s2, size_t n) ++
文字列 s1 と s2 の先頭から最大 n バイトを +比較し、同一かどうかを判定します。 +ASCII 文字の大文字と小文字 (つまり A から Z と a から z) は同一とみなします。 +同一であれば 1 を、違っていれば 0 を返します。 +これは多くのシステムで用意されている strcasencmp と返り値の仕様を +除けばほぼ同様の機能を提供する関数です。 +
+ +
zldrule モジュールはドメイン名と ZLD とのマッチングを行うモジュールです。 +ドメイン名に使用される可能性のある ZLD のリストとそれぞれの ZLD に対応した +エンコーディングのリストを持ち、与えられたドメイン名とのマッチングを行って +マッチした ZLD とエンコーディングを返します。 + +
zldrule モジュールはマッチングのために「コンテキスト」という概念を用います。 +マッチングに先立ってまずコンテキストを作成し、それに対して +ZLD とエンコーディングを登録していきます。 +そして実際にドメイン名とマッチングを行う際にはこのコンテキストを用いて +マッチングに使用するZLD とエンコーディングのリストを指定します。 +コンテキストの型は +mdn_zldrule_t 型であり、次のような opaque 型として定義されています。 +
++ ++typedef struct mdn_zldrule *mdn_zldrule_t; ++
以下にモジュールの提供するAPI関数を示します。 + +
+mdn_result_t +mdn_zldrule_create(mdn_zldrule_t *ctxp) ++
ZLDのマッチングを行うためのコンテキストを作成し、 +ctxp の指す領域に格納します。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
+ +
+void +mdn_zldrule_destroy(mdn_zldrule_t ctx) ++
mdn_zldrule_create で作成した +コンテキスト ctx を削除し、確保したメモリを解放します。 +
+ +
+mdn_result_t +mdn_zldrule_add(mdn_zldrule_t ctx, const char *zld, + const char **encodings, int nencodings) ++
mdn_zldrule_create で作成した +コンテキスト ctx に、ZLD zld と +encodings および nencodings で指定される +エンコーディングリストの組を登録します。 +
空の ZLD、つまり "" や "." は任意のドメイン名にマッチします。 +したがってZLDとして空の値を指定することによって、いずれの +ZLD にもマッチしなかった場合のデフォルトのエンコーディングを指定することが +可能です。 +
返される値は +mdn_success、 +mdn_nomemory +のいずれかです。 +
+ +
+mdn_result_t +mdn_zldrule_select(mdn_zldrule_t ctx, const char *domain, + char **zldp, mdn_converter_t *convctxp) ++
コンテキスト ctx に含まれている ZLD のリストと +ドメイン名 domain とのマッチングを試みます。マッチングは +ZLDが長い (ZLD を構成するラベルの数が多い) ものから順に行われます。 +
マッチするZLDがあった場合、zldp の指す領域に、マッチした +ZLD へのポインタが格納されます。返されるポインタはすでに +mdn_translator_canonicalzld +によって標準形式になっているので、そのまま +mdn_translator_translate への +引数として渡すことができます。 +
マッチしたZLD に対応するエンコーディングが一つだけなら、そのエンコーディング +に対応するコード変換コンテキストが convctxp の指す領域に +格納されます。 +対応するエンコーディングが複数あれば、リストの先頭から順に +domain がそのエンコーディングとして正しいかどうかを調べます。 +もし正しいものがあれば、最初に見つかったもののコード変換コンテキストが +convctxp の指す領域に格納されます。正しいものがなければ +convctxp には何も書き込まれず、mdn_invalid_encodingが +返されます。 +
マッチする ZLD がなければ mdn_notfoundを返して処理を終了します。 +
返される値は +mdn_success、 +mdn_notfound、 +mdn_invalid_encoding +のいずれかです。 + +
+ +
mdnconv はネームサーバの設定ファイル named.conf や +ゾーンマスタファイルのためのコードセット (エンコーディング) 変換ツールです。 +
mdnconv は引数で指定されたファイル、あるいは標準入力から +テキストを入力し、オプションで指定されたコードセット変換および正規化を +実行し、結果を標準出力に書き出します。 + +
具体的な使い方に関しては利用者ガイドの +named.conf、 +ゾーンマスタファイルの作成の項をご覧ください。 + +
+ +
++ ++% mdnconv [オプション...] [ファイル...] ++
指定しなかった場合には現在のロケールからデフォルトのコードセットを + 求めます。 +
+
指定しなかった場合には + クライアント設定ファイルの + + サーバエンコーディングエントリ + に設定されているコードセットが使用されます。 +
+
このオプションは複数指定することが可能です。複数指定した場合には、 + 指定した順に正規化が行われます。 + +
このオプションを指定しなかった場合には + クライアント設定ファイルの + 正規化エントリに + 指定されている正規化方式が使用されます。 +
+
このオプションを指定しなかった場合には + クライアント設定ファイルの + サーバ ZLD エントリに + 指定されている値が使用されます。 +
+
+
+
++ ++# "#" で始まる行はコメント +sjis Shift_JIS +euc-jp EUC-JP ++
+ +
mdnconv が行う変換処理をステップごとに記述します。 + +
+
+
通常は行全体を UTF-8 に変換しますが、入力コードセットが + "RACE" の場合には、RACE エンコーディングを識別するプリフィックスを用いて + RACE エンコードされた部分のみを取り出して UTF-8 に変換します。 +
+
+
+
取り出された部分のみを以降の正規化等の処理対象とします。 +
+
+
+
+
+
+
+
+ +
runmdn は BIND-4 あるいは BIND-8 をベースとした +リゾルバライブラリを持つクライアントを、 +再コンパイルなしに多言語ドメイン名を扱えるようにするためのコマンドです。 +
+ +
++ ++% runmdn コマンド [引数...] ++
例えば telnet コマンドで多言語ドメイン名を扱うためには +次のようにします。 +
++ ++% runmdn telnet ログイン.どこかの会社.jp ++
runmdn は共有ライブラリのプリロード機構を用いて、標準の +リゾルバライブラリに含まれる関数の一部を、多言語ドメイン名の処理機能を持つ +別のバージョンに動的に置換えることで、クライアントでの多言語ドメイン名の +処理を実現します。 + +
多くのシステムでは共有ライブラリのプリロードは環境変数 +LD_PRELOAD を用いて実現されています。この環境変数にプリロードしたい +共有ライブラリファイルのパス名を指定すると、クライアントの実行時に、 +アプリケーションに標準の共有ライブラリがリンクされる前に +指定したライブラリがリンクされます。これによって標準のライブラリ関数を +置換えることができます。 + +
したがって、runmdn の実体は、この環境変数を設定し、引数で +指定されたコマンドを起動するだけのシェルスクリプトであり、実際に +多言語ドメイン名の処理を行うのはアプリケーションにリンクされる +共有ライブラリ libmdnresolv です。 + +
libmdnresolv をリンクすることにより、BIND4 あるいは BIND8 ベースの +リゾルバライブラリで用いられている次の関数が置き換わります。 +
++ ++dn_comp +dn_expand +res_hnok +res_ownok +res_mailok +res_dnok ++
それぞれの変更点を簡単に記述します。 +
エンコーディング変換や正規化、ZLD の処理等はすべて +MDN ライブラリ (libmdn) の +res モジュールを使用しています。 +
+現在の実装では libmdnresolv は MDN ライブラリ (libmdn) を +呼び出すのではなく、libmdn 自体を内部に抱え込むような形態になっていますが、 +これは単なる実装上の都合からそうなっているだけで、論理的には MDN +ライブラリの機能を呼び出しているといってよいでしょう。 ++ +
また使用するエンコーディングや正規化の設定は +クライアント設定ファイルの設定を +利用します。 + +
runmdn にはいくつかの制限があり、どんなシステムでも使えるわけでは +ありません。 +
mDNkit は次のようなコンポーネントから構成されます。 + +
+
+
+
+
+
+
各コンポーネントがどこでどのように使われるのかを示したのが次の2枚の図です。 + +
1枚目は多言語ドメイン名の処理を dnsproxy を利用して行う場合の構成図です。 +
+
++ ++
2枚目は dnsproxy を使用せず、クライアント側のリゾルバで多言語ドメイン名の +処理を行う場合の構成図です。 +
+
++ ++
図中、イタリック体の部分が本キットに含まれるコンポーネントです。 + +
図の上半分は SJIS など、ローカルエンコーディングが使用される +世界で、下半分が UTF-8 など、多言語化された DNS が使用する +DNS プロトコル上のエンコーディングが使用される世界です。 +本キットが提供するコンポーネントはこれらの世界をつなぐためのものです。 + + + diff --git a/contrib/idn/mdnkit/doc/ja/spec/wrapper.html b/contrib/idn/mdnkit/doc/ja/spec/wrapper.html new file mode 100644 index 0000000000..01784febb3 --- /dev/null +++ b/contrib/idn/mdnkit/doc/ja/spec/wrapper.html @@ -0,0 +1,518 @@ + + + + +
+
+ +
+ラッパーDLL は、アプリケーションと元のDLL との間に割り込んで、 +アプリケーションからのDLL の呼び出しを横取りして、 +本来のDLL とは異なった処理をさせるものです。 +
+++
+アプリケーションからのDLL の呼び出しはラッパーに渡されます。 +ラッパーはそこで、付加的な処理を行なって、 +元のDLL のエントリを呼び出します。 +また、元のDLL の処理結果は一旦ラッパーに返され、 +ここでも付加的な処理を行なって、 +最終的な結果がアプリケーションに返されることになります。 +
+mDN wrapper では、WINSOCK DLLの +
++に対するラッパーDLL を提供して、 +多言語ドメイン名の名前解決ができるようにします。 ++
++ WSOCK32.DLL WINSOCK V1.1 + WS2_32.DLL WINSOCK V2.0
+++
++ 注 : ++ 16ビット版のWINSOCK (WINSOCK.DLL) は対象外です。 +
+
+mDN Wrapper はWINSOCK の名前解決に関連したAPI についてのみ +付加的な処理を行ないます。 +処理の対象となるWINSOCK APIは以下のものです。 +
| gethostbyaddr |
| gethostbyname |
| WSAAsyncGetHostByAddr |
| WSAAsyncGetHostByName |
+
| WSALookupServiceBeginA |
| WSALookupServiceNextA |
| WSALookupServiceEnd |
+アプリケーションによっては、 +これらのAPI を使わないで独自にドメイン名の解決を行なうものもあります。 +例えば、nslookupは、これらのAPI を使わないで、 +内部で独自にDNS リクエストの生成、解釈を行なっています。 +当然のことながら、これらのアプリケーションについては、 +mDN Wrapper では多言語化対応させることはできません。 +
+++
++ 注 : ++ dnsproxyはネットワーク上でDNS のリクエスト、 + レスポンスについて多言語化しますので、 + これらのアプリケーションについても多言語化させることができます。 + 必要に応じて適時使い分けるといいでしょう。 + 注 : ++ WINSOCK 2.0 には、WIDE CHARACTER ベースの名前解決のAPI として + ++
+ もありますが、これらについてはラップしません。 + これらのAPI はマイクロソフト仕様による国際化に対応したものですから、 + そのフレームワーク上で使うべきものです。 + これらについてはmDN Kit によって他の多言語フレームワークに + 変換してしまうのは危険ではないか、と判断しました。 ++ WSALookupServiceBeginW + WSALookupServiceNextW
+
+上記以外のWINSOCK API については、mDN Wrapper はなにもしないで、 +元のWINSOCK API を呼び出します。 +WINSOCK DLL にはドキュメントされていないエントリも含まれています。 +それらのエントリについては、呼び出しパラメタ等が判らないので、 +ラッパー内のコードから元のDLL のエントリを呼び出すことができません。 +そこで、mDN Wrapper は上記以外のエントリについては、 +function forwarding によって、 +DLL の呼び出しが元のDLL にフォワードされるようにしています。 +
+'function forwarding' を使う場合には、 +ラッパーDLL 作成時にフォワード先のDLL 名を明示的に指定する必要があり、 +そのDLL 名はラッパー自身とは別の名前、 +すなわち元のDLL とも別の名前、になっていなければなりません。 +mDN wrapper では、元のWINSOCK DLL を名前を変えてコピーし、 +それをフォワード先のDLL として使用するものとします。 +
+++
++ wsock32.dll -> wsock32o.dll + ws2_32.dll -> ws2_32o.dll
+ラッパーDLL は元のWINSOCK DLL と同じ名前で作成されます。 +従ってmDN wrapper がインストールされた状態では、 +
++となります。 ++
++ wsock32.dll mDN Wrapper for WINSOCK V1.1 + ws2_32.dll mDN Wrapper for WINSOCK V2.0 + wsock32o.dll Original WINSOCK V1.1 DLL + ws2_32o.dll Original WINSOCK V2.0 DLL
+
+ドメイン名の変換は、以下のタイミングで行なわれる必要があります。 +
+
+++
+- DNS へのリクエスト時 +
- +
+
++ ローカルエンコーディング -> DNS エンコーディング - DNS からの応答受信時 +
- +
+
++ DNS エンコーディング -> ローカルエンコーディング
+同期API においては、 +ローカルエンコーディングからDNS エンコーディングへの変換は、 +元のAPI を呼び出す前に行われ、 +DNS エンコーディングからローカルエンコーディングへの変換は、 +元のAPI から復帰してきたところで行なわれます。 +
+しかし、WINSOCK の以下のAPI は非同期API で、 +DNS からの応答受信前に復帰してしまいます。 +
+++
+- WSAAsyncGetHostByAddr +
- WSAAsyncGetHostByName +
+これらのAPI においては、名前解決の完了は、 +Windows へのメッセージによって通知されます。 +このため、 +DNS エンコーディングからローカルエンコーディングへの変換を行なうには、 +ラッパーは通知先のウィンドウプロシジャのメッセージキューをフックして、 +この完了メッセージを捕獲する必要があります。 +
+そこで、非同期API が呼び出された場合には、mDN Wrapper は、 +通知先のウィンドウプロシジャ(これはAPI のパラメタで指示されます)に +フックを設定します。 +フックが完了メッセージ(これもAPI のパラメタで指示されます)を検出したなら、 +フックは結果の格納領域(これもAPI のパラメタで指示されています)のドメイン名を、 +DNS 側のエンコーディングからローカルエンコーディングに変換するものとします。 +
+
+WINSOCK DLL はWindows のシステムディレクトリに置かれています。 +WINSOCK を確実にラップするには、システムディレクトリにおいて +
++を行なう必要があります。 ++
+- オリジナルWINSOCK DLL の名前の変更 +
- +
+ren wsock32.dll wsock32o.dll +ren ws2_32.dll ws2_32o.dll ++- ラッパーDLL の導入 +
- +
+copy somewhere\wsock32.dll wsock32.dll +copy somewhere\ws2_32.dll ws2_32.dll +copy another DLLs also ++
+しかし、システムディレクトリでこのようなDLL の置き換えを行なうのは +大変危険な操作になります。 +
+++
++ a) ++ DLL を入れ替えた状態で、もういちど同じ操作を行なうと、 + オリジナルのWINSOCK DLL が失われてしまうことになります。 + + b) ++ サービスパックやアプリケーションなどで、 + WINSOCK DLL を再導入するものがありますが、 + これによってもWINSOCK が利用不能になることがあります。 +
+このような状態になると、ネットワーク機能が全く使えなくなったり、 +最悪はWindows の起動すらできなくなる可能性があります。 +
+そこで、mDN Wrapper では、上のようなシステムレベルのラップではなく、 +アプリケーションに対するラップを基本機能として提供するものとします。 +
+Windows において、DLL は、基本的には +
+++
++ アプリケーションのロードディレクトリ + %SystemRoot%\System32 + %SystemRoot% + PATH で指示されるディレクトリ
+の順序で検索されて、最初に見つかったものがロードされます。 +ですから、一般的には、 +DLL をアプリケーションのロードディレクトリにインストールすれば、 +そのアプリケーションからのWINSOCK の呼び出しをラップすることができます。 +
+ただし、いくつかのアプリケーション、DLL では、 +検索パスを経由せずに特定のDLL をリンクするようになっているものがあります。 +このような構成のアプリケーション、DLL が使われた場合には +mDN Wrapper では対処することはできません。 +
+++
++ 注 : ++ Netscapeは特定DLL にバインドされているようで、 + アプリケーションディレクトリへのインストールではラップできません。 + WINSOCK DLL 自体もシステムディレクトリの関連DLL に + バインドされているようです。 + 一方、Internet ExploreやWindows Media Playerは + 標準のサーチパスに従っているので、 + ラップすることができます。 +
+
+WINSOCK 2.0 をサポートしているWindows には、 +WINSOCK の1.1 と2.0 のそれぞれに対応するDLL があり、 +WINSOCK 1.1 のAPI の呼び出しは +2.0 の同じエントリにリダイレクトされるようになっています。 +
+++
+この場合には1.1 に対する呼び出しも2.0 に対する呼び出しも、 +ともにV2.0用のDLL に渡されるので、 +2.0用のラッパーDLL 側だけで +エンコーディングの変換を行なうようにするべきでしょう。 +
+一方、WINSOCK 1.1 しかサポートしていない場合(Win95)には、 +1.1 に対応したDLL しかありません。 +
+++
+この場合には必然的に1.1 用のラッパーDLL で +エンコーディングを変換しなければなりません。 +
+mDN Wrapepr がwindows のシステムディレクトリにインストールされた場合には、 +上の通りに動作するので、 +
++する必要があります。 ++
++ WINSOCK 2.0 あり 2.0 ラッパーで変換 + WINSOCK 1.1 のみ 1.1 ラッパーで変換
+しかし、 +アプリケーションディレクトリにインストールされた場合には動作が変わってきます。 +Windows 付属の WINSOCK 1.1 DLLは、 +システムディレクトリのWINSOCK 2.0 にバインドされているため、 +アプリケーションディレクトリ側のWINSOCK 2.0 ラッパーDLL には +リダイレクトされてきません。 +このため、アプリケーションディレクトリへのインストールにおいては、 +1.1DLL、2.0DLLの両方でエンコーディングを変換する必要があります。 +
+このようなDLL 間のバインディングはドキュメントされていませんので、 +環境、バージョンによっては異なった動作をするかも知れません。 +そこでmDN Wrapper では、レジストリ値によって、 +ラッパーDLL のどこで変換を行なうかを決定するようにして、 +インストール先による差異、あるいはバージョンによる差異を吸収するようにします。 +
+mDN Wrapper 用のレジストリ設定は +
++以下に配置されます。エンコーディング変換を行なう位置については、 +この直下のレジストリ値 Where(REG_DWORD) によって決定します。 +有効な値は、 ++
++ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\MDN + HKEY_CURRENT_USER\SOFTWARE\JPNIC\MDN
+レジストリ Where (REG_DWORD) ++の4通りです。 +アプリケーションディレクトリにインストールする場合には「0」を、 +システムディレクトリにインストールする場合には「1」を設定する必要があります。 +レジストリ値が存在しない場合には「0」を想定します。 +これはアプリケーションディレクトリへのインストールを標準としたものです。 ++
++ 0 WINSOCK 1.1、WINSOCK 2.0 の両方で変換する + 1 WINSOCK 2.0 があれば、WINSOCK 2.0だけで変換する + WINSOCK 1.1 だけの場合には WINSOCK 1.1 で変換する + 2 WINSOCK 1.1 だけで変換する + 3 WINSOCK 2.0 だけで変換する
+
+ラッパーDLL では、解決しようとするドメイン名を、 +マシンのローカルエンコーディングからDNS サーバのエンコーディングに変換し、 +また、DNS が返してきたドメイン名(DNS サーバのエンコーディング)を +マシンのローカルエンコーディングに戻します。 +
+現在、DNS 側の多言語化エンコーディングについては、 +いくつもの方式が提案されています。 +ラッパーDLL はそれらのDNS 側エンコーディングのどれかひとつに +変換するように構成されます。 +このDNS 側エンコーディングはレジストリで指示されます。 +このレジストリには、mDN Wrapper のインストール時に +デフォルトエンコーディング(現時点ではRACE)が設定されます。 +当然、このレジストリは、後で他のものに変更することもできます。 +
+mDN Wrapper 用のレジストリ設定は +
++以下に配置されます。 +DNS 側のエンコーディングはレジストリ値 Encoding (REG_SZ)で指示されます。 +このエンコーディング名は、libmdnで認識されるものでなければなりません。 ++
++ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\MDN + HKEY_CURRENT_USER\SOFTWARE\JPNIC\MDN
+レジストリ Encoding (REG_SZ) +++DNS サーバ側のエンコーディング名を設定します ++
+一方、アプリケーションが使用しているローカルエンコーディングは、 +通常はプロセスのコードページから求めます。 +ラッパーDLL が使用する 'iconv' ライブラリは、 +windows のコードページ名を +エンコーディング名として受付けることができるので、 +コードページ名をそのままローカルエンコーディング名として使用します。 +
+しかし、アプリケーションによっては、 +特定の多言語化エンコーディングで +ドメイン名をエンコーディングしてしまうものもあります。 +例えば、IEではドメイン名をUTF-8 で表記するように +指示することができるようになっています。 +UTF-8 によるエンコーディングは、 +提案されている多言語化方式のひとつですが、 +多言語化されたDNS サーバは他のエンコーディングしか受付けないかも知れません。 +
+このような状況に対処するため、mDN Wrapper は、 +ローカルエンコーディングとして +プログラム特有のエンコーディングも受付けることができるようにします。 +このようなプログラム特有のローカルエンコーディングは +レジストリ記載されるものとします。 +
+mDN Wrapper 用のプログラム特有のレジストリ設定は +
++以下に、 +プログラム名(実行モジュールファイル名)をキーとして +配置されます。 +例えば、Internet Explore の場合には、 +実行モジュール名のIEXPLOREをキーとして ++
++ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\MDN\PerProg + HKEY_CURRENT_USER\SOFTWARE\JPNIC\MDN\PerProg
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\MDN\PerProg\IEXPLORE ++以下に置かれます。 +ローカルエンコーディング名は、レジストリ値Encoding (REG_SZ)で指示します。 +これもlibmdnで認識されるものでなければなりません。 +
+レジストリ Encoding (REG_SZ) ++ ++アプリケーションプログラム特有のエンコーディング名 +(デフォルトのエンコーディング以外を必要とする場合)を指定します。 ++
+ログレベル、ログファイルともに次のレジストリの下で設定されます。 +
+HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\MDN+
+HKEY_CURRENT_USER\SOFTWARE\JPNIC\MDN +
+ログレベルはレジストリ値 LogLevel (REG_DWORD) で指定します。定義されている +値は次の通りです。 +
+ログファイルはログを出力するファイルのパス名を指定するもので、 +レジストリ値 LogFile (REG_SZ) で指定します。デフォルトは +mDN Wrapper をインストールしたディレクトリの下の "mdn_wrapper.log" です。 +
+なお、ログレベルとログファイルはコンフィギュレーションプログラムを使用しても +設定することができます。 +
+
+
+mDN Wrapper の設定情報は、HKEY_LOCAL_MACHINE、HKEY_CURRENT_USERの +
+ Software\JPNIC\MDN ++以下に格納されます。 +mDN Wrapperは最初にHKEY_LOCAL_MACHINEの設定を読み込み、 +HKEY_CURRENT_USER側にも設定があれば、これで上書きします。 +通常は、HKEY_LOCAL_MACHINE 側だけを設定します。 +ユーザ個別に異なった設定を使いたい場合のみ、 +HKEY_CURRENT_USERを設定するようにしてください。 +
+特に、コンフィギュレーションプログラムは常に HKEY_LOCAL_MACHINE の +設定しか読み書きしません。コンフィギュレーションファイルを使用して +設定を行う場合には気をつけてください。 +
+
+全体の共通の設定と、プログラム個別設定とがあります。 +
+ Software\JPNIC\MDN\Where 変換位置 + 0:WINSOCK1.1 WINSOCK2.0の両方で + 1:WINSOCK2.0 があればそちらで + 2:WINSOCK1.1 だけで + 3:WINSOCK2.0 だけで + Software\JPNIC\MDN\Encoding DNS側エンコーディング名 + Software\JPNIC\MDN\Normalize 正規化の方式 + Software\JPNIC\MDN\LogLevel ログレベル + Software\JPNIC\MDN\LogFile ログファイル ++
+変換位置、およびプログラム側のエンコーディングは +プログラム毎に特定することもできます。 +これらは、以下のキーハイブの下に、 +プログラム名をキーとする値で設定します。 +
+ Software\JPNIC\MDN\PerProg\<name>\Where + Software\JPNIC\MDN\PerProg\<name>\Encoding ++指定されていない場合には、 +
++とみなします。 + ++
++ Where 0 1.1、2.0 の両方で変換 + Encoding プロセスのコードページ