diff options
Diffstat (limited to '3rdParty/LibIDN/src/stringprep.h')
| -rw-r--r-- | 3rdParty/LibIDN/src/stringprep.h | 209 |
1 files changed, 109 insertions, 100 deletions
diff --git a/3rdParty/LibIDN/src/stringprep.h b/3rdParty/LibIDN/src/stringprep.h index fa822e8..d69faa7 100644 --- a/3rdParty/LibIDN/src/stringprep.h +++ b/3rdParty/LibIDN/src/stringprep.h | |||
| @@ -1,53 +1,59 @@ | |||
| 1 | /* stringprep.h --- Header file for stringprep functions. | 1 | /* stringprep.h --- Header file for stringprep functions. |
| 2 | * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Simon Josefsson | 2 | Copyright (C) 2002-2015 Simon Josefsson |
| 3 | * | 3 | |
| 4 | * This file is part of GNU Libidn. | 4 | This file is part of GNU Libidn. |
| 5 | * | 5 | |
| 6 | * GNU Libidn is free software; you can redistribute it and/or | 6 | GNU Libidn is free software: you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public | 7 | modify it under the terms of either: |
| 8 | * License as published by the Free Software Foundation; either | 8 | |
| 9 | * version 2.1 of the License, or (at your option) any later version. | 9 | * the GNU Lesser General Public License as published by the Free |
| 10 | * | 10 | Software Foundation; either version 3 of the License, or (at |
| 11 | * GNU Libidn is distributed in the hope that it will be useful, | 11 | your option) any later version. |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | or |
| 14 | * Lesser General Public License for more details. | 14 | |
| 15 | * | 15 | * the GNU General Public License as published by the Free |
| 16 | * You should have received a copy of the GNU Lesser General Public | 16 | Software Foundation; either version 2 of the License, or (at |
| 17 | * License along with GNU Libidn; if not, write to the Free Software | 17 | your option) any later version. |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | 18 | |
| 19 | * | 19 | or both in parallel, as here. |
| 20 | */ | 20 | |
| 21 | GNU Libidn is distributed in the hope that it will be useful, | ||
| 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 24 | General Public License for more details. | ||
| 25 | |||
| 26 | You should have received copies of the GNU General Public License and | ||
| 27 | the GNU Lesser General Public License along with this program. If | ||
| 28 | not, see <http://www.gnu.org/licenses/>. */ | ||
| 21 | 29 | ||
| 22 | #ifndef STRINGPREP_H | 30 | #ifndef STRINGPREP_H |
| 23 | # define STRINGPREP_H | 31 | # define STRINGPREP_H |
| 24 | 32 | ||
| 25 | # include <stddef.h> /* size_t */ | 33 | # ifndef IDNAPI |
| 26 | # include <unistd.h> /* ssize_t */ | 34 | # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY |
| 27 | # include <idn-int.h> /* uint32_t */ | 35 | # define IDNAPI __attribute__((__visibility__("default"))) |
| 28 | 36 | # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC | |
| 29 | /* Libidn Windows DLL. Only needed when this file is used in Visual | 37 | # define IDNAPI __declspec(dllexport) |
| 30 | Studio. Export and import happens automatically in MinGW. */ | 38 | # elif defined _MSC_VER && ! defined LIBIDN_STATIC |
| 31 | # ifndef IDNA_API | 39 | # define IDNAPI __declspec(dllimport) |
| 32 | # if defined(_MSC_VER) && !defined(IDNA_STATIC) | ||
| 33 | # ifdef IDNA_EXPORTS | ||
| 34 | # define IDNA_API __declspec(dllexport) | ||
| 35 | # else | ||
| 36 | # define IDNA_API __declspec(dllimport) | ||
| 37 | # endif | ||
| 38 | # else | 40 | # else |
| 39 | # define IDNA_API | 41 | # define IDNAPI |
| 40 | # endif | 42 | # endif |
| 41 | # endif | 43 | # endif |
| 42 | 44 | ||
| 45 | # include <stddef.h> /* size_t */ | ||
| 46 | # include <sys/types.h> /* ssize_t */ | ||
| 47 | # include <idn-int.h> /* uint32_t */ | ||
| 48 | |||
| 43 | # ifdef __cplusplus | 49 | # ifdef __cplusplus |
| 44 | extern "C" | 50 | extern "C" |
| 45 | { | 51 | { |
| 46 | # endif | 52 | # endif |
| 47 | 53 | ||
| 48 | # define STRINGPREP_VERSION "1.11" | 54 | # define STRINGPREP_VERSION "1.32" |
| 49 | 55 | ||
| 50 | /* Error codes. */ | 56 | /* Error codes. */ |
| 51 | typedef enum | 57 | typedef enum |
| 52 | { | 58 | { |
| 53 | STRINGPREP_OK = 0, | 59 | STRINGPREP_OK = 0, |
| @@ -60,10 +66,11 @@ extern "C" | |||
| 60 | /* Error in calling application. */ | 66 | /* Error in calling application. */ |
| 61 | STRINGPREP_TOO_SMALL_BUFFER = 100, | 67 | STRINGPREP_TOO_SMALL_BUFFER = 100, |
| 62 | STRINGPREP_PROFILE_ERROR = 101, | 68 | STRINGPREP_PROFILE_ERROR = 101, |
| 63 | STRINGPREP_FLAG_ERROR = 102, | 69 | STRINGPREP_FLAG_ERROR = 102, |
| 64 | STRINGPREP_UNKNOWN_PROFILE = 103, | 70 | STRINGPREP_UNKNOWN_PROFILE = 103, |
| 71 | STRINGPREP_ICONV_ERROR = 104, | ||
| 65 | /* Internal errors. */ | 72 | /* Internal errors. */ |
| 66 | STRINGPREP_NFKC_FAILED = 200, | 73 | STRINGPREP_NFKC_FAILED = 200, |
| 67 | STRINGPREP_MALLOC_ERROR = 201 | 74 | STRINGPREP_MALLOC_ERROR = 201 |
| 68 | } Stringprep_rc; | 75 | } Stringprep_rc; |
| 69 | 76 | ||
| @@ -111,122 +118,124 @@ extern "C" | |||
| 111 | const char *name; | 118 | const char *name; |
| 112 | const Stringprep_profile *tables; | 119 | const Stringprep_profile *tables; |
| 113 | }; | 120 | }; |
| 114 | typedef struct Stringprep_profiles Stringprep_profiles; | 121 | typedef struct Stringprep_profiles Stringprep_profiles; |
| 115 | 122 | ||
| 116 | extern IDNA_API const Stringprep_profiles stringprep_profiles[]; | 123 | extern IDNAPI const Stringprep_profiles stringprep_profiles[]; |
| 117 | 124 | ||
| 118 | /* Profiles */ | 125 | /* Profiles */ |
| 119 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_A_1[]; | 126 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_A_1[]; |
| 120 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_B_1[]; | 127 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_B_1[]; |
| 121 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_B_2[]; | 128 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_B_2[]; |
| 122 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_B_3[]; | 129 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_B_3[]; |
| 123 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_1_1[]; | 130 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_1_1[]; |
| 124 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_1_2[]; | 131 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_1_2[]; |
| 125 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_2_1[]; | 132 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_2_1[]; |
| 126 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_2_2[]; | 133 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_2_2[]; |
| 127 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_3[]; | 134 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_3[]; |
| 128 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_4[]; | 135 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_4[]; |
| 129 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_5[]; | 136 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_5[]; |
| 130 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_6[]; | 137 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_6[]; |
| 131 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_7[]; | 138 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_7[]; |
| 132 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_8[]; | 139 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_8[]; |
| 133 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_9[]; | 140 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_9[]; |
| 134 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_D_1[]; | 141 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_D_1[]; |
| 135 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_D_2[]; | 142 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_D_2[]; |
| 136 | 143 | ||
| 137 | /* Nameprep */ | 144 | /* Nameprep */ |
| 138 | 145 | ||
| 139 | extern IDNA_API const Stringprep_profile stringprep_nameprep[]; | 146 | extern IDNAPI const Stringprep_profile stringprep_nameprep[]; |
| 140 | 147 | ||
| 141 | # define stringprep_nameprep(in, maxlen) \ | 148 | # define stringprep_nameprep(in, maxlen) \ |
| 142 | stringprep(in, maxlen, 0, stringprep_nameprep) | 149 | stringprep(in, maxlen, 0, stringprep_nameprep) |
| 143 | 150 | ||
| 144 | # define stringprep_nameprep_no_unassigned(in, maxlen) \ | 151 | # define stringprep_nameprep_no_unassigned(in, maxlen) \ |
| 145 | stringprep(in, maxlen, STRINGPREP_NO_UNASSIGNED, stringprep_nameprep) | 152 | stringprep(in, maxlen, STRINGPREP_NO_UNASSIGNED, stringprep_nameprep) |
| 146 | 153 | ||
| 147 | /* SASL */ | 154 | /* SASL */ |
| 148 | 155 | ||
| 149 | extern IDNA_API const Stringprep_profile stringprep_saslprep[]; | 156 | extern IDNAPI const Stringprep_profile stringprep_saslprep[]; |
| 150 | extern IDNA_API const Stringprep_profile stringprep_plain[]; | 157 | extern IDNAPI const Stringprep_table_element stringprep_saslprep_space_map[]; |
| 151 | extern IDNA_API const Stringprep_profile stringprep_trace[]; | 158 | extern IDNAPI const Stringprep_profile stringprep_plain[]; |
| 159 | extern IDNAPI const Stringprep_profile stringprep_trace[]; | ||
| 152 | 160 | ||
| 153 | # define stringprep_plain(in, maxlen) \ | 161 | # define stringprep_plain(in, maxlen) \ |
| 154 | stringprep(in, maxlen, 0, stringprep_plain) | 162 | stringprep(in, maxlen, 0, stringprep_plain) |
| 155 | 163 | ||
| 156 | /* Kerberos */ | 164 | /* Kerberos */ |
| 157 | 165 | ||
| 158 | extern IDNA_API const Stringprep_profile stringprep_kerberos5[]; | 166 | extern IDNAPI const Stringprep_profile stringprep_kerberos5[]; |
| 159 | 167 | ||
| 160 | # define stringprep_kerberos5(in, maxlen) \ | 168 | # define stringprep_kerberos5(in, maxlen) \ |
| 161 | stringprep(in, maxlen, 0, stringprep_kerberos5) | 169 | stringprep(in, maxlen, 0, stringprep_kerberos5) |
| 162 | 170 | ||
| 163 | /* XMPP */ | 171 | /* XMPP */ |
| 164 | 172 | ||
| 165 | extern IDNA_API const Stringprep_profile stringprep_xmpp_nodeprep[]; | 173 | extern IDNAPI const Stringprep_profile stringprep_xmpp_nodeprep[]; |
| 166 | extern IDNA_API const Stringprep_profile stringprep_xmpp_resourceprep[]; | 174 | extern IDNAPI const Stringprep_profile stringprep_xmpp_resourceprep[]; |
| 167 | extern IDNA_API const Stringprep_table_element stringprep_xmpp_nodeprep_prohibit[]; | 175 | extern IDNAPI const Stringprep_table_element stringprep_xmpp_nodeprep_prohibit[]; |
| 168 | 176 | ||
| 169 | # define stringprep_xmpp_nodeprep(in, maxlen) \ | 177 | # define stringprep_xmpp_nodeprep(in, maxlen) \ |
| 170 | stringprep(in, maxlen, 0, stringprep_xmpp_nodeprep) | 178 | stringprep(in, maxlen, 0, stringprep_xmpp_nodeprep) |
| 171 | # define stringprep_xmpp_resourceprep(in, maxlen) \ | 179 | # define stringprep_xmpp_resourceprep(in, maxlen) \ |
| 172 | stringprep(in, maxlen, 0, stringprep_xmpp_resourceprep) | 180 | stringprep(in, maxlen, 0, stringprep_xmpp_resourceprep) |
| 173 | 181 | ||
| 174 | /* iSCSI */ | 182 | /* iSCSI */ |
| 175 | 183 | ||
| 176 | extern IDNA_API const Stringprep_profile stringprep_iscsi[]; | 184 | extern IDNAPI const Stringprep_profile stringprep_iscsi[]; |
| 185 | extern IDNAPI const Stringprep_table_element stringprep_iscsi_prohibit[]; | ||
| 177 | 186 | ||
| 178 | # define stringprep_iscsi(in, maxlen) \ | 187 | # define stringprep_iscsi(in, maxlen) \ |
| 179 | stringprep(in, maxlen, 0, stringprep_iscsi) | 188 | stringprep(in, maxlen, 0, stringprep_iscsi) |
| 180 | 189 | ||
| 181 | /* API */ | 190 | /* API */ |
| 182 | 191 | ||
| 183 | extern IDNA_API int stringprep_4i (uint32_t * ucs4, size_t * len, | 192 | extern IDNAPI int stringprep_4i (uint32_t * ucs4, size_t * len, |
| 184 | size_t maxucs4len, | 193 | size_t maxucs4len, |
| 185 | Stringprep_profile_flags flags, | 194 | Stringprep_profile_flags flags, |
| 186 | const Stringprep_profile * profile); | 195 | const Stringprep_profile * profile); |
| 187 | extern IDNA_API int stringprep_4zi (uint32_t * ucs4, size_t maxucs4len, | 196 | extern IDNAPI int stringprep_4zi (uint32_t * ucs4, size_t maxucs4len, |
| 188 | Stringprep_profile_flags flags, | 197 | Stringprep_profile_flags flags, |
| 189 | const Stringprep_profile * profile); | 198 | const Stringprep_profile * profile); |
| 190 | extern IDNA_API int stringprep (char *in, size_t maxlen, | 199 | extern IDNAPI int stringprep (char *in, size_t maxlen, |
| 191 | Stringprep_profile_flags flags, | 200 | Stringprep_profile_flags flags, |
| 192 | const Stringprep_profile * profile); | 201 | const Stringprep_profile * profile); |
| 193 | 202 | ||
| 194 | extern IDNA_API int stringprep_profile (const char *in, | 203 | extern IDNAPI int stringprep_profile (const char *in, |
| 195 | char **out, | 204 | char **out, |
| 196 | const char *profile, | 205 | const char *profile, |
| 197 | Stringprep_profile_flags flags); | 206 | Stringprep_profile_flags flags); |
| 198 | 207 | ||
| 199 | extern IDNA_API const char *stringprep_strerror (Stringprep_rc rc); | 208 | extern IDNAPI const char *stringprep_strerror (Stringprep_rc rc); |
| 200 | 209 | ||
| 201 | extern IDNA_API const char *stringprep_check_version (const char | 210 | extern IDNAPI const char *stringprep_check_version (const char |
| 202 | *req_version); | 211 | *req_version); |
| 203 | 212 | ||
| 204 | /* Utility */ | 213 | /* Utility */ |
| 205 | 214 | ||
| 206 | extern IDNA_API int stringprep_unichar_to_utf8 (uint32_t c, char *outbuf); | 215 | extern IDNAPI int stringprep_unichar_to_utf8 (uint32_t c, char *outbuf); |
| 207 | extern IDNA_API uint32_t stringprep_utf8_to_unichar (const char *p); | 216 | extern IDNAPI uint32_t stringprep_utf8_to_unichar (const char *p); |
| 208 | 217 | ||
| 209 | extern IDNA_API uint32_t *stringprep_utf8_to_ucs4 (const char *str, | 218 | extern IDNAPI uint32_t *stringprep_utf8_to_ucs4 (const char *str, |
| 210 | ssize_t len, | 219 | ssize_t len, |
| 211 | size_t * items_written); | 220 | size_t * items_written); |
| 212 | extern IDNA_API char *stringprep_ucs4_to_utf8 (const uint32_t * str, | 221 | extern IDNAPI char *stringprep_ucs4_to_utf8 (const uint32_t * str, |
| 213 | ssize_t len, | 222 | ssize_t len, |
| 214 | size_t * items_read, | 223 | size_t * items_read, |
| 215 | size_t * items_written); | 224 | size_t * items_written); |
| 216 | 225 | ||
| 217 | extern IDNA_API char *stringprep_utf8_nfkc_normalize (const char *str, | 226 | extern IDNAPI char *stringprep_utf8_nfkc_normalize (const char *str, |
| 218 | ssize_t len); | 227 | ssize_t len); |
| 219 | extern IDNA_API uint32_t *stringprep_ucs4_nfkc_normalize (uint32_t * str, | 228 | extern IDNAPI uint32_t *stringprep_ucs4_nfkc_normalize (const uint32_t * str, |
| 220 | ssize_t len); | 229 | ssize_t len); |
| 221 | 230 | ||
| 222 | extern IDNA_API const char *stringprep_locale_charset (void); | 231 | extern IDNAPI const char *stringprep_locale_charset (void); |
| 223 | extern IDNA_API char *stringprep_convert (const char *str, | 232 | extern IDNAPI char *stringprep_convert (const char *str, |
| 224 | const char *to_codeset, | 233 | const char *to_codeset, |
| 225 | const char *from_codeset); | 234 | const char *from_codeset); |
| 226 | extern IDNA_API char *stringprep_locale_to_utf8 (const char *str); | 235 | extern IDNAPI char *stringprep_locale_to_utf8 (const char *str); |
| 227 | extern IDNA_API char *stringprep_utf8_to_locale (const char *str); | 236 | extern IDNAPI char *stringprep_utf8_to_locale (const char *str); |
| 228 | 237 | ||
| 229 | # ifdef __cplusplus | 238 | # ifdef __cplusplus |
| 230 | } | 239 | } |
| 231 | # endif | 240 | # endif |
| 232 | 241 | ||
Swift