|
libidn
1.25
|
00001 /* idna.h --- Prototypes for Internationalized Domain Name library. 00002 Copyright (C) 2002-2012 Simon Josefsson 00003 00004 This file is part of GNU Libidn. 00005 00006 GNU Libidn is free software: you can redistribute it and/or 00007 modify it under the terms of either: 00008 00009 * the GNU Lesser General Public License as published by the Free 00010 Software Foundation; either version 3 of the License, or (at 00011 your option) any later version. 00012 00013 or 00014 00015 * the GNU General Public License as published by the Free 00016 Software Foundation; either version 2 of the License, or (at 00017 your option) any later version. 00018 00019 or both in parallel, as here. 00020 00021 GNU Libidn is distributed in the hope that it will be useful, 00022 but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00024 General Public License for more details. 00025 00026 You should have received copies of the GNU General Public License and 00027 the GNU Lesser General Public License along with this program. If 00028 not, see <http://www.gnu.org/licenses/>. */ 00029 00030 #ifndef IDNA_H 00031 # define IDNA_H 00032 00033 # ifndef IDNAPI 00034 # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY 00035 # define IDNAPI __attribute__((__visibility__("default"))) 00036 # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC 00037 # define IDNAPI __declspec(dllexport) 00038 # elif defined _MSC_VER && ! defined LIBIDN_STATIC 00039 # define IDNAPI __declspec(dllimport) 00040 # else 00041 # define IDNAPI 00042 # endif 00043 # endif 00044 00045 # include <stddef.h> /* size_t */ 00046 # include <idn-int.h> /* uint32_t */ 00047 00048 # ifdef __cplusplus 00049 extern "C" 00050 { 00051 # endif 00052 00053 /* Error codes. */ 00054 typedef enum 00055 { 00056 IDNA_SUCCESS = 0, 00057 IDNA_STRINGPREP_ERROR = 1, 00058 IDNA_PUNYCODE_ERROR = 2, 00059 IDNA_CONTAINS_NON_LDH = 3, 00060 /* Workaround typo in earlier versions. */ 00061 IDNA_CONTAINS_LDH = IDNA_CONTAINS_NON_LDH, 00062 IDNA_CONTAINS_MINUS = 4, 00063 IDNA_INVALID_LENGTH = 5, 00064 IDNA_NO_ACE_PREFIX = 6, 00065 IDNA_ROUNDTRIP_VERIFY_ERROR = 7, 00066 IDNA_CONTAINS_ACE_PREFIX = 8, 00067 IDNA_ICONV_ERROR = 9, 00068 /* Internal errors. */ 00069 IDNA_MALLOC_ERROR = 201, 00070 IDNA_DLOPEN_ERROR = 202 00071 } Idna_rc; 00072 00073 /* IDNA flags */ 00074 typedef enum 00075 { 00076 IDNA_ALLOW_UNASSIGNED = 0x0001, 00077 IDNA_USE_STD3_ASCII_RULES = 0x0002 00078 } Idna_flags; 00079 00080 # ifndef IDNA_ACE_PREFIX 00081 # define IDNA_ACE_PREFIX "xn--" 00082 # endif 00083 00084 extern IDNAPI const char *idna_strerror (Idna_rc rc); 00085 00086 /* Core functions */ 00087 extern IDNAPI int idna_to_ascii_4i (const uint32_t * in, size_t inlen, 00088 char *out, int flags); 00089 extern IDNAPI int idna_to_unicode_44i (const uint32_t * in, size_t inlen, 00090 uint32_t * out, size_t * outlen, 00091 int flags); 00092 00093 /* Wrappers that handle several labels */ 00094 00095 extern IDNAPI int idna_to_ascii_4z (const uint32_t * input, 00096 char **output, int flags); 00097 00098 extern IDNAPI int idna_to_ascii_8z (const char *input, char **output, 00099 int flags); 00100 00101 extern IDNAPI int idna_to_ascii_lz (const char *input, char **output, 00102 int flags); 00103 00104 extern IDNAPI int idna_to_unicode_4z4z (const uint32_t * input, 00105 uint32_t ** output, int flags); 00106 00107 extern IDNAPI int idna_to_unicode_8z4z (const char *input, 00108 uint32_t ** output, int flags); 00109 00110 extern IDNAPI int idna_to_unicode_8z8z (const char *input, 00111 char **output, int flags); 00112 00113 extern IDNAPI int idna_to_unicode_8zlz (const char *input, 00114 char **output, int flags); 00115 00116 extern IDNAPI int idna_to_unicode_lzlz (const char *input, 00117 char **output, int flags); 00118 00119 # ifdef __cplusplus 00120 } 00121 # endif 00122 00123 #endif /* IDNA_H */
1.7.6.1