1 /* $NetBSD: util.h,v 1.4 2014/12/10 04:37:56 christos Exp $ */ 2 3 /* Id: util.h,v 1.1 2003/06/04 00:27:09 marka Exp */ 4 /* 5 * Copyright (c) 2000,2001 Japan Network Information Center. 6 * All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set forth bellow. 9 * 10 * LICENSE TERMS AND CONDITIONS 11 * 12 * The following License Terms and Conditions apply, unless a different 13 * license is obtained from Japan Network Information Center ("JPNIC"), 14 * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda, 15 * Chiyoda-ku, Tokyo 101-0047, Japan. 16 * 17 * 1. Use, Modification and Redistribution (including distribution of any 18 * modified or derived work) in source and/or binary forms is permitted 19 * under this License Terms and Conditions. 20 * 21 * 2. Redistribution of source code must retain the copyright notices as they 22 * appear in each source code file, this License Terms and Conditions. 23 * 24 * 3. Redistribution in binary form must reproduce the Copyright Notice, 25 * this License Terms and Conditions, in the documentation and/or other 26 * materials provided with the distribution. For the purposes of binary 27 * distribution the "Copyright Notice" refers to the following language: 28 * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved." 29 * 30 * 4. The name of JPNIC may not be used to endorse or promote products 31 * derived from this Software without specific prior written approval of 32 * JPNIC. 33 * 34 * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC 35 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 36 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 37 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 39 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 40 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 41 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 42 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 43 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 44 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 45 */ 46 47 #ifndef IDN_IDNCONV_UTIL_H 48 #define IDN_IDNCONV_UTIL_H 1 49 50 #include <idn/res.h> 51 52 #define IDNCONV_LOCALBUF_SIZE 512 53 54 typedef struct { 55 char *str; 56 size_t size; 57 char local_buf[IDNCONV_LOCALBUF_SIZE]; 58 } idnconv_strbuf_t; 59 60 extern idn_result_t selective_encode(idn_resconf_t conf, 61 idn_action_t actions, char *from, 62 char *to, int tolen); 63 extern idn_result_t selective_decode(idn_resconf_t conf, 64 idn_action_t actions, char *from, 65 char *to, int tolen); 66 extern void set_defaults(idn_resconf_t conf); 67 extern void load_conf_file(idn_resconf_t conf, const char *file); 68 extern void set_encoding_alias(const char *encoding_alias); 69 extern void set_localcode(idn_resconf_t conf, const char *code); 70 extern void set_idncode(idn_resconf_t conf, const char *code); 71 extern void set_delimitermapper(idn_resconf_t conf, 72 unsigned long *delimiters, 73 int ndelimiters); 74 extern void set_localmapper(idn_resconf_t conf, 75 char **mappers, int nmappers); 76 extern void set_nameprep(idn_resconf_t conf, char *version); 77 extern void set_mapper(idn_resconf_t conf, 78 char **mappers, int nmappers); 79 extern void set_normalizer(idn_resconf_t conf, 80 char **normalizer, int nnormalizer); 81 extern void set_prohibit_checkers(idn_resconf_t conf, 82 char **prohibits, 83 int nprohibits); 84 extern void set_unassigned_checkers(idn_resconf_t conf, 85 char **unassigns, 86 int nunassigns); 87 extern void errormsg(const char *fmt, ...); 88 extern void strbuf_init(idnconv_strbuf_t *buf); 89 extern void strbuf_reset(idnconv_strbuf_t *buf); 90 extern char *strbuf_get(idnconv_strbuf_t *buf); 91 extern size_t strbuf_size(idnconv_strbuf_t *buf); 92 extern char *strbuf_copy(idnconv_strbuf_t *buf, const char *str); 93 extern char *strbuf_append(idnconv_strbuf_t *buf, const char *str); 94 extern char *strbuf_alloc(idnconv_strbuf_t *buf, size_t size); 95 extern char *strbuf_double(idnconv_strbuf_t *buf); 96 extern char *strbuf_getline(idnconv_strbuf_t *buf, FILE *fp); 97 98 #endif /* IDN_IDNCONV_UTIL_H */ 99