summaryrefslogtreecommitdiffstats
path: root/contrib/idn/idnkit-1.0-src/include/idn
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/idn/idnkit-1.0-src/include/idn')
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/Makefile.in103
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/aliaslist.h114
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/api.h298
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/assert.h61
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/checker.h171
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/converter.h258
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/debug.h69
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/delimitermap.h123
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/export.h58
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/filechecker.h136
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/filemapper.h137
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/localencoding.h79
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/log.h107
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/logmacro.h72
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/mapper.h159
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/mapselector.h165
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/nameprep.h185
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/normalizer.h155
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/punycode.h70
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/race.h72
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/res.h309
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/resconf.h323
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/result.h86
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/strhash.h123
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/ucs4.h103
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/ucsmap.h131
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/ucsset.h145
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/unicode.h164
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/unormalize.h86
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/utf8.h137
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/util.h98
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/version.h70
32 files changed, 4367 insertions, 0 deletions
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/Makefile.in b/contrib/idn/idnkit-1.0-src/include/idn/Makefile.in
new file mode 100644
index 0000000..b99cf8c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/Makefile.in
@@ -0,0 +1,103 @@
+# $Id: Makefile.in,v 1.1.1.1 2003/06/04 00:25:34 marka Exp $
+# 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not 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.
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+includedir = @includedir@
+idnincludedir = $(includedir)/idn
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
+SHELL = @SHELL@
+
+HDRS = \
+ api.h \
+ assert.h \
+ checker.h \
+ converter.h \
+ debug.h \
+ delimitermap.h \
+ export.h \
+ filechecker.h \
+ filemapper.h \
+ localencoding.h \
+ log.h \
+ logmacro.h \
+ mapper.h \
+ mapselector.h \
+ nameprep.h \
+ normalizer.h \
+ punycode.h \
+ race.h \
+ res.h \
+ resconf.h \
+ result.h \
+ strhash.h \
+ ucsmap.h \
+ ucsset.h \
+ unicode.h \
+ unormalize.h \
+ ucs4.h \
+ utf8.h \
+ util.h \
+ version.h
+
+all:
+
+install:
+ $(MKINSTALLDIRS) $(DESTDIR)$(idnincludedir)
+ for hdr in $(HDRS); do \
+ $(INSTALL_DATA) $(srcdir)/$$hdr $(DESTDIR)$(idnincludedir)/$$hdr; \
+ done
+
+clean:
+ rm -f *~
+
+distclean: clean
+ rm -f Makefile
+
+test check:
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/aliaslist.h b/contrib/idn/idnkit-1.0-src/include/idn/aliaslist.h
new file mode 100644
index 0000000..61c3fd5
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/aliaslist.h
@@ -0,0 +1,114 @@
+/* $Id: aliaslist.h,v 1.1.1.1 2003/06/04 00:25:34 marka Exp $ */
+/*
+ * Copyright (c) 2002 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_ALIASLIST_H
+#define IDN_ALIASLIST_H 1
+
+#include <idn/result.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct idn__aliaslist *idn__aliaslist_t;
+
+/*
+ * Create a list.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn__aliaslist_create(idn__aliaslist_t *listp);
+
+/*
+ * Delete a list created by 'idn__aliaslist_create'.
+ */
+extern void
+idn__aliaslist_destroy(idn__aliaslist_t list);
+
+/*
+ * Parse alias information file and set items to the list.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nofile -- no such file.
+ * idn_invalid_syntax -- file is malformed.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn__aliaslist_aliasfile(idn__aliaslist_t list, const char *path);
+
+/*
+ * Add an item to the list.
+ *
+ * If top is 0, item is placed as the last item of the alias list.
+ * Otherwise, it is done as the first item.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn__aliaslist_additem(idn__aliaslist_t list,
+ const char *pattern, const char *encoding,
+ int first_item);
+
+/*
+ * Find the encoding name with the specified pattern by wildcard
+ * match.
+ *
+ * Returns:
+ * idn_success -- ok. found.
+ * idn_noentry -- not found.
+ */
+extern idn_result_t
+idn__aliaslist_find(idn__aliaslist_t list,
+ const char *pattern, char **encodingp);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_ALIASLIST_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/api.h b/contrib/idn/idnkit-1.0-src/include/idn/api.h
new file mode 100644
index 0000000..ca529f3
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/api.h
@@ -0,0 +1,298 @@
+/* $Id: api.h,v 1.1.1.1 2003/06/04 00:25:35 marka Exp $ */
+/*
+ * Copyright (c) 2001,2002 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_API_H
+#define IDN_API_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <idn/export.h>
+#include <idn/result.h>
+#include <idn/res.h>
+
+/*
+ * Application Programming Interface for Internationalized Domain Name
+ * Handling. This module provides high-level APIs for ordinary applications.
+ * Low-level APIs are also available. See "res.h" for details.
+ */
+
+/*
+ * Enable or disable IDN conversion scheme.
+ *
+ * If on_off is 0, IDN conversion scheme is disabled. Otherwise, IDN
+ * conversion is enabled even when IDN_DISABLE is defined.
+ */
+IDN_EXPORT void
+idn_enable(int on_off);
+
+/*
+ * Set configuration file name.
+ * This function is for private use only.
+ *
+ * When idn_nameinit(1) is called, this module loads `file'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_failure -- idn_nameinit() has already been
+ * called.
+ */
+extern idn_result_t
+idn__setconffile(const char *file);
+
+/*
+ * Initialize this module, and load configuration from the default
+ * configuration file (idn.conf).
+ *
+ * The initialization will be done only once when this function is
+ * called first, while either loading of the configuration file or
+ * setting the defaults behavior without the configuration file will
+ * be done every time it is called.
+ *
+ * If load_file is 0, this will set the defaults behavior without the
+ * configuration file. Otherwise, loading of the configuration file
+ * occurs.
+ *
+ * If 'idn_encodename' or 'idn_decodename' is called without calling
+ * this function, implicit initialization without the configuration
+ * file will be done prior to encoding/decoding process.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nofile -- cannot open the configuration file.
+ * idn_invalid_syntax -- syntax error found in the file.
+ * idn_invalid_name -- there are invalid names (encoding,
+ * normalization etc.).
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_nameinit(int load_file);
+
+/*
+ * Encode internationalized domain name.
+ *
+ * The encoding process consists of the following 7 steps.
+ *
+ * 1. Local encoding to UTF-8 conversion
+ * Converts a domain name written with local encoding (e.g. ISO-
+ * 8859-1) to UTF-8.
+ * 2. Delimiter mapping,
+ * Maps certain characters to period (U+002E, FULL STOP).
+ * 3. Local mapping
+ * Apply character mappings according with the TLD of the domain
+ * name.
+ * 4. NAMEPREP
+ * Perform NAME preparation described in RFC3491.
+ * This step consists of the following 4 steps:
+ * 4.1. Mapping
+ * 4.2. Normalization
+ * 4.3. Prohibited character check
+ * 4.4. Unassigned check
+ * 5. ASCII range character check
+ * Checks if the domain name contains non-LDH ASCII character (not
+ * alpha-numeric or hypen), or it begins or end with hypen.
+ * 6. UTF-8 to IDN encoding conversion.
+ * Converts the domain name from UTF-8 to ACE (e.g. Punycode).
+ * 7. Length check
+ * Checks the length of each label.
+ *
+ * 'actions' specifies actions and options of the encoding procedure.
+ * Its value is a bitwise-or of the following flags:
+ *
+ * IDN_LOCALCONV -- perform local encoding to UTF-8 conversion (step 1)
+ * IDN_DELIMMAP -- perform delimiter mapping (step 2)
+ * IDN_LOCALMAP -- perform local mapping (step 3)
+ * IDN_MAP -- perform mapping (step 4.1)
+ * IDN_NORMALIZE -- perform normalization (step 4.2)
+ * IDN_PROHCHECK -- perform prohibited character check (step 4.3)
+ * IDN_UNASCHECK -- perform unassigned codepoint check (step 4.4)
+ * IDN_ASCCHECK -- perform ASCII range character check (step 5)
+ * IDN_IDNCONV -- perform UTF-8 to IDN encoding conversion (step 6)
+ * IDN_LENCHECK -- perform length check (step 7)
+ *
+ * Also the following flags are provided for convinience:
+ *
+ * IDN_ENCODE_QUERY -- On libidnkit, perform step 1..7, except for step
+ * 4.4 and 5.
+ * On libidnkitlite, perform step 2..7, except for
+ * step 4.4 and 5.
+ * IDN_ENCODE_STORED -- On libidnkit, perform step 1..7, except for step
+ * 5.
+ * On libidnkitlite, perform step 2..7, except for
+ * step 5.
+ * IDN_ENCODE_APP -- Same as IDN_ENCODE_QUERY.
+ * IDN_NAMEPREP -- perform NAMEPREP (step 4) without unassigned
+ * codepoint check (step 4.4).
+ *
+ * The following flag does not corresponding to a particular action,
+ * but an option of conversion process:
+ *
+ * IDN_UNDOIFERR -- If any step fails, the original input name is
+ * returned.
+ *
+ * Note that if no flags are specified, 'idn_encodename' does nothing
+ * fancy, just copies the given name verbatim.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_action -- invalid action flag specified.
+ * idn_invalid_encoding -- the given string has invalid/illegal
+ * byte sequence.
+ * idn_invalid_length -- invalid length of a label.
+ * idn_prohibited -- prohibited/unassigned code point found.
+ * idn_buffer_overflow -- 'tolen' is too small.
+ * idn_nomemory -- malloc failed.
+ *
+ * Also, if this function is called without calling 'idn_nameinit',
+ * the following error codes might be returned.
+ * idn_nofile -- cannot open the configuration file.
+ * idn_invalid_syntax -- syntax error found in the file.
+ * idn_invalid_name -- there are invalid names (encoding,
+ * normalization etc.).
+ */
+IDN_EXPORT idn_result_t
+idn_encodename(idn_action_t actions, const char *from, char *to, size_t tolen);
+
+/*
+ * Decode internationalized domain name.
+ *
+ * The decoding process consists of the following 5 steps.
+ *
+ * 1. delimiter mapping
+ * Maps certain characters to period (U+002E, FULL STOP).
+ * 2. NAMEPREP
+ * Perform NAME preparation described in RFC3491.
+ * This step consists of the following 4 steps:
+ * 2.1. Mapping
+ * 2.2. Normalization
+ * 2.3. Prohibited character check
+ * 2.4. Unassigned check
+ * 3. IDN encoding to UTF-8 conversion.
+ * Converts the domain name from ACE (e.g. Punycode) to UCS4.
+ * 4. Perform round-trip check.
+ * Encode the result of step 3, and then compare it with the result
+ * of the step 2. If they are different, the check is failed.
+ * 5. Convert UTF-8 to local encoding.
+ * If a character in the domain name cannot be converted to local
+ * encoding, the conversion is failed.
+ *
+ * 'actions' specifies actions of the decoding procedure.
+ * Its value is a bitwise-or of the following flags:
+ *
+ * IDN_DELIMMAP -- perform delimiter mapping (step 1)
+ * IDN_MAP -- perform mapping (step 2.1)
+ * IDN_NORMALIZE -- perform normalization (step 2.2)
+ * IDN_PROHCHECK -- perform prohibited character check (step 2.3)
+ * IDN_UNASCHECK -- perform unassigned codepoint check (step 2.4)
+ * IDN_IDNCONV -- perform IDN encoding to UTF-8 conversion (step 3)
+ * IDN_RTCHECK -- perform round-trip check (step 4)
+ * IDN_ASCCHECK -- perform ASCII range character check while
+ * round-trip check (step 4.1)
+ * IDN_LOCALCONV -- perform UTF-8 to local encoding conversion (step 5)
+ *
+ * Also the following flags are provided for the convenience:
+ *
+ * IDN_DECODE_QUERY -- On libidnkit, perform step 1..5, except for step
+ * 2.4 and 4.1.
+ * On libidnkitlite, perform step 1..3, except for
+ * step 2.4 and 4.1.
+ * IDN_DECODE_STORED -- On libidnkit, perform step 1..5, except for step
+ * 4.1.
+ * On libidnkitlite, perform step 1..3, except for
+ * step 4.1.
+ * IDN_DECODE_APP -- Same as IDN_DECODE_QUERY.
+ * IDN_NAMEPREP -- perform NAMEPREP (step 2) without unassigned
+ * codepoint check (step 2.4).
+ *
+ * If any step fails, the original input name is returned.
+ * 'actions' specifies what actions to take when decoding, and is
+ * a bitwise-or of the following flags:
+ *
+ * Note that if no flags are specified, 'idn_decodename' does nothing
+ * but copying the given name verbatim.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_action -- invalid action flag specified.
+ * idn_invalid_encoding -- the given string has invalid/illegal
+ * byte sequence.
+ * idn_buffer_overflow -- 'tolen' is too small.
+ * idn_invalid_length -- length of a label is not 1..63 characters.
+ * idn_nomemory -- malloc failed.
+ *
+ * Also, if this function is called without calling 'idn_nameinit',
+ * the following error codes might be returned.
+ * idn_nofile -- cannot open the configuration file.
+ * idn_invalid_syntax -- syntax error found in the file.
+ * idn_invalid_name -- there are invalid names (encoding,
+ * normalization etc.).
+ */
+IDN_EXPORT idn_result_t
+idn_decodename(idn_action_t actions, const char *from, char *to, size_t tolen);
+
+/*
+ * Decode internationalized domain name with auxiliary encoding
+ * support.
+ *
+ * This is another API for IDN string decode. The difference between
+ * two is whether the encoding conversion from auxiliary encoding to
+ * UTF-8 occurs prior to the actual decode process (read description
+ * of idn_res_decodename() above) or not.
+ *
+ * If auxencoding is NULL, from is treated as UTF-8 encoded string.
+ *
+ * Other arguments serve exactly same role as those of
+ * idn_res_decodename().
+ */
+idn_result_t
+idn_decodename2(idn_action_t actions, const char *from, char *to, size_t tolen,
+ const char *auxencoding);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_API_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/assert.h b/contrib/idn/idnkit-1.0-src/include/idn/assert.h
new file mode 100644
index 0000000..12d4dac
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/assert.h
@@ -0,0 +1,61 @@
+/* $Id: assert.h,v 1.1.1.1 2003/06/04 00:25:35 marka Exp $ */
+/*
+ * 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_ASSERT_H
+#define IDN_ASSERT_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <assert.h>
+
+#ifndef DEBUG
+#define NDEBUG
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+# endif /* IDN_ASSERT_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/checker.h b/contrib/idn/idnkit-1.0-src/include/idn/checker.h
new file mode 100644
index 0000000..02af31b
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/checker.h
@@ -0,0 +1,171 @@
+/* $Id: checker.h,v 1.1.1.1 2003/06/04 00:25:36 marka Exp $ */
+/*
+ * Copyright (c) 2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_CHECKER_H
+#define IDN_CHECKER_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Character Checker.
+ *
+ * Perfom checking characters in the specified domain name.
+ */
+
+#include <idn/result.h>
+#include <idn/filechecker.h>
+#include <idn/nameprep.h>
+
+/*
+ * Schems name prefixes for the standard nameprep prohibit/unassigned
+ * checks.
+ *
+ * If you'd like to add the unassigned check scheme of "RFC3491"
+ * to a checker context, IDN_CHECKER_UNASSIGNED_PREFIX + "RFC3491"
+ * (i.e. "unassigned#RFC3491") is the scheme name passed to
+ * idn_checker_add().
+ */
+#define IDN_CHECKER_PROHIBIT_PREFIX "prohibit#"
+#define IDN_CHECKER_UNASSIGNED_PREFIX "unassigned#"
+#define IDN_CHECKER_BIDI_PREFIX "bidi#"
+
+/*
+ * Checker object type.
+ */
+typedef struct idn_checker *idn_checker_t;
+
+/*
+ * Initialize module. Must be called before any other calls of
+ * the functions of this module.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn_checker_initialize(void);
+
+/*
+ * Create a checker context.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn_checker_create(idn_checker_t *ctxp);
+
+/*
+ * Decrement reference count of the checker `ctx' created by
+ * 'idn_checker_create', if it is still refered by another object.
+ * Otherwise, release all the memory allocated to the checker.
+ */
+extern void
+idn_checker_destroy(idn_checker_t ctx);
+
+/*
+ * Increment reference count of the checker `ctx' created by
+ * 'idn_checker_create'.
+ */
+extern void
+idn_checker_incrref(idn_checker_t ctx);
+
+/*
+ * Add checking scheme `name' to the checker to `ctx'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_name -- the given name is not valid.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn_checker_add(idn_checker_t ctx, const char *name);
+
+extern idn_result_t
+idn_checker_addall(idn_checker_t ctx, const char **names, int nnames);
+
+/*
+ * Check a domain name. All checking schemes regsitered in `ctx' are
+ * applied in the regisration order.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_buffer_overflow -- output buffer is too small.
+ */
+extern idn_result_t
+idn_checker_lookup(idn_checker_t ctx, const unsigned long *ucs4,
+ const unsigned long **found);
+
+/*
+ * Checking procedure type.
+ */
+typedef idn_result_t (*idn_checker_createproc_t)(const char *parameter,
+ void **ctxp);
+typedef void (*idn_checker_destroyproc_t)(void *ctx);
+typedef idn_result_t (*idn_checker_lookupproc_t)(void *ctx,
+ const unsigned long *ucs4,
+ const unsigned long **found);
+
+/*
+ * Register a new checking scheme.
+ *
+ * You can override the default normalization schemes, if you want.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn_checker_register(const char *prefix,
+ idn_checker_createproc_t create,
+ idn_checker_destroyproc_t destroy,
+ idn_checker_lookupproc_t lookup);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_CHECKER_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/converter.h b/contrib/idn/idnkit-1.0-src/include/idn/converter.h
new file mode 100644
index 0000000..03248f6
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/converter.h
@@ -0,0 +1,258 @@
+/* $Id: converter.h,v 1.1.1.1 2003/06/04 00:25:36 marka Exp $ */
+/*
+ * 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_CONVERTER_H
+#define IDN_CONVERTER_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Codeset converter.
+ *
+ * This module provides conversions from some local codeset to UCS4
+ * and vice versa.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * Converter context type (opaque).
+ */
+typedef struct idn_converter *idn_converter_t;
+
+/*
+ * Conversion flags.
+ */
+#define IDN_CONVERTER_DELAYEDOPEN 1
+#define IDN_CONVERTER_RTCHECK 2
+
+/*
+ * Encoding types.
+ */
+#define IDN_NONACE 0
+#define IDN_ACE_STRICTCASE 1
+#define IDN_ACE_LOOSECASE 2
+
+/*
+ * Initialize module. Must be called before any other calls of
+ * the functions of this module.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_converter_initialize(void);
+
+/*
+ * Create a conversion context.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_name -- specified codeset is not supported.
+ * idn_nomemory -- malloc failed.
+ * idn_failure -- other failure (unknown cause).
+ */
+IDN_EXPORT idn_result_t
+idn_converter_create(const char *name, idn_converter_t *ctxp,
+ int flags);
+
+/*
+ * Decrement reference count of the converter `ctx' created by
+ * 'idn_converter_create', if it is still refered by another object.
+ * Otherwise, release all the memory allocated to the converter.
+ */
+IDN_EXPORT void
+idn_converter_destroy(idn_converter_t ctx);
+
+/*
+ * Increment reference count of the converter `ctx' created by
+ * 'idn_converter_create'.
+ */
+IDN_EXPORT void
+idn_converter_incrref(idn_converter_t ctx);
+
+/*
+ * Convert between local codeset and UCS4. Note that each conversion
+ * is started with initial state.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_buffer_overflow -- output buffer is too small.
+ * idn_invalid_encoding -- the input string has invalid/illegal
+ * byte sequence.
+ * idn_invalid_name -- codeset is not supported (this error
+ * should happen only if 'delayedopen'
+ * flag was set when idn_converter_create
+ * was called)
+ * idn_failure -- other failure.
+ */
+IDN_EXPORT idn_result_t
+idn_converter_convfromucs4(idn_converter_t ctx,
+ const unsigned long *from, char *to, size_t tolen);
+
+IDN_EXPORT idn_result_t
+idn_converter_convtoucs4(idn_converter_t ctx,
+ const char *from, unsigned long *to, size_t tolen);
+
+/*
+ * Get the name of local codeset. The returned name may be different from
+ * the one specified to idn_converter_create, if the specified one was an
+ * alias.
+ *
+ * Returns:
+ * the local codeset name.
+ */
+IDN_EXPORT char *
+idn_converter_localencoding(idn_converter_t ctx);
+
+/*
+ * Return the encoding type of this local encoding.
+ *
+ * Returns:
+ * IDN_NONACE -- encoding is not ACE.
+ * IDN_ACE_STRICTCASE -- encoding is ACE.
+ * decoder of this ACE preserve letter case.
+ * IDN_ACE_LOOSECASE -- encoding type is ACE.
+ * decoder cannot preserve letter case.
+ */
+IDN_EXPORT int
+idn_converter_encodingtype(idn_converter_t ctx);
+
+/*
+ * Return if this local encoding is ACE (Ascii Compatible Encoding).
+ *
+ * Returns:
+ * 1 -- yes, it is ACE.
+ * 0 -- no.
+ */
+IDN_EXPORT int
+idn_converter_isasciicompatible(idn_converter_t ctx);
+
+/*
+ * Register an alias for a codeset name.
+ *
+ * If first_item is 0, alias pattern is placed as the last item of the
+ * alias list. Otherwise, it is done as the first item.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_converter_addalias(const char *alias_name, const char *real_name,
+ int first_item);
+
+/*
+ * Register aliases defined by the specified file.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nofile -- no such file.
+ * idn_invalid_syntax -- file is malformed.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_converter_aliasfile(const char *path);
+
+/*
+ * Unregister all the aliases.
+ */
+IDN_EXPORT idn_result_t
+idn_converter_resetalias(void);
+
+/*
+ * resolve real encoding name from alias information.
+ */
+IDN_EXPORT const char *
+idn_converter_getrealname(const char *name);
+
+
+/*
+ * New converter registration.
+ */
+
+/*
+ * Conversion operation functions.
+ */
+typedef idn_result_t (*idn_converter_openproc_t)(idn_converter_t ctx,
+ void **privdata);
+typedef idn_result_t (*idn_converter_closeproc_t)(idn_converter_t ctx,
+ void *privdata);
+typedef idn_result_t
+ (*idn_converter_convfromucs4proc_t)(idn_converter_t ctx,
+ void *privdata,
+ const unsigned long *from,
+ char *to, size_t tolen);
+typedef idn_result_t
+ (*idn_converter_convtoucs4proc_t)(idn_converter_t ctx,
+ void *privdata,
+ const char *from,
+ unsigned long *to,
+ size_t tolen);
+
+/*
+ * Register a new converter.
+ * 'encoding_type' is a value which idn_converter_encodingtype() returns.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_converter_register(const char *name,
+ idn_converter_openproc_t openfromucs4,
+ idn_converter_openproc_t opentoucs4,
+ idn_converter_convfromucs4proc_t convfromucs4,
+ idn_converter_convtoucs4proc_t convtoucs4,
+ idn_converter_closeproc_t close,
+ int encoding_type);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_CONVERTER_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/debug.h b/contrib/idn/idnkit-1.0-src/include/idn/debug.h
new file mode 100644
index 0000000..35bb403
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/debug.h
@@ -0,0 +1,69 @@
+/* $Id: debug.h,v 1.1.1.1 2003/06/04 00:25:36 marka Exp $ */
+/*
+ * 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_DEBUG_H
+#define IDN_DEBUG_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Debug utility
+ */
+
+#include <idn/export.h>
+
+IDN_EXPORT char *idn__debug_hexstring(const char *s, int maxbytes);
+IDN_EXPORT char *idn__debug_xstring(const char *s, int maxbytes);
+IDN_EXPORT char *idn__debug_ucs4xstring(const unsigned long *s, int maxbytes);
+IDN_EXPORT char *idn__debug_utf16xstring(const unsigned short *s,
+ int maxbytes);
+IDN_EXPORT char *idn__debug_hexdata(const char *s, int length, int maxbytes);
+IDN_EXPORT void idn__debug_hexdump(const char *s, int maxbytes);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_DEBUG_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/delimitermap.h b/contrib/idn/idnkit-1.0-src/include/idn/delimitermap.h
new file mode 100644
index 0000000..9a2381d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/delimitermap.h
@@ -0,0 +1,123 @@
+/* $Id: delimitermap.h,v 1.1.1.1 2003/06/04 00:25:37 marka Exp $ */
+/*
+ * Copyright (c) 2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_DELIMITERMAP_H
+#define IDN_DELIMITERMAP_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Mapper.
+ *
+ * Perfom mapping local delimiters to `.'.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * Map object type.
+ */
+typedef struct idn_delimitermap *idn_delimitermap_t;
+
+/*
+ * Create a delimitermap context.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_delimitermap_create(idn_delimitermap_t *ctxp);
+
+/*
+ * Decrement reference count of the delimitermap `ctx' created by
+ * 'idn_delimitermap_create', if it is still refered by another object.
+ * Otherwise, release all the memory allocated to the delimitermap.
+ */
+IDN_EXPORT void
+idn_delimitermap_destroy(idn_delimitermap_t ctx);
+
+/*
+ * Increment reference count of the delimitermap `ctx' created by
+ * 'idn_delimitermap_create'.
+ */
+IDN_EXPORT void
+idn_delimitermap_incrref(idn_delimitermap_t ctx);
+
+/*
+ * Add a local delimiter.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_invalid_codepoint -- delimiter is not valid UCS4 character.
+ */
+IDN_EXPORT idn_result_t
+idn_delimitermap_add(idn_delimitermap_t ctx, unsigned long delimiter);
+
+IDN_EXPORT idn_result_t
+idn_delimitermap_addall(idn_delimitermap_t ctx, unsigned long *delimiters,
+ int ndelimiters);
+
+/*
+ * Map local delimiters in `from' to `.'.
+ *
+ * Note that if no delimiter is added to the context, the function copies
+ * the string.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_buffer_overflow -- output buffer is too small.
+ */
+IDN_EXPORT idn_result_t
+idn_delimitermap_map(idn_delimitermap_t ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_DELIMITERMAP_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/export.h b/contrib/idn/idnkit-1.0-src/include/idn/export.h
new file mode 100644
index 0000000..cb9443c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/export.h
@@ -0,0 +1,58 @@
+/* $Id: export.h,v 1.1.1.1 2003/06/04 00:25:37 marka Exp $ */
+/*
+ * Copyright (c) 2002 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_EXPORT_H
+#define IDN_EXPORT_H 1
+
+/*
+ * Macro for exporting functions.
+ *
+ * When creating a Windows DLL, define IDN_EXPORT something as
+ * "extern __declspec(dllexport)".
+ */
+
+#ifndef IDN_EXPORT
+#define IDN_EXPORT extern
+#endif
+
+# endif /* IDN_EXPORT_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/filechecker.h b/contrib/idn/idnkit-1.0-src/include/idn/filechecker.h
new file mode 100644
index 0000000..5904493
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/filechecker.h
@@ -0,0 +1,136 @@
+/* $Id: filechecker.h,v 1.1.1.1 2003/06/04 00:25:37 marka Exp $ */
+/*
+ * Copyright (c) 2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_FILECHECKER_H
+#define IDN_FILECHECKER_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Character checker -- check if there are any characters specified
+ * by a file in the given string.
+ */
+
+#include <idn/result.h>
+
+/*
+ * Check object type.
+ */
+typedef struct idn__filechecker *idn__filechecker_t;
+
+/*
+ * Read the contents of the given file and create a context for
+ * checking.
+ *
+ * 'file' is the pathname of the file, which specifies the set of
+ * characters to be checked. The file is a simple text file, and
+ * each line must be of the form either
+ * <code_point>
+ * or
+ * <code_point>-<code_point>
+ * (or comment, see below) where <code_point> is a UCS code point
+ * represented as hexadecimal string with optional prefix `U+'
+ * (ex. `0041' or `U+FEDC').
+ *
+ * The former specifies just one character (a code point, to be precise),
+ * while the latter specified a range of characters. In the case of
+ * a character range, the first code point (before hyphen) must not be
+ * greater than the second code point (after hyphen).
+ *
+ * Lines starting with `#' are comments.
+ *
+ * If file is read with no errors, the created context is stored in
+ * '*ctxp', and 'idn_success' is returned. Otherwise, the contents
+ * of '*ctxp' is undefined.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nofile -- cannot open the specified file.
+ * idn_nomemory -- malloc failed.
+ * idn_invalid_syntax -- file format is not valid.
+ */
+extern idn_result_t
+idn__filechecker_create(const char *file, idn__filechecker_t *ctxp);
+
+/*
+ * Release memory for the specified context.
+ */
+extern void
+idn__filechecker_destroy(idn__filechecker_t ctx);
+
+/*
+ * See if the given string contains any specified characters.
+ *
+ * Check if there is any characters pecified by the context 'ctx' in
+ * the UCS4 string 'str'. If there are none, NULL is stored in '*found'.
+ * Otherwise, the pointer to the first occurence of such character is
+ * stored in '*found'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ */
+extern idn_result_t
+idn__filechecker_lookup(idn__filechecker_t ctx, const unsigned long *str,
+ const unsigned long **found);
+
+/*
+ * The following functions are for internal use.
+ * They are used for this module to be add to the checker module.
+ */
+extern idn_result_t
+idn__filechecker_createproc(const char *parameter, void **ctxp);
+
+extern void
+idn__filechecker_destroyproc(void *ctxp);
+
+extern idn_result_t
+idn__filechecker_lookupproc(void *ctx, const unsigned long *str,
+ const unsigned long **found);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_FILECHECKER_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/filemapper.h b/contrib/idn/idnkit-1.0-src/include/idn/filemapper.h
new file mode 100644
index 0000000..f1fbc18
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/filemapper.h
@@ -0,0 +1,137 @@
+/* $Id: filemapper.h,v 1.1.1.1 2003/06/04 00:25:38 marka Exp $ */
+/*
+ * Copyright (c) 2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_FILEMAPPER_H
+#define IDN_FILEMAPPER_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Perform character mapping (substitution) according to a
+ * map file.
+ */
+
+#include <idn/result.h>
+
+/*
+ * Mapping object type.
+ */
+typedef struct idn__filemapper *idn__filemapper_t;
+
+/*
+ * Read the contents of the given map file and create a context for mapping.
+ *
+ * 'file' is the pathname of the file, which specifies the character
+ * mapping. The file is a simple text file, and each line specifies
+ * a mapping of a single character. The format of each line is
+ *
+ * <code_point>; [<code_point>..][;]
+ *
+ * where <code_point> is a UCS code point represented as a hexadecimal
+ * string with optional prefix `U+' (ex. `0041' or `U+FEDC').
+ * The code point before the first semicolon will be mapped to the
+ * sequence of code points separated by space characters after the
+ * first semicolon. The sequence may be empty, denoting wiping out
+ * the character.
+ *
+ * For example,
+ * U+0041; U+0061 -- maps 'A' to 'a'
+ * 20;; -- wipes out ' '
+ *
+ * Anything after the second semicolon is ignored. Also lines beginning
+ * with '#' are treated as comments.
+ *
+ * If there is no error, the created context is stored in '*ctxp'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nofile -- cannot open the specified file.
+ * idn_nomemory -- malloc failed.
+ * idn_invalid_syntax -- file format is not valid.
+ */
+extern idn_result_t
+idn__filemapper_create(const char *file, idn__filemapper_t *ctxp);
+
+/*
+ * Release memory for the given context.
+ */
+extern void
+idn__filemapper_destroy(idn__filemapper_t ctx);
+
+/*
+ * Perform character substitution.
+ *
+ * Each character in the string 'from' is examined and if it
+ * has a mapping, it is substituted to the corresponding
+ * character sequence. The substituted string is stored in 'to',
+ * whose length is specified by 'tolen'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_buffer_overflow -- result buffer is too small.
+ */
+extern idn_result_t
+idn__filemapper_map(idn__filemapper_t ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+/*
+ * The following functions are for internal use.
+ * They are used for this module to be add to the mapper module.
+ */
+extern idn_result_t
+idn__filemapper_createproc(const char *parameter, void **ctxp);
+
+extern void
+idn__filemapper_destroyproc(void *ctxp);
+
+extern idn_result_t
+idn__filemapper_mapproc(void *ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_FILEMAPPER_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/localencoding.h b/contrib/idn/idnkit-1.0-src/include/idn/localencoding.h
new file mode 100644
index 0000000..86c2c32
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/localencoding.h
@@ -0,0 +1,79 @@
+/* $Id: localencoding.h,v 1.1.1.1 2003/06/04 00:25:38 marka Exp $ */
+/*
+ * 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_LOCALENCODING_H
+#define IDN_LOCALENCODING_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Local codeset detection.
+ *
+ * Determine the local codeset (the codeset used by the current application),
+ * based on the locale information.
+ */
+
+#include <idn/export.h>
+
+#define IDN_LOCALCS_ENV "IDN_LOCAL_CODESET"
+
+/*
+ * Get the codeset name corresponding to the current locale,
+ * suitable for passing to 'idn_converter_create'.
+ *
+ * If the codeset cannot be determined, the locale name itself
+ * will be returned in the hope that codeset alias file translates it
+ * to the right name.
+ *
+ * If it cannot retrieve the current locale name, NULL will be
+ * returned.
+ */
+IDN_EXPORT const char *idn_localencoding_name(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_LOCALENCODING_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/log.h b/contrib/idn/idnkit-1.0-src/include/idn/log.h
new file mode 100644
index 0000000..c2d340c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/log.h
@@ -0,0 +1,107 @@
+/* $Id: log.h,v 1.1.1.1 2003/06/04 00:25:38 marka Exp $ */
+/*
+ * 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_LOG_H
+#define IDN_LOG_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * libidnkit logging facility.
+ */
+
+#include <idn/export.h>
+
+/*
+ * Log level definition.
+ */
+enum {
+ idn_log_level_fatal = 0,
+ idn_log_level_error = 1,
+ idn_log_level_warning = 2,
+ idn_log_level_info = 3,
+ idn_log_level_trace = 4,
+ idn_log_level_dump = 5
+};
+
+/*
+ * Log handler type.
+ */
+typedef void (*idn_log_proc_t)(int level, const char *msg);
+
+/*
+ * Log routines.
+ */
+IDN_EXPORT void idn_log_fatal(const char *fmt, ...);
+IDN_EXPORT void idn_log_error(const char *fmt, ...);
+IDN_EXPORT void idn_log_warning(const char *fmt, ...);
+IDN_EXPORT void idn_log_info(const char *fmt, ...);
+IDN_EXPORT void idn_log_trace(const char *fmt, ...);
+IDN_EXPORT void idn_log_dump(const char *fmt, ...);
+
+/*
+ * Set/get log level.
+ *
+ * If log level has not been explicitly defined by 'idn_log_setlevel',
+ * the default level is determined by the value of enrironment
+ * variable 'IDN_LOG_LEVEL'.
+ */
+IDN_EXPORT void idn_log_setlevel(int level);
+IDN_EXPORT int idn_log_getlevel(void);
+
+/*
+ * Set log handler.
+ *
+ * If no log handler is set, log goes to stderr by default.
+ * You can reset the handler to the default one by specifying
+ * NULL.
+ */
+IDN_EXPORT void idn_log_setproc(idn_log_proc_t proc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_LOG_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/logmacro.h b/contrib/idn/idnkit-1.0-src/include/idn/logmacro.h
new file mode 100644
index 0000000..bc55b6b
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/logmacro.h
@@ -0,0 +1,72 @@
+/* $Id: logmacro.h,v 1.1.1.1 2003/06/04 00:25:38 marka Exp $ */
+/*
+ * 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_LOGMACRO_H
+#define IDN_LOGMACRO_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <idn/log.h>
+
+#define FATAL(x) idn_log_fatal x
+#define ERROR(x) idn_log_error x
+#define WARNING(x) idn_log_warning x
+#define INFO(x) LOG_AT_LEVEL(idn_log_level_info, idn_log_info, x)
+#define TRACE(x) LOG_AT_LEVEL(idn_log_level_trace, idn_log_trace, x)
+
+#ifdef DEBUG
+#define DUMP(x) LOG_AT_LEVEL(idn_log_level_dump, idn_log_dump, x)
+#else
+#define DUMP(x)
+#endif /* DEBUG */
+
+#define LOG_AT_LEVEL(lv, fun, x) do {if (LOGLEVEL >= (lv)) fun x; } while (0)
+#define LOGLEVEL idn_log_getlevel()
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_LOGMACRO_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/mapper.h b/contrib/idn/idnkit-1.0-src/include/idn/mapper.h
new file mode 100644
index 0000000..a9c55c3
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/mapper.h
@@ -0,0 +1,159 @@
+/* $Id: mapper.h,v 1.1.1.1 2003/06/04 00:25:38 marka Exp $ */
+/*
+ * Copyright (c) 2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_MAPPER_H
+#define IDN_MAPPER_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Mapper.
+ *
+ * Perfom mapping the specified domain name.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+#include <idn/filemapper.h>
+#include <idn/nameprep.h>
+
+/*
+ * Map object type.
+ */
+typedef struct idn_mapper *idn_mapper_t;
+
+/*
+ * Initialize module. Must be called before any other calls of
+ * the functions of this module.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapper_initialize(void);
+
+/*
+ * Create a mapper context.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapper_create(idn_mapper_t *ctxp);
+
+/*
+ * Decrement reference count of the mapper `ctx' created by
+ * 'idn_mapper_create', if it is still refered by another object.
+ * Otherwise, release all the memory allocated to the mapper.
+ */
+IDN_EXPORT void
+idn_mapper_destroy(idn_mapper_t ctx);
+
+/*
+ * Increment reference count of the mapper `ctx' created by
+ * 'idn_mapper_create'.
+ */
+IDN_EXPORT void
+idn_mapper_incrref(idn_mapper_t ctx);
+
+/*
+ * Add mapping scheme `name' to the mapper to `ctx'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_name -- the given name is not valid.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapper_add(idn_mapper_t ctx, const char *name);
+
+IDN_EXPORT idn_result_t
+idn_mapper_addall(idn_mapper_t ctx, const char **names, int nnames);
+
+/*
+ * Map an UCS4 string. All mapping schemes regsitered in `ctx'
+ * are applied in the regisration order.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_buffer_overflow -- output buffer is too small.
+ */
+IDN_EXPORT idn_result_t
+idn_mapper_map(idn_mapper_t ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+/*
+ * Mapping procedure type.
+ */
+typedef idn_result_t (*idn_mapper_createproc_t)(const char *parameter,
+ void **ctxp);
+typedef void (*idn_mapper_destroyproc_t)(void *ctxp);
+typedef idn_result_t (*idn_mapper_mapproc_t)(void *ctx,
+ const unsigned long *from,
+ unsigned long *, size_t);
+
+/*
+ * Register a new mapping scheme.
+ *
+ * You can override the default normalization schemes, if you want.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapper_register(const char *prefix,
+ idn_mapper_createproc_t create,
+ idn_mapper_destroyproc_t destroy,
+ idn_mapper_mapproc_t map);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_MAPPER_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/mapselector.h b/contrib/idn/idnkit-1.0-src/include/idn/mapselector.h
new file mode 100644
index 0000000..a17aea6
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/mapselector.h
@@ -0,0 +1,165 @@
+/* $Id: mapselector.h,v 1.1.1.1 2003/06/04 00:25:39 marka Exp $ */
+/*
+ * Copyright (c) 2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_MAPSELECTOR_H
+#define IDN_MAPSELECTOR_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Map selector.
+ *
+ * Perfom mapping the specified domain name according with the TLD
+ * of the donmain name.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+#include <idn/mapper.h>
+
+/*
+ * Special TLDs for map selection.
+ */
+#define IDN_MAPSELECTOR_NOTLD "-"
+#define IDN_MAPSELECTOR_DEFAULTTLD "."
+
+IDN_EXPORT const unsigned long *
+idn_mapselector_getnotld(void);
+
+IDN_EXPORT const unsigned long *
+idn_mapselector_getdefaulttld(void);
+
+/*
+ * Mapselector object type.
+ */
+typedef struct idn_mapselector *idn_mapselector_t;
+
+/*
+ * Initialize module. Must be called before any other calls of
+ * the functions of this module.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapselector_initialize(void);
+
+/*
+ * Create a mapselector context.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapselector_create(idn_mapselector_t *ctxp);
+
+/*
+ * Decrement reference count of the mapselector `ctx' created by
+ * 'idn_mapselector_create', if it is still refered by another object.
+ * Otherwise, release all the memory allocated to the mapselector.
+ */
+IDN_EXPORT void
+idn_mapselector_destroy(idn_mapselector_t ctx);
+
+/*
+ * Increment reference count of the mapselector `ctx' created by
+ * 'idn_mapselector_create'.
+ */
+IDN_EXPORT void
+idn_mapselector_incrref(idn_mapselector_t ctx);
+
+/*
+ * Return the mapper for `tld' registered in `ctx', or return NULL if
+ * mapper for `tld' is not registered.
+ */
+IDN_EXPORT idn_mapper_t
+idn_mapselector_mapper(idn_mapselector_t ctx, const char *tld);
+
+/*
+ * Add mapping scheme `name' to the mapper for `tld' to the mapselector
+ * context `ctx'. If no mapper for `TLD' has not been registered, the
+ * function creates a new mapper for `tld', and then adds the given mapping
+ * scheme to the mapper. Otherwise, it adds the scheme to the mapper for
+ * TLD registered in `ctx'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_name -- the given tld or name is not valid.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapselector_add(idn_mapselector_t ctx, const char *tld, const char *name);
+
+IDN_EXPORT idn_result_t
+idn_mapselector_addall(idn_mapselector_t ctx, const char *tld,
+ const char **names, int nnames);
+
+/*
+ * Map an UCS4 string with the mapper for TLD of the domain name.
+ * If there is no mapper suitable for the domain name, the function
+ * simply copies the doman name.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_buffer_overflow -- output buffer is too small.
+ * idn_invalid_name -- the given tld is not valid.
+ */
+IDN_EXPORT idn_result_t
+idn_mapselector_map(idn_mapselector_t ctx, const unsigned long *from,
+ const char *tld, unsigned long *to, size_t tolen);
+
+IDN_EXPORT idn_result_t
+idn_mapselector_map2(idn_mapselector_t ctx, const unsigned long *from,
+ const unsigned long *tld, unsigned long *to,
+ size_t tolen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_MAPSELECTOR_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/nameprep.h b/contrib/idn/idnkit-1.0-src/include/idn/nameprep.h
new file mode 100644
index 0000000..af7d943
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/nameprep.h
@@ -0,0 +1,185 @@
+/* $Id: nameprep.h,v 1.1.1.1 2003/06/04 00:25:39 marka Exp $ */
+/*
+ * Copyright (c) 2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_NAMEPREP_H
+#define IDN_NAMEPREP_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Perform NAMEPREP (mapping, prohibited/unassigned checking).
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * BIDI type codes.
+ */
+typedef enum {
+ idn_biditype_r_al,
+ idn_biditype_l,
+ idn_biditype_others
+} idn_biditype_t;
+
+/*
+ * A Handle for nameprep operations.
+ */
+typedef struct idn_nameprep *idn_nameprep_t;
+
+
+/*
+ * The latest version of nameprep.
+ */
+#define IDN_NAMEPREP_CURRENT "RFC3491"
+
+/*
+ * Create a handle for nameprep operations.
+ * The handle is stored in '*handlep', which is used other functions
+ * in this module.
+ * The version of the NAMEPREP specification can be specified with
+ * 'version' parameter. If 'version' is NULL, the latest version
+ * is used.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_notfound -- specified version not found.
+ */
+IDN_EXPORT idn_result_t
+idn_nameprep_create(const char *version, idn_nameprep_t *handlep);
+
+/*
+ * Close a handle, which was created by 'idn_nameprep_create'.
+ */
+IDN_EXPORT void
+idn_nameprep_destroy(idn_nameprep_t handle);
+
+/*
+ * Perform character mapping on an UCS4 string specified by 'from', and
+ * store the result into 'to', whose length is specified by 'tolen'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_buffer_overflow -- result buffer is too small.
+ */
+IDN_EXPORT idn_result_t
+idn_nameprep_map(idn_nameprep_t handle, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+/*
+ * Check if an UCS4 string 'str' contains any prohibited characters specified
+ * by the draft. If found, the pointer to the first such character is stored
+ * into '*found'. Otherwise '*found' will be NULL.
+ *
+ * Returns:
+ * idn_success -- check has been done properly. (But this
+ * does not mean that no prohibited character
+ * was found. Check '*found' to see the
+ * result.)
+ */
+IDN_EXPORT idn_result_t
+idn_nameprep_isprohibited(idn_nameprep_t handle, const unsigned long *str,
+ const unsigned long **found);
+
+/*
+ * Check if an UCS4 string 'str' contains any unassigned characters specified
+ * by the draft. If found, the pointer to the first such character is stored
+ * into '*found'. Otherwise '*found' will be NULL.
+ *
+ * Returns:
+ * idn_success -- check has been done properly. (But this
+ * does not mean that no unassinged character
+ * was found. Check '*found' to see the
+ * result.)
+ */
+IDN_EXPORT idn_result_t
+idn_nameprep_isunassigned(idn_nameprep_t handle, const unsigned long *str,
+ const unsigned long **found);
+
+/*
+ * Check if an UCS4 string 'str' is valid string specified by ``bidi check''
+ * of the draft. If it is not valid, the pointer to the first invalid
+ * character is stored into '*found'. Otherwise '*found' will be NULL.
+ *
+ * Returns:
+ * idn_success -- check has been done properly. (But this
+ * does not mean that the string was valid.
+ * Check '*found' to see the result.)
+ */
+IDN_EXPORT idn_result_t
+idn_nameprep_isvalidbidi(idn_nameprep_t handle, const unsigned long *str,
+ const unsigned long **found);
+
+/*
+ * The following functions are for internal use.
+ * They are used for this module to be add to the checker and mapper modules.
+ */
+IDN_EXPORT idn_result_t
+idn_nameprep_createproc(const char *parameter, void **handlep);
+
+IDN_EXPORT void
+idn_nameprep_destroyproc(void *handle);
+
+IDN_EXPORT idn_result_t
+idn_nameprep_mapproc(void *handle, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+IDN_EXPORT idn_result_t
+idn_nameprep_prohibitproc(void *handle, const unsigned long *str,
+ const unsigned long **found);
+
+IDN_EXPORT idn_result_t
+idn_nameprep_unassignedproc(void *handle, const unsigned long *str,
+ const unsigned long **found);
+
+IDN_EXPORT idn_result_t
+idn_nameprep_bidiproc(void *handle, const unsigned long *str,
+ const unsigned long **found);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_NAMEPREP_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/normalizer.h b/contrib/idn/idnkit-1.0-src/include/idn/normalizer.h
new file mode 100644
index 0000000..e7e39b4
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/normalizer.h
@@ -0,0 +1,155 @@
+/* $Id: normalizer.h,v 1.1.1.1 2003/06/04 00:25:40 marka Exp $ */
+/*
+ * 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_NORMALIZER_H
+#define IDN_NORMALIZER_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Domain name normalizer.
+ *
+ * Perform normalization on the specified strings. String must be
+ * in UCS4 encoding.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * Normalizer type (opaque).
+ */
+typedef struct idn_normalizer *idn_normalizer_t;
+
+/*
+ * Normalizer procedure type.
+ */
+typedef idn_result_t (*idn_normalizer_proc_t)(const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+/*
+ * Initialize this module.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_normalizer_initialize(void);
+
+/*
+ * Create a empty normalizer.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_normalizer_create(idn_normalizer_t *ctxp);
+
+/*
+ * Decrement reference count of the normalizer `ctx' created by
+ * 'idn_normalizer_create', if it is still refered by another object.
+ * Otherwise, release all the memory allocated to the normalizer.
+ */
+IDN_EXPORT void
+idn_normalizer_destroy(idn_normalizer_t ctx);
+
+/*
+ * Increment reference count of the normalizer `ctx' created by
+ * 'idn_normalizer_create'.
+ */
+IDN_EXPORT void
+idn_normalizer_incrref(idn_normalizer_t ctx);
+
+/*
+ * Add a normalization scheme to a normalizer.
+ *
+ * Multiple shemes can be added to a normalizer, and they will be
+ * applied in order.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_name -- unknown scheme was specified.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_normalizer_add(idn_normalizer_t ctx, const char *scheme_name);
+
+IDN_EXPORT idn_result_t
+idn_normalizer_addall(idn_normalizer_t ctx, const char **scheme_names,
+ int nschemes);
+
+/*
+ * Perform normalization(s) defined by a normalizer to the specified string,
+ * If the normalizer has two or more normalization schemes, they are
+ * applied in order.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_buffer_overflow -- output buffer is too small.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_normalizer_normalize(idn_normalizer_t ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+/*
+ * Register a new normalization scheme.
+ *
+ * You can override the default normalization schemes, if you want.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_normalizer_register(const char *scheme_name, idn_normalizer_proc_t proc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_NORMALIZER_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/punycode.h b/contrib/idn/idnkit-1.0-src/include/idn/punycode.h
new file mode 100644
index 0000000..5650a8e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/punycode.h
@@ -0,0 +1,70 @@
+/* $Id: punycode.h,v 1.1.1.1 2003/06/04 00:25:40 marka Exp $ */
+/*
+ * Copyright (c) 2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_PUNYCODE_H
+#define IDN_PUNYCODE_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Punycode Converter.
+ */
+
+#include <idn/result.h>
+#include <idn/converter.h>
+
+extern idn_result_t
+idn__punycode_decode(idn_converter_t ctx, void *privdata,
+ const char *from, unsigned long *to, size_t tolen);
+
+extern idn_result_t
+idn__punycode_encode(idn_converter_t ctx, void *privdata,
+ const unsigned long *from, char *to, size_t tolen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_PUNYCODE_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/race.h b/contrib/idn/idnkit-1.0-src/include/idn/race.h
new file mode 100644
index 0000000..43a090b
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/race.h
@@ -0,0 +1,72 @@
+/* $Id: race.h,v 1.1.1.1 2003/06/04 00:25:40 marka Exp $ */
+/*
+ * 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_RACE_H
+#define IDN_RACE_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * RACE Converter.
+ *
+ * See Internet Draft draft-ietf-idn-race-03.txt for details.
+ */
+
+#include <idn/result.h>
+#include <idn/converter.h>
+
+extern idn_result_t
+idn__race_encode(idn_converter_t ctx, void *privdata,
+ const unsigned long *from, char *to, size_t tolen);
+
+extern idn_result_t
+idn__race_decode(idn_converter_t ctx, void *privdata,
+ const char *from, unsigned long *to, size_t tolen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_RACE_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/res.h b/contrib/idn/idnkit-1.0-src/include/idn/res.h
new file mode 100644
index 0000000..ab7873d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/res.h
@@ -0,0 +1,309 @@
+/* $Id: res.h,v 1.1.1.1 2003/06/04 00:25:41 marka Exp $ */
+/*
+ * Copyright (c) 2001,2002 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_RES_H
+#define IDN_RES_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Resolver library support.
+ *
+ * All the functions provided by this module requires IDN resolver
+ * configuration context of type 'idn_resconf_t' as an argument.
+ * This context holds information described in the configuration file
+ * (idn.conf). See idn_resconf module for details.
+ *
+ * All functions also accept NULL as the context, but since
+ * no conversion/normalization will be done in this case, it is
+ * pretty useless.
+ */
+
+#include <idn/export.h>
+#include <idn/resconf.h>
+#include <idn/result.h>
+
+typedef unsigned long idn_action_t;
+
+/*
+ * Actions
+ */
+#define IDN_LOCALCONV 0x00000001 /* Local encoding <-> UTF-8 conversion */
+#define IDN_DELIMMAP 0x00000002 /* Delimiter mapping */
+#define IDN_LOCALMAP 0x00000004 /* Local mapping */
+#define IDN_MAP 0x00000008 /* NAMEPREP map */
+#define IDN_NORMALIZE 0x00000010 /* NAMEPREP normalize */
+#define IDN_PROHCHECK 0x00000020 /* NAMEPREP prohibited character check */
+#define IDN_UNASCHECK 0x00000040 /* Unassigned code point check */
+#define IDN_BIDICHECK 0x00000080 /* bidirectional string check */
+#define IDN_ASCCHECK 0x00000100 /* Non-LDH ASCII check */
+#define IDN_IDNCONV 0x00000200 /* UTF-8 <-> IDN encoding conversion */
+#define IDN_LENCHECK 0x00000400 /* Label length check */
+#define IDN_RTCHECK 0x00000800 /* Round trip check */
+#define IDN_UNDOIFERR 0x00001000 /* Option: undo if error occurs */
+
+#define IDN_ENCODE_QUERY 0x00002000 /* Encode query string */
+#define IDN_DECODE_QUERY 0x00004000 /* Decode query string */
+
+#define IDN_ENCODE_APP \
+(IDN_ENCODE_QUERY | IDN_ASCCHECK) /* Standard encode */
+#define IDN_DECODE_APP \
+(IDN_DECODE_QUERY | IDN_ASCCHECK) /* Standard decode */
+
+#define IDN_ENCODE_STORED \
+(IDN_ENCODE_QUERY | IDN_ASCCHECK | IDN_UNASCHECK) /* Encode query string */
+#define IDN_DECODE_STORED \
+(IDN_DECODE_QUERY | IDN_ASCCHECK | IDN_UNASCHECK) /* Decode query string */
+
+
+#define IDN_NAMEPREP \
+(IDN_MAP | IDN_NORMALIZE | IDN_PROHCHECK | IDN_BIDICHECK)
+
+/*
+ * Enable or disable IDN conversion scheme.
+ *
+ * If on_off is 0, IDN conversion scheme is disabled. Otherwise, IDN
+ * conversion is enabled even when IDN_DISABLE is defined.
+ */
+IDN_EXPORT void
+idn_res_enable(int on_off);
+
+/*
+ * Encode internationalized domain name.
+ *
+ * The encoding process consists of the following 7 steps.
+ *
+ * 1. Local encoding to UTF-8 conversion
+ * Converts a domain name written with local encoding (e.g. ISO-
+ * 8859-1) to UTF-8.
+ * 2. Delimiter mapping,
+ * Maps certain characters to period (U+002E, FULL STOP).
+ * 3. Local mapping
+ * Apply character mappings according with the TLD of the domain
+ * name.
+ * 4. NAMEPREP
+ * Perform NAME preparation described in RFC3491.
+ * This step consists of the following 4 steps:
+ * 4.1. Mapping
+ * 4.2. Normalization
+ * 4.3. Prohibited character check
+ * 4.4. Unassigned check
+ * 5. ASCII range character check
+ * Checks if the domain name contains non-LDH ASCII character (not
+ * alpha-numeric or hypen), or it begins or end with hypen.
+ * 6. UTF-8 to IDN encoding conversion.
+ * Converts the domain name from UTF-8 to ACE (e.g. Punycode).
+ * 7. Length check
+ * Checks the length of each label.
+ *
+ * 'actions' specifies actions and options of the encoding procedure.
+ * Its value is a bitwise-or of the following flags:
+ *
+ * IDN_LOCALCONV -- perform local encoding to UTF-8 conversion (step 1)
+ * IDN_DELIMMAP -- perform delimiter mapping (step 2)
+ * IDN_LOCALMAP -- perform local mapping (step 3)
+ * IDN_MAP -- perform mapping (step 4.1)
+ * IDN_NORMALIZE -- perform normalization (step 4.2)
+ * IDN_PROHCHECK -- perform prohibited character check (step 4.3)
+ * IDN_UNASCHECK -- perform unassigned codepoint check (step 4.4)
+ * IDN_ASCCHECK -- perform ASCII range character check (step 5)
+ * IDN_IDNCONV -- perform UTF-8 to IDN encoding conversion (step 6)
+ * IDN_LENCHECK -- perform length check (step 7)
+ *
+ * Also the following flags are provided for convinience:
+ *
+ * IDN_ENCODE_QUERY -- On libidnkit, perform step 1..7, except for step
+ * 4.4 and 5.
+ * On libidnkitlite, perform step 2..7, except for
+ * step 4.4 and 5.
+ * IDN_ENCODE_STORED -- On libidnkit, perform step 1..7, except for step
+ * 5.
+ * On libidnkitlite, perform step 2..7, except for
+ * step 5.
+ * IDN_ENCODE_APP -- Same as IDN_ENCODE_QUERY.
+ * IDN_NAMEPREP -- perform NAMEPREP (step 4) without unassigned
+ * codepoint check (step 4.4).
+ *
+ * The following flag does not corresponding to a particular action,
+ * but an option of conversion process:
+ *
+ * IDN_UNDOIFERR -- If any step fails, the original input name is
+ * returned.
+ *
+ * Note that if no flags are specified, 'idn_encodename' does nothing
+ * fancy, just copies the given name verbatim.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_action -- invalid action flag specified.
+ * idn_invalid_encoding -- the given string has invalid/illegal
+ * byte sequence.
+ * idn_invalid_length -- invalid length of a label.
+ * idn_prohibited -- prohibited/unassigned code point found.
+ * idn_buffer_overflow -- 'tolen' is too small.
+ * idn_nomemory -- malloc failed.
+ *
+ * Also, if this function is called without calling 'idn_nameinit',
+ * the following error codes might be returned.
+ * idn_nofile -- cannot open the configuration file.
+ * idn_invalid_syntax -- syntax error found in the file.
+ * idn_invalid_name -- there are invalid names (encoding,
+ * normalization etc.).
+ */
+IDN_EXPORT idn_result_t
+idn_res_encodename(idn_resconf_t ctx, idn_action_t actions, const char *from,
+ char *to, size_t tolen);
+
+/*
+ * Decode internationalized domain name.
+ *
+ * The decoding process consists of the following 5 steps.
+ *
+ * 1. delimiter mapping
+ * Maps certain characters to period (U+002E, FULL STOP).
+ * 2. NAMEPREP
+ * Perform NAME preparation described in RFC3491.
+ * This step consists of the following 4 steps:
+ * 2.1. Mapping
+ * 2.2. Normalization
+ * 2.3. Prohibited character check
+ * 2.4. Unassigned check
+ * 3. IDN encoding to UTF-8 conversion.
+ * Converts the domain name from ACE (e.g. Punycode) to UCS4.
+ * 4. Perform round-trip check.
+ * Encode the result of step 3, and then compare it with the result
+ * of the step 2. If they are different, the check is failed.
+ * 5. Convert UTF-8 to local encoding.
+ * If a character in the domain name cannot be converted to local
+ * encoding, the conversion is failed.
+ *
+ * 'actions' specifies actions of the decoding procedure.
+ * Its value is a bitwise-or of the following flags:
+ *
+ * IDN_DELIMMAP -- perform delimiter mapping (step 1)
+ * IDN_MAP -- perform mapping (step 2.1)
+ * IDN_NORMALIZE -- perform normalization (step 2.2)
+ * IDN_PROHCHECK -- perform prohibited character check (step 2.3)
+ * IDN_UNASCHECK -- perform unassigned codepoint check (step 2.4)
+ * IDN_IDNCONV -- perform IDN encoding to UTF-8 conversion (step 3)
+ * IDN_RTCHECK -- perform round-trip check (step 4)
+ * IDN_ASCCHECK -- perform ASCII range character check while
+ * round-trip check (step 4.1)
+ * IDN_LOCALCONV -- perform UTF-8 to local encoding conversion (step 5)
+ *
+ * Also the following flags are provided for the convenience:
+ *
+ * IDN_DECODE_QUERY -- On libidnkit, perform step 1..5, except for step
+ * 2.4 and 4.1.
+ * On libidnkitlite, perform step 1..3, except for
+ * step 2.4 and 4.1.
+ * IDN_DECODE_STORED -- On libidnkit, perform step 1..5, except for step
+ * 4.1.
+ * On libidnkitlite, perform step 1..3, except for
+ * step 4.1.
+ * IDN_DECODE_APP -- Same as IDN_DECODE_QUERY.
+ * IDN_NAMEPREP -- perform NAMEPREP (step 2) without unassigned
+ * codepoint check (step 2.4).
+ *
+ * If any step fails, the original input name is returned.
+ * 'actions' specifies what actions to take when decoding, and is
+ * a bitwise-or of the following flags:
+ *
+ * Note that if no flags are specified, 'idn_decodename' does nothing
+ * but copying the given name verbatim.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_action -- invalid action flag specified.
+ * idn_invalid_encoding -- the given string has invalid/illegal
+ * byte sequence.
+ * idn_buffer_overflow -- 'tolen' is too small.
+ * idn_invalid_action -- length of a label is not 1..63 characters.
+ * idn_nomemory -- malloc failed.
+ *
+ * Also, if this function is called without calling 'idn_nameinit',
+ * the following error codes might be returned.
+ * idn_nofile -- cannot open the configuration file.
+ * idn_invalid_syntax -- syntax error found in the file.
+ * idn_invalid_name -- there are invalid names (encoding,
+ * normalization etc.).
+ */
+IDN_EXPORT idn_result_t
+idn_res_decodename(idn_resconf_t ctx, idn_action_t actions, const char *from,
+ char *to, size_t tolen);
+
+/*
+ * Decode internationalized domain name with auxiliary encoding
+ * support.
+ *
+ * This is another API for IDN string decode. The difference between
+ * two is whether the encoding conversion from auxiliary encoding to
+ * UTF-8 occurs prior to the actual decode process (read description
+ * of idn_res_decodename() above) or not.
+ *
+ * If auxencoding is NULL, from is treated as UTF-8 encoded string.
+ *
+ * Other arguments serve exactly same role as those of
+ * idn_res_decodename().
+ */
+idn_result_t
+idn_res_decodename2(idn_resconf_t ctx, idn_action_t actions, const char *from,
+ char *to, size_t tolen, const char *auxencoding);
+
+/*
+ * Convert `actions' to a string, and then return the string.
+ * This function is for internal use only.
+ *
+ * Note that this function returns a pointer to static buffer.
+ */
+extern const char *
+idn__res_actionstostring(idn_action_t actions);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_RES_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/resconf.h b/contrib/idn/idnkit-1.0-src/include/idn/resconf.h
new file mode 100644
index 0000000..1aed8bd
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/resconf.h
@@ -0,0 +1,323 @@
+/* $Id: resconf.h,v 1.1.1.1 2003/06/04 00:25:41 marka Exp $ */
+/*
+ * 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_RESCONF_H
+#define IDN_RESCONF_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * IDN resolver configuration.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+#include <idn/converter.h>
+#include <idn/normalizer.h>
+#include <idn/checker.h>
+#include <idn/mapper.h>
+#include <idn/mapselector.h>
+#include <idn/delimitermap.h>
+
+/*
+ * Configuration type (opaque).
+ */
+typedef struct idn_resconf *idn_resconf_t;
+
+/*
+ * Initialize.
+ *
+ * Initialize this module and underlying ones. Must be called before
+ * any other functions of this module.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_resconf_initialize(void);
+
+/*
+ * Create a configuration context.
+ *
+ * Create an empty context and store it in '*ctxp'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_resconf_create(idn_resconf_t *ctxp);
+
+/*
+ * Destroy the configuration context.
+ *
+ * Destroy the configuration context created by 'idn_resconf_create',
+ * and release memory for it.
+ */
+IDN_EXPORT void
+idn_resconf_destroy(idn_resconf_t ctx);
+
+/*
+ * Increment reference count of the context created by 'idn_resconf_create'.
+ */
+IDN_EXPORT void
+idn_resconf_incrref(idn_resconf_t ctx);
+
+/*
+ * Set default configurations to resconf context.
+ *
+ * "default configurations" means current nameprep and IDN encoding
+ * which IDN standard document suggests.
+ *
+ * Warning: configurations set previously are removed.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_syntax -- syntax error found.
+ * idn_invalid_name -- invalid encoding/nomalization name is
+ * specified.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_resconf_setdefaults(idn_resconf_t ctx);
+
+/*
+ * Load configuration file.
+ *
+ * Parse a configuration file whose name is specified by 'file',
+ * store the result in 'ctx'. If 'file' is NULL, the default file is
+ * loaded.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nofile -- couldn't open specified file.
+ * idn_invalid_syntax -- syntax error found.
+ * idn_invalid_name -- invalid encoding/nomalization name is
+ * specified.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_resconf_loadfile(idn_resconf_t ctx, const char *file);
+
+/*
+ * Get the pathname of the default configuration file.
+ *
+ * Returns:
+ * the pathname of the default configuration file.
+ */
+IDN_EXPORT char *
+idn_resconf_defaultfile(void);
+
+/*
+ * Get an object of lower module that `ctx' holds.
+ */
+IDN_EXPORT idn_delimitermap_t
+idn_resconf_getdelimitermap(idn_resconf_t ctx);
+
+IDN_EXPORT idn_converter_t
+idn_resconf_getidnconverter(idn_resconf_t ctx);
+
+IDN_EXPORT idn_converter_t
+idn_resconf_getauxidnconverter(idn_resconf_t ctx);
+
+IDN_EXPORT idn_converter_t
+idn_resconf_getlocalconverter(idn_resconf_t ctx);
+
+IDN_EXPORT idn_mapselector_t
+idn_resconf_getlocalmapselector(idn_resconf_t ctx);
+
+IDN_EXPORT idn_mapper_t
+idn_resconf_getmapper(idn_resconf_t ctx);
+
+IDN_EXPORT idn_normalizer_t
+idn_resconf_getnormalizer(idn_resconf_t ctx);
+
+IDN_EXPORT idn_checker_t
+idn_resconf_getprohibitchecker(idn_resconf_t ctx);
+
+IDN_EXPORT idn_checker_t
+idn_resconf_getunassignedchecker(idn_resconf_t ctx);
+
+IDN_EXPORT idn_checker_t
+idn_resconf_getbidichecker(idn_resconf_t ctx);
+
+/*
+ * Set an object of lower module to `ctx'.
+ */
+IDN_EXPORT void
+idn_resconf_setdelimitermap(idn_resconf_t ctx,
+ idn_delimitermap_t delimiter_mapper);
+
+IDN_EXPORT void
+idn_resconf_setidnconverter(idn_resconf_t ctx,
+ idn_converter_t idn_coverter);
+
+IDN_EXPORT void
+idn_resconf_setauxidnconverter(idn_resconf_t ctx,
+ idn_converter_t aux_idn_coverter);
+
+IDN_EXPORT void
+idn_resconf_setlocalconverter(idn_resconf_t ctx,
+ idn_converter_t local_converter);
+
+IDN_EXPORT void
+idn_resconf_setlocalmapselector(idn_resconf_t ctx,
+ idn_mapselector_t map_selector);
+
+IDN_EXPORT void
+idn_resconf_setmapper(idn_resconf_t ctx, idn_mapper_t mapper);
+
+IDN_EXPORT void
+idn_resconf_setnormalizer(idn_resconf_t ctx, idn_normalizer_t normalizer);
+
+IDN_EXPORT void
+idn_resconf_setprohibitchecker(idn_resconf_t ctx,
+ idn_checker_t prohibit_checker);
+
+IDN_EXPORT void
+idn_resconf_setunassignedchecker(idn_resconf_t ctx,
+ idn_checker_t unassigned_checker);
+
+IDN_EXPORT void
+idn_resconf_setbidichecker(idn_resconf_t ctx,
+ idn_checker_t bidi_checker);
+
+/*
+ * Set name or add names to an object of lower module that `ctx' holds.
+ */
+IDN_EXPORT idn_result_t
+idn_resconf_setidnconvertername(idn_resconf_t ctx, const char *name,
+ int flags);
+
+IDN_EXPORT idn_result_t
+idn_resconf_setauxidnconvertername(idn_resconf_t ctx, const char *name,
+ int flags);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addalldelimitermapucs(idn_resconf_t ctx, unsigned long *v, int nv);
+
+IDN_EXPORT idn_result_t
+idn_resconf_setlocalconvertername(idn_resconf_t ctx, const char *name,
+ int flags);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addalllocalmapselectornames(idn_resconf_t ctx, const char *tld,
+ const char **names, int nnames);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addallmappernames(idn_resconf_t ctx, const char **names,
+ int nnames);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addallnormalizernames(idn_resconf_t ctx, const char **names,
+ int nnames);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addallprohibitcheckernames(idn_resconf_t ctx, const char **names,
+ int nnames);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addallunassignedcheckernames(idn_resconf_t ctx, const char **names,
+ int nnames);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addallbidicheckernames(idn_resconf_t ctx, const char **names,
+ int nnames);
+
+IDN_EXPORT idn_result_t
+idn_resconf_setnameprepversion(idn_resconf_t ctx, const char *version);
+
+/*
+ * These macros are provided for backward compatibility to mDNkit 2.1
+ * and older.
+ */
+IDN_EXPORT void
+idn_resconf_setalternateconverter(idn_resconf_t ctx,
+ idn_converter_t alternate_converter);
+
+IDN_EXPORT idn_result_t
+idn_resconf_setalternateconvertername(idn_resconf_t ctx, const char *name,
+ int flags);
+
+IDN_EXPORT idn_converter_t
+idn_resconf_getalternateconverter(idn_resconf_t ctx);
+
+
+/*
+ * These macros are provided for backward compatibility to idnkit 1.x.
+ */
+#define idn_resconf_localconverter(ctx) \
+ idn_resconf_getlocalconverter(ctx)
+
+#define idn_resconf_idnconverter(ctx) \
+ idn_resconf_getidnconverter(ctx)
+
+#define idn_resconf_alternateconverter(ctx) \
+ idn_resconf_getalternateconverter(ctx)
+
+#define idn_resconf_normalizer(ctx) \
+ idn_resconf_getnormalizer(ctx)
+
+#define idn_resconf_mapper(ctx) \
+ idn_resconf_getmapper(ctx)
+
+#define idn_resconf_delimitermap(ctx) \
+ idn_resconf_getdelimitermap(ctx)
+
+#define idn_resconf_localmapselector(ctx) \
+ idn_resconf_getlocalmapselector(ctx)
+
+#define idn_resconf_prohibitchecker(ctx) \
+ idn_resconf_getprohibitchecker(ctx)
+
+#define idn_resconf_unassignedchecker(ctx) \
+ idn_resconf_getunassignedchecker(ctx)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_RESCONF_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/result.h b/contrib/idn/idnkit-1.0-src/include/idn/result.h
new file mode 100644
index 0000000..c044fcb
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/result.h
@@ -0,0 +1,86 @@
+/* $Id: result.h,v 1.1.1.1 2003/06/04 00:25:42 marka Exp $ */
+/*
+ * 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_RESULT_H
+#define IDN_RESULT_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <idn/export.h>
+
+/*
+ * libidnkit result code.
+ */
+typedef enum {
+ idn_success,
+ idn_notfound,
+ idn_invalid_encoding,
+ idn_invalid_syntax,
+ idn_invalid_name,
+ idn_invalid_message,
+ idn_invalid_action,
+ idn_invalid_codepoint,
+ idn_invalid_length,
+ idn_buffer_overflow,
+ idn_noentry,
+ idn_nomemory,
+ idn_nofile,
+ idn_nomapping,
+ idn_context_required,
+ idn_prohibited,
+ idn_failure /* !!This must be the last one!! */
+} idn_result_t;
+
+/*
+ * Get the string description of a result code.
+ */
+IDN_EXPORT char *
+idn_result_tostring(idn_result_t result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_RESULT_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/strhash.h b/contrib/idn/idnkit-1.0-src/include/idn/strhash.h
new file mode 100644
index 0000000..0a72a86
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/strhash.h
@@ -0,0 +1,123 @@
+/* $Id: strhash.h,v 1.1.1.1 2003/06/04 00:25:42 marka Exp $ */
+/*
+ * 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_STRHASH_H
+#define IDN_STRHASH_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * String-keyed hash table
+ *
+ * Just a hash table. Nothing special. Number of hash buckets
+ * grows automatically.
+ */
+
+#include <idn/result.h>
+
+/*
+ * Hash table type, which is opaque.
+ */
+typedef struct idn__strhash *idn__strhash_t;
+
+/*
+ * Hash value free proc.
+ */
+typedef void (*idn__strhash_freeproc_t)(void *value);
+
+/*
+ * Create a hash table.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn__strhash_create(idn__strhash_t *hashp);
+
+/*
+ * Delete a hash table created by 'idn__strhash_create'.
+ * If 'proc' is not NULL, it is called for each value in the
+ * hash to release memory for them.
+ */
+extern void
+idn__strhash_destroy(idn__strhash_t hash, idn__strhash_freeproc_t proc);
+
+/*
+ * Register an item to the hash table. This function makes a
+ * private copy of the key string.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn__strhash_put(idn__strhash_t hash, const char *key, void *value);
+
+/*
+ * Find an item with the specified key.
+ *
+ * Returns:
+ * idn_success -- ok. found.
+ * idn_noentry -- not found.
+ */
+extern idn_result_t
+idn__strhash_get(idn__strhash_t hash, const char *key, void **valuep);
+
+/*
+ * Check if an item with the specified key exists.
+ *
+ * Returns:
+ * 1 -- yes.
+ * 0 -- no.
+ */
+extern int
+idn__strhash_exists(idn__strhash_t hash, const char *key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_STRHASH_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/ucs4.h b/contrib/idn/idnkit-1.0-src/include/idn/ucs4.h
new file mode 100644
index 0000000..ceb1f53
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/ucs4.h
@@ -0,0 +1,103 @@
+/* $Id: ucs4.h,v 1.1.1.1 2003/06/04 00:25:42 marka Exp $ */
+/*
+ * Copyright (c) 2002 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_UCS4_H
+#define IDN_UCS4_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * UCS4 encoded string facility.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * UCS4 to UTF-16 conversion and vice versa.
+ */
+IDN_EXPORT idn_result_t
+idn_ucs4_ucs4toutf16(const unsigned long *ucs4, unsigned short *utf16,
+ size_t tolen);
+
+IDN_EXPORT idn_result_t
+idn_ucs4_utf16toucs4(const unsigned short *utf16, unsigned long *ucs4,
+ size_t tolen);
+
+/*
+ * UCS4 to UTF-8 conversion and vice versa.
+ */
+IDN_EXPORT idn_result_t
+idn_ucs4_utf8toucs4(const char *utf8, unsigned long *ucs4, size_t tolen);
+
+IDN_EXPORT idn_result_t
+idn_ucs4_ucs4toutf8(const unsigned long *ucs4, char *utf8, size_t tolen);
+
+/*
+ * UCS4 version of string operation functions.
+ */
+IDN_EXPORT size_t
+idn_ucs4_strlen(const unsigned long *ucs4);
+
+IDN_EXPORT unsigned long *
+idn_ucs4_strcpy(unsigned long *to, const unsigned long *from);
+
+IDN_EXPORT unsigned long *
+idn_ucs4_strcat(unsigned long *to, const unsigned long *from);
+
+IDN_EXPORT int
+idn_ucs4_strcmp(const unsigned long *str1, const unsigned long *str2);
+
+IDN_EXPORT int
+idn_ucs4_strcasecmp(const unsigned long *str1, const unsigned long *str2);
+
+IDN_EXPORT unsigned long *
+idn_ucs4_strdup(const unsigned long *str);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UCS4_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/ucsmap.h b/contrib/idn/idnkit-1.0-src/include/idn/ucsmap.h
new file mode 100644
index 0000000..67af523
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/ucsmap.h
@@ -0,0 +1,131 @@
+/* $Id: ucsmap.h,v 1.1.1.1 2003/06/04 00:25:42 marka Exp $ */
+/*
+ * Copyright (c) 2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_UCSMAP_H
+#define IDN_UCSMAP_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Perform UCS character mapping.
+ * This module support one-to-N mapping (N may be zero, one or more).
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * Mapper type (opaque).
+ */
+typedef struct idn_ucsmap *idn_ucsmap_t;
+
+/*
+ * Create an empty mapping. The reference count is set to 1.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsmap_create(idn_ucsmap_t *ctxp);
+
+/*
+ * Decrement the reference count of the given set, and if it reaches zero,
+ * release all the memory allocated for it.
+ */
+IDN_EXPORT void
+idn_ucsmap_destroy(idn_ucsmap_t ctx);
+
+/*
+ * Increment the reference count of the given set by one, so that
+ * the map can be shared.
+ */
+IDN_EXPORT void
+idn_ucsmap_incrref(idn_ucsmap_t ctx);
+
+/*
+ * Add a mapping.
+ * 'ucs' is the character to be mapped, 'map' points an array of mapped
+ * characters of length 'maplen'. 'map' may be NULL if 'maplen' is zero,
+ * meaning one-to-none mapping.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_failure -- already fixed by 'idn_ucsmap_fix',
+ * or too large maplen.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsmap_add(idn_ucsmap_t ctx, unsigned long ucs, unsigned long *map,
+ size_t maplen);
+
+/*
+ * Perform internal arrangement of the map for lookup.
+ * Once it is fixed, 'idn_ucsmap_add' cannot be permitted to the map.
+ */
+IDN_EXPORT void
+idn_ucsmap_fix(idn_ucsmap_t ctx);
+
+/*
+ * Find the mapping for the given character.
+ * 'idn_ucsmap_fix' must be performed before calling this function.
+ * Find the mapping for 'v' and store the result to 'to'. The length
+ * of the mapped sequence is stored in '*maplenp'. 'tolen' specifies
+ * the length allocated for 'to'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomapping -- specified character has no mapping.
+ * idn_failure -- not fixed by 'idn_ucsmap_fix' yet.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsmap_map(idn_ucsmap_t ctx, unsigned long v, unsigned long *to,
+ size_t tolen, size_t *maplenp);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UCSMAP_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/ucsset.h b/contrib/idn/idnkit-1.0-src/include/idn/ucsset.h
new file mode 100644
index 0000000..c50a4d0
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/ucsset.h
@@ -0,0 +1,145 @@
+/* $Id: ucsset.h,v 1.1.1.1 2003/06/04 00:25:43 marka Exp $ */
+/*
+ * Copyright (c) 2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_UCSSET_H
+#define IDN_UCSSET_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * A 'set' of UCS codepoints.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * Type representing a set (opaque).
+ */
+typedef struct idn_ucsset *idn_ucsset_t;
+
+
+/*
+ * Create an empty set. The reference count is set to 1.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsset_create(idn_ucsset_t *ctxp);
+
+/*
+ * Decrement the reference count of the given set, and if it reaches zero,
+ * release all the memory allocated for it.
+ */
+IDN_EXPORT void
+idn_ucsset_destroy(idn_ucsset_t ctx);
+
+/*
+ * Increments the reference count by one.
+ */
+IDN_EXPORT void
+idn_ucsset_incrref(idn_ucsset_t ctx);
+
+/*
+ * Add a UCS code point to the set.
+ * The set must be in the building phase -- that is, before 'idn_ucsset_fix'
+ * is called for the set.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_code -- code point out of range.
+ * idn_nomemory -- malloc failed.
+ * idn_failure -- already fixed by 'idn_ucsset_fix'.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsset_add(idn_ucsset_t ctx, unsigned long v);
+
+/*
+ * Add a range of code points (from 'from' to 'to', inclusive) to the set.
+ * 'from' must not be greater than 'to'.
+ * This function is similar to 'idn_ucsset_add' except that it accepts
+ * range of code points.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_code -- code point out of range, or the range
+ * specification is invalid.
+ * idn_nomemory -- malloc failed.
+ * idn_failure -- already fixed by 'idn_ucsset_fix'.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsset_addrange(idn_ucsset_t ctx, unsigned long from, unsigned long to);
+
+/*
+ * Perform internal arrangement of the set for lookup.
+ * Before calling this function, a set is in 'building' phase, and code
+ * points can be added freely by 'idn_ucsset_add' or 'idn_ucsset_addrange'.
+ * But once it is fixed by this function, the set becomes immutable, and
+ * it shifts into 'lookup' phase.
+ */
+IDN_EXPORT void
+idn_ucsset_fix(idn_ucsset_t ctx);
+
+/*
+ * Find if the given code point is in the set.
+ * The set must be in the lookup phase -- in other words, 'idn_ucsset_fix'
+ * must be called for the set before calling this function.
+ * '*found' is set to 1 if the specified code point is in the set, 0 otherwise.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_code -- specified code point is out of range.
+ * idn_failure -- not fixed by 'idn_ucsset_fix' yet.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsset_lookup(idn_ucsset_t ctx, unsigned long v, int *found);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UCSSET_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/unicode.h b/contrib/idn/idnkit-1.0-src/include/idn/unicode.h
new file mode 100644
index 0000000..f9b5bb4
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/unicode.h
@@ -0,0 +1,164 @@
+/* $Id: unicode.h,v 1.1.1.1 2003/06/04 00:25:43 marka Exp $ */
+/*
+ * Copyright (c) 2000,2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_UNICODE_H
+#define IDN_UNICODE_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Unicode attributes retriever.
+ *
+ * All the information this module provides is based on UnicodeData.txt,
+ * CompositionExclusions-1.txt and SpecialCasing.txt, all of which can be
+ * obtained from unicode.org.
+ *
+ * Unicode characters are represented as 'unsigned long'.
+ */
+
+#include <idn/result.h>
+
+/*
+ * A Handle for Unicode versions.
+ */
+typedef struct idn__unicode_ops *idn__unicode_version_t;
+
+/*
+ * Context information for case conversion.
+ */
+typedef enum {
+ idn__unicode_context_unknown,
+ idn__unicode_context_final,
+ idn__unicode_context_nonfinal
+} idn__unicode_context_t;
+
+/*
+ * Create a handle for a specific Unicode version.
+ * The version number (such as "3.0.1") is specified by 'version' parameter.
+ * If it is NULL, the latest version is used.
+ * The handle is stored in '*versionp', which is used various functions
+ * in this and unormalize modules.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_notfound -- specified version not found.
+ */
+extern idn_result_t
+idn__unicode_create(const char *version, idn__unicode_version_t *versionp);
+
+/*
+ * Close a handle which was created by 'idn__unicode_create'.
+ */
+extern void
+idn__unicode_destroy(idn__unicode_version_t version);
+
+/*
+ * Get canonical class.
+ *
+ * For characters out of unicode range (i.e. above 0xffff), 0 will
+ * be returned.
+ */
+extern int
+idn__unicode_canonicalclass(idn__unicode_version_t version, unsigned long c);
+
+/*
+ * Decompose a character.
+ *
+ * Decompose character given by 'c', and put the result into 'v',
+ * which can hold 'vlen' characters. The number of decomposed characters
+ * will be stored in '*decomp_lenp'.
+ *
+ * If 'compat' is true, compatibility decomposition is performed.
+ * Otherwise canonical decomposition is done.
+ *
+ * Since decomposition is done recursively, no further decomposition
+ * will be needed.
+ *
+ * Returns:
+ * idn_success -- ok, decomposed.
+ * idn_notfound -- no decomposition possible.
+ * idn_buffer_overflow -- 'vlen' is too small.
+ */
+extern idn_result_t
+idn__unicode_decompose(idn__unicode_version_t version,
+ int compat, unsigned long *v, size_t vlen,
+ unsigned long c, int *decomp_lenp);
+
+/*
+ * Perform canonical composition.
+ *
+ * Do canonical composition to the character sequence 'c1' and 'c2', put the
+ * result into '*compp'.
+ *
+ * Since Unicode Nomalization Froms requires only canonical composition,
+ * compatibility composition is not supported.
+ *
+ * Returns:
+ * idn_success -- ok, composed.
+ * idn_notfound -- no composition possible.
+ */
+extern idn_result_t
+idn__unicode_compose(idn__unicode_version_t version,
+ unsigned long c1, unsigned long c2, unsigned long *compp);
+
+/*
+ * Returns if there may be a canonical composition sequence which starts
+ * with the given character.
+ *
+ * Returns:
+ * 1 -- there may be a composition sequence
+ * (maybe not).
+ * 0 -- no, there is definitely no such sequences.
+ */
+extern int
+idn__unicode_iscompositecandidate(idn__unicode_version_t version,
+ unsigned long c);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UNICODE_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/unormalize.h b/contrib/idn/idnkit-1.0-src/include/idn/unormalize.h
new file mode 100644
index 0000000..3d43270
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/unormalize.h
@@ -0,0 +1,86 @@
+/* $Id: unormalize.h,v 1.1.1.1 2003/06/04 00:25:44 marka Exp $ */
+/*
+ * Copyright (c) 2000,2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_UNORMALIZE_H
+#define IDN_UNORMALIZE_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Unicode Normalizations.
+ *
+ * Perform 4 normalizations defined by 'Unicode Normalization Forms'
+ * (http://www.unicode.org/unicode/reports/tr15)
+ *
+ * All of the functions use UCS4 encoding for input/output.
+ */
+
+#include <idn/result.h>
+#include <idn/unicode.h>
+
+/*
+ * Perform Unicode Normalication Form C and KC.
+ *
+ * They take NUL-terminated UCS4 encoded string 'from', perform
+ * the normalization specified by 'version', put the result
+ * (also a NUL-terminated UCS4 encoded string) to 'to', which must be
+ * able to hold at least 'tolen' bytes.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_buffer_overflow -- 'tolen' is too small.
+ */
+extern idn_result_t
+idn__unormalize_formkc(idn__unicode_version_t version,
+ const unsigned long *from, unsigned long *to,
+ size_t tolen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UNORMALIZE_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/utf8.h b/contrib/idn/idnkit-1.0-src/include/idn/utf8.h
new file mode 100644
index 0000000..ee5f589
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/utf8.h
@@ -0,0 +1,137 @@
+/* $Id: utf8.h,v 1.1.1.1 2003/06/04 00:25:44 marka Exp $ */
+/*
+ * 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_UTF8_H
+#define IDN_UTF8_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * UTF-8 encoded string facility.
+ */
+
+#include <idn/export.h>
+
+/*
+ * Get the length of a character.
+ *
+ * Get the length (in bytes) of a character whose first byte is pointed
+ * by 's'. Since this function only looks one first byte to determine the
+ * length, it is possible some of the following bytes are invalid.
+ */
+IDN_EXPORT int
+idn_utf8_mblen(const char *s);
+
+/*
+ * Get one character.
+ *
+ * Get the first character of the string pointed by 's', and copy it
+ * to 'buf', whose length is 'len'. Returns the number of bytes copied,
+ * or zero if the encoding is invalid or len is too small.
+ *
+ * The area pointed by 'buf' must be large enough to store any UTF-8 encoded
+ * character.
+ *
+ * Note that the copied string is not NUL-terminated.
+ */
+IDN_EXPORT int
+idn_utf8_getmb(const char *s, size_t len, char *buf);
+
+/*
+ * Get one character in UCS-4.
+ *
+ * Similar to 'idn_utf8_getmb', except that the result is not in UTF-8
+ * encoding, but in UCS-4 format (plain 32bit integer value).
+ */
+IDN_EXPORT int
+idn_utf8_getwc(const char *s, size_t len, unsigned long *vp);
+
+/*
+ * Put one character.
+ *
+ * This function is an opposite of 'idn_utf8_getwc'. It takes a UCS-4
+ * value 'v', convert it to UTF-8 encoded sequence, and store it to 's',
+ * whose length is 'len'. It returns the number of bytes written, or
+ * zero 'v' is out of range or 'len' is too small.
+ */
+IDN_EXPORT int
+idn_utf8_putwc(char *s, size_t len, unsigned long v);
+
+/*
+ * Check the validity of UTF-8 encoded character.
+ *
+ * Check if the character pointed by 's' is a valid UTF-8 encoded
+ * character. Return the length of the character (in bytes) if it is valid,
+ * 0 otherwise.
+ */
+IDN_EXPORT int
+idn_utf8_isvalidchar(const char *s);
+
+/*
+ * Check the validity of UTF-8 encoded string.
+ *
+ * Check if the NUL-terminated string 's' is valid as a UTF-8 encoded
+ * string. Return 1 if it is valid, 0 otherwise.
+ */
+IDN_EXPORT int
+idn_utf8_isvalidstring(const char *s);
+
+/*
+ * Find first byte of a character.
+ *
+ * Find the first byte of a character 's' points to. 's' may point
+ * the 2nd or later byte of a character. 'known_top' is a pointer to
+ * a string which contains 's', and is known to be the first byte of
+ * a character. If it couldn't find the first byte between 'known_top'
+ * and 's', NULL will be returned.
+ */
+IDN_EXPORT char *
+idn_utf8_findfirstbyte(const char *s, const char *known_top);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UTF8_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/util.h b/contrib/idn/idnkit-1.0-src/include/idn/util.h
new file mode 100644
index 0000000..cde34a6
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/util.h
@@ -0,0 +1,98 @@
+/* $Id: util.h,v 1.1.1.1 2003/06/04 00:25:44 marka Exp $ */
+/*
+ * Copyright (c) 2000,2002 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_UTIL_H
+#define IDN_UTIL_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Utility functions.
+ */
+
+/*
+ * Check ACE prefix.
+ *
+ * These functions examine whether `str' begins with `prefix'.
+ * They disregard the case difference of ASCII letters ([A-Za-z]).
+ * They return 1 if `str' has the ACE prefix, 0 otherwise.
+ */
+extern int
+idn__util_asciihaveaceprefix(const char *str, const char *prefix);
+extern int
+idn__util_ucs4haveaceprefix(const unsigned long *str, const char *prefix);
+
+/*
+ * Check if all codepoints in the UCS4 string `str' are in the ASCII
+ * range (i.e. U+0000...U+007F).
+ *
+ * The function return 1 if it is, 0 otherwise.
+ */
+extern int
+idn__util_ucs4isasciirange(const unsigned long *str);
+
+/*
+ * Get registry information from the system. (Windows only)
+ */
+#ifdef WIN32
+/*
+ * registry top type.
+ */
+typedef enum {
+ idn__util_hkey_currentuser,
+ idn__util_hkey_localmachine
+} idn__util_hkey_t;
+
+extern int
+idn__util_getregistrystring(idn__util_hkey_t topkey, const char *name,
+ char *str, size_t length);
+#endif /* WIN32 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UTIL_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/version.h b/contrib/idn/idnkit-1.0-src/include/idn/version.h
new file mode 100644
index 0000000..c483311
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/version.h
@@ -0,0 +1,70 @@
+/* $Id: version.h,v 1.1.1.1 2003/06/04 00:25:44 marka Exp $ */
+/*
+ * Copyright (c) 2001 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, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, 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) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not 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.
+ */
+
+#ifndef IDN_VERSION_H
+#define IDN_VERSION_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <idn/export.h>
+
+/*
+ * Version number of this package.
+ */
+#define IDNKIT_VERSION "1.0"
+#define IDNKIT_MAJOR_VERSION 1
+#define IDNKIT_MINOR_VERSION 0
+
+/*
+ * Get the version of the library (libidnkit).
+ */
+IDN_EXPORT const char *
+idn_version_getstring(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_VERSION_H */