File indexing completed on 2024-05-19 04:06:42
0001 /* idna.h Declarations for IDNA. 0002 * Copyright (C) 2002, 2003 Simon Josefsson 0003 * 0004 * This file is part of GNU Libidn. 0005 * 0006 * GNU Libidn is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Lesser General Public 0008 * License as published by the Free Software Foundation; either 0009 * either version 2 0010 of the License, or (at your option) any later version.1 of the License, or (at your option) any later version. 0011 * 0012 * GNU Libidn is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Lesser General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Lesser General Public 0018 * License along with GNU Libidn; if not, write to the Free Software 0019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 0020 * 0021 */ 0022 0023 #ifndef _IDNA_H 0024 #define _IDNA_H 0025 0026 #ifdef __cplusplus 0027 extern "C" 0028 { 0029 #endif 0030 0031 #include <stddef.h> /* size_t */ 0032 #include <libidn/idn-int.h> /* my_uint32_t */ 0033 0034 /* Error codes. */ 0035 typedef enum 0036 { 0037 IDNA_SUCCESS = 0, 0038 IDNA_STRINGPREP_ERROR = 1, 0039 IDNA_PUNYCODE_ERROR = 2, 0040 IDNA_CONTAINS_LDH = 3, 0041 IDNA_CONTAINS_MINUS = 4, 0042 IDNA_INVALID_LENGTH = 5, 0043 IDNA_NO_ACE_PREFIX = 6, 0044 IDNA_ROUNDTRIP_VERIFY_ERROR = 7, 0045 IDNA_CONTAINS_ACE_PREFIX = 8, 0046 IDNA_ICONV_ERROR = 9, 0047 /* Internal errors. */ 0048 IDNA_MALLOC_ERROR = 201 0049 } Idna_rc; 0050 0051 /* IDNA flags */ 0052 typedef enum 0053 { 0054 IDNA_ALLOW_UNASSIGNED = 0x0001, 0055 IDNA_USE_STD3_ASCII_RULES = 0x0002 0056 } Idna_flags; 0057 0058 #ifndef IDNA_ACE_PREFIX 0059 #define IDNA_ACE_PREFIX "xn--" 0060 #endif 0061 0062 /* Core functions */ 0063 extern int idna_to_ascii_4i (const my_uint32_t * in, size_t inlen, 0064 char *out, int flags); 0065 extern int idna_to_unicode_44i (const my_uint32_t * in, size_t inlen, 0066 my_uint32_t * out, size_t * outlen, int flags); 0067 0068 /* Wrappers that handle several labels */ 0069 0070 extern int idna_to_ascii_4z (const my_uint32_t * input, 0071 char **output, int flags); 0072 0073 extern int idna_to_ascii_8z (const char *input, char **output, int flags); 0074 0075 extern int idna_to_ascii_lz (const char *input, char **output, int flags); 0076 0077 0078 extern int idna_to_unicode_4z4z (const my_uint32_t * input, 0079 my_uint32_t ** output, int flags); 0080 0081 extern int idna_to_unicode_8z4z (const char *input, 0082 my_uint32_t ** output, int flags); 0083 0084 extern int idna_to_unicode_8z8z (const char *input, 0085 char **output, int flags); 0086 0087 extern int idna_to_unicode_8zlz (const char *input, 0088 char **output, int flags); 0089 0090 extern int idna_to_unicode_lzlz (const char *input, 0091 char **output, int flags); 0092 0093 #ifdef __cplusplus 0094 } 0095 #endif 0096 #endif /* _PUNYCODE_H */