res.h revision 04bdb234571448ed6194e1d4048e6512f2446f1c
1389N/A/* $Id: res.h,v 1.3 2000/08/23 06:56:58 ishisone Exp $ */ 1389N/A * Copyright (c) 2000 Japan Network Information Center. All rights reserved. 1389N/A * By using this file, you agree to the terms and conditions set forth bellow. 1389N/A * LICENSE TERMS AND CONDITIONS 1389N/A * The following License Terms and Conditions apply, unless a different 1389N/A * license is obtained from Japan Network Information Center ("JPNIC"), 1389N/A * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku, 1389N/A * 1. Use, Modification and Redistribution (including distribution of any 1389N/A * modified or derived work) in source and/or binary forms is permitted 1389N/A * under this License Terms and Conditions. 1389N/A * 2. Redistribution of source code must retain the copyright notices as they 1389N/A * appear in each source code file, this License Terms and Conditions. 1389N/A * 3. Redistribution in binary form must reproduce the Copyright Notice, 1389N/A * this License Terms and Conditions, in the documentation and/or other 1389N/A * materials provided with the distribution. For the purposes of binary 1389N/A * distribution the "Copyright Notice" refers to the following language: 4129N/A * "Copyright (c) Japan Network Information Center. All rights reserved." 1389N/A * 4. Neither the name of JPNIC may be used to endorse or promote products 1389N/A * derived from this Software without specific prior written approval of 2086N/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2086N/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 1389N/A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE 1389N/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1389N/A * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1389N/A * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 1389N/A * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 1389N/A * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 1389N/A * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 1389N/A * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 1389N/A * 6. Indemnification by Licensee 1389N/A * Any person or entities using and/or redistributing this Software under 4129N/A * this License Terms and Conditions shall defend indemnify and hold 4129N/A * harmless JPNIC from and against any and all judgements damages, 4129N/A * expenses, settlement liabilities, cost and other liabilities of any 4129N/A * kind as a result of use and redistribution of this Software or any 4129N/A * claim, suite, action, litigation or proceeding by any third party 4129N/A * arising out of or relates to this License Terms and Conditions. 1389N/A * 7. Governing Law, Jurisdiction and Venue 1389N/A * This License Terms and Conditions shall be governed by and and 1389N/A * construed in accordance with the law of Japan. Any person or entities 1389N/A * using and/or redistributing this Software under this License Terms and 1389N/A * Conditions hereby agrees and consent to the personal and exclusive 1389N/A * jurisdiction and venue of Tokyo District Court of Japan. 1389N/A * Resolver library support. 1389N/A * All the functions provided by this module requires MDN resolver 1389N/A * configuration context of type 'mdn_resconf_t' as an argument. 1389N/A * This context holds information described in the configuration file 2086N/A * All functions also accept NULL as the context, but since * Convert from the local codeset string to UCS (UTF-8). * 'local_name' is a string containing a domain name encoded in the * local codeset or the encoding specified by 'alternate-encoding' * directive in the MDN configuration file (mdnres.conf). * This function converts it to UCS and stores in * the buffer 'ucs_name', which is 'ucs_name_len' bytes long. * 'conf' is a MDN resolver configuration context created by * 'mdn_resconf_create()', or NULL. If it is NULL, no conversion is * performed, and the contents of 'local_name' are copied to 'ucs_name' * mdn_buffer_overflow -- output buffer is too small. * mdn_invalid_encoding -- input string has invalid byte sequence. * mdn_invalid_name -- local encoding (codeset) name is invalid. * mdn_failure -- other failure. * Convert from UCS (UTF-8) string to the local codeset. * 'ucs_name' is a string containing a domain name encoded in UTF-8. * This function converts it to the local codeset and stores in * the buffer 'local_name', which is 'local_name_len' bytes long. * If there are any characters which cannot be converted to the local * codeset, the 'alternate-encoding' is used instead of the local codeset. * 'conf' is a MDN resolver configuration context created by * 'mdn_resconf_create()', or NULL. If it is NULL, no conversion is * performed, and the contents of 'local_name' are copied to 'ucs_name' * mdn_buffer_overflow -- output buffer is too small. * mdn_invalid_encoding -- input string has invalid byte sequence. * mdn_invalid_name -- local encoding (codeset) name is invalid. * mdn_failure -- other failure. * context 'conf' on the UTF-8 encoded string 'name', and store the result * in 'normalized_name', whose size is 'normalized_name_len' bytes. * 'conf' is a MDN resolver configuration context created by * 'mdn_resconf_create()', or NULL. If it is NULL, no normalization is * performed, and the contents of 'name' are copied to 'normalized_name' * mdn_buffer_overflow -- output buffer is too small. * mdn_invalid_encoding -- input is not a valid UTF-8 string. * mdn_nomemory -- malloc failed. * Convert from UCS (UTF-8) string to the encoding used in DNS protocol. * 'ucs_name' is a string containing a domain name encoded in UTF-8. * This function converts it to the encoding used in DNS protocol data * (such as RACE), and stores in the buffer 'dns_name', which is * 'dns_name_len' bytes long. Also if ZLD is specified in the configuration * file, it is appended to the conversion result. * Both the encoding used in DNS protocol and ZLD are specified by 'conf' * which is a MDN resolver configuration context. If 'conf' is NULL, * then no conversion is done. * 'ucs_name' must be a FQDN. Otherwise the conversion result might * not be correct for some DNS protocol encoding (namely UTF-5). * mdn_buffer_overflow -- output buffer is too small. * mdn_invalid_encoding -- input string has invalid byte sequence. * mdn_invalid_name -- local encoding (codeset) name is invalid. * mdn_failure -- other failure. * Convert from the DNS protocol encoding to UCS (UTF-8). * This function converts 'dns_name' whose encoding is the encoding * used in DNS protocol data into UTF-8, and stores the result in the * buffer 'ucs_name', which is 'ucs_name_len' bytes long. Also, if * 'dns_name' has ZLD specified by 'conf', the ZLD part is removed * from 'dns_name' before the conversion. * Both the encoding used in DNS protocol and ZLD are specified by 'conf' * which is a MDN resolver configuration context. If 'conf' is NULL, * then no conversion is done. * mdn_buffer_overflow -- output buffer is too small. * mdn_invalid_encoding -- input string has invalid byte sequence. * mdn_invalid_name -- local encoding (codeset) name is invalid. * mdn_failure -- other failure.