Support for type-generic libm function implementations libm
[glibc.git] / libidn / profiles.c
blobee11b604cf1bf8b7dfe525015df75749881a204e
1 /* profiles.c Definitions of stringprep profiles.
2 * Copyright (C) 2002, 2003, 2004 Simon Josefsson
4 * This file is part of GNU Libidn.
6 * GNU Libidn is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * GNU Libidn is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with GNU Libidn; if not, see <http://www.gnu.org/licenses/>.
20 #include "stringprep.h"
22 const Stringprep_profiles stringprep_profiles[] = {
23 {"Nameprep", stringprep_nameprep},
24 {"KRBprep", stringprep_kerberos5}, /* Deprecate? */
25 {"Nodeprep", stringprep_xmpp_nodeprep},
26 {"Resourceprep", stringprep_xmpp_resourceprep},
27 {"plain", stringprep_plain}, /* sasl-anon-00. */
28 {"trace", stringprep_trace}, /* sasl-anon-01,02. */
29 {"SASLprep", stringprep_saslprep},
30 {"ISCSIprep", stringprep_iscsi}, /* Obsolete. */
31 {"iSCSI", stringprep_iscsi}, /* IANA. */
32 {NULL, NULL}
35 const Stringprep_profile stringprep_nameprep[] = {
36 {STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_1},
37 {STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_2},
38 {STRINGPREP_NFKC, 0, 0},
39 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_2},
40 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
41 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
42 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
43 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
44 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
45 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_7},
46 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
47 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
48 {STRINGPREP_BIDI, 0, 0},
49 {STRINGPREP_BIDI_PROHIBIT_TABLE, ~STRINGPREP_NO_BIDI,
50 stringprep_rfc3454_C_8},
51 {STRINGPREP_BIDI_RAL_TABLE, 0, stringprep_rfc3454_D_1},
52 {STRINGPREP_BIDI_L_TABLE, 0, stringprep_rfc3454_D_2},
53 {STRINGPREP_UNASSIGNED_TABLE, ~STRINGPREP_NO_UNASSIGNED,
54 stringprep_rfc3454_A_1},
55 {0}
58 const Stringprep_profile stringprep_kerberos5[] = {
59 /* XXX this is likely to be wrong as the specification is
60 a rough draft. */
61 {STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_1},
62 {STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_3},
63 {STRINGPREP_NFKC, 0, 0},
64 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_2},
65 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
66 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
67 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
68 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
69 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
70 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_7},
71 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
72 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
73 {STRINGPREP_BIDI, 0, 0},
74 {STRINGPREP_BIDI_PROHIBIT_TABLE, ~STRINGPREP_NO_BIDI,
75 stringprep_rfc3454_C_8},
76 {STRINGPREP_BIDI_RAL_TABLE, 0, stringprep_rfc3454_D_1},
77 {STRINGPREP_BIDI_L_TABLE, 0, stringprep_rfc3454_D_2},
78 {STRINGPREP_UNASSIGNED_TABLE, ~STRINGPREP_NO_UNASSIGNED,
79 stringprep_rfc3454_A_1},
80 {0}
83 const Stringprep_table_element stringprep_xmpp_nodeprep_prohibit[] = {
84 {0x000022}, /* #x22 (") */
85 {0x000026}, /* #x26 (&) */
86 {0x000027}, /* #x27 (') */
87 {0x00002F}, /* #x2F (/) */
88 {0x00003A}, /* #x3A (:) */
89 {0x00003C}, /* #x3C (<) */
90 {0x00003E}, /* #x3E (>) */
91 {0x000040}, /* #x40 (@) */
92 {0}
95 const Stringprep_profile stringprep_xmpp_nodeprep[] = {
96 {STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_1},
97 {STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_2},
98 {STRINGPREP_NFKC, 0, 0},
99 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_1},
100 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_2},
101 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
102 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
103 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
104 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
105 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
106 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
107 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_7},
108 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
109 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
110 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_xmpp_nodeprep_prohibit},
111 {STRINGPREP_BIDI, 0, 0},
112 {STRINGPREP_BIDI_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
113 {STRINGPREP_BIDI_RAL_TABLE, 0, stringprep_rfc3454_D_1},
114 {STRINGPREP_BIDI_L_TABLE, 0, stringprep_rfc3454_D_2},
115 {STRINGPREP_UNASSIGNED_TABLE, ~STRINGPREP_NO_UNASSIGNED,
116 stringprep_rfc3454_A_1},
120 const Stringprep_profile stringprep_xmpp_resourceprep[] = {
121 {STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_1},
122 {STRINGPREP_NFKC, 0, 0},
123 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_2},
124 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
125 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
126 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
127 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
128 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
129 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
130 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_7},
131 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
132 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
133 {STRINGPREP_BIDI, 0, 0},
134 {STRINGPREP_BIDI_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
135 {STRINGPREP_BIDI_RAL_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_1},
136 {STRINGPREP_BIDI_L_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_2},
137 {STRINGPREP_UNASSIGNED_TABLE, ~STRINGPREP_NO_UNASSIGNED,
138 stringprep_rfc3454_A_1},
142 const Stringprep_profile stringprep_plain[] = {
143 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
144 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
145 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
146 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
147 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
148 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
149 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
150 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
151 {STRINGPREP_BIDI, 0, 0},
152 {STRINGPREP_BIDI_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
153 {STRINGPREP_BIDI_RAL_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_1},
154 {STRINGPREP_BIDI_L_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_2},
158 const Stringprep_profile stringprep_trace[] = {
159 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
160 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
161 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
162 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
163 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
164 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
165 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
166 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
167 {STRINGPREP_BIDI, 0, 0},
168 {STRINGPREP_BIDI_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
169 {STRINGPREP_BIDI_RAL_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_1},
170 {STRINGPREP_BIDI_L_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_2},
174 const Stringprep_table_element stringprep_iscsi_prohibit[] = {
175 {0x0000}, /* [ASCII CONTROL CHARACTERS and SPACE through ,] */
176 {0x0001},
177 {0x0002},
178 {0x0003},
179 {0x0004},
180 {0x0005},
181 {0x0006},
182 {0x0007},
183 {0x0008},
184 {0x0009},
185 {0x000A},
186 {0x000B},
187 {0x000C},
188 {0x000D},
189 {0x000E},
190 {0x000F},
191 {0x0010},
192 {0x0011},
193 {0x0012},
194 {0x0013},
195 {0x0014},
196 {0x0015},
197 {0x0016},
198 {0x0017},
199 {0x0018},
200 {0x0019},
201 {0x001A},
202 {0x001B},
203 {0x001C},
204 {0x001D},
205 {0x001E},
206 {0x001F},
207 {0x0020},
208 {0x0021},
209 {0x0022},
210 {0x0023},
211 {0x0024},
212 {0x0025},
213 {0x0026},
214 {0x0027},
215 {0x0028},
216 {0x0029},
217 {0x002A},
218 {0x002B},
219 {0x002C},
220 {0x002F}, /* [ASCII /] */
221 {0x003B}, /* [ASCII ; through @] */
222 {0x003C},
223 {0x003D},
224 {0x003E},
225 {0x003F},
226 {0x0040},
227 {0x005B}, /* [ASCII [ through `] */
228 {0x005C},
229 {0x005D},
230 {0x005E},
231 {0x005F},
232 {0x0060},
233 {0x007B}, /* [ASCII { through DEL] */
234 {0x007C},
235 {0x007D},
236 {0x007E},
237 {0x007F},
238 {0x3002}, /* ideographic full stop */
242 const Stringprep_profile stringprep_iscsi[] = {
243 {STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_1},
244 {STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_2},
245 {STRINGPREP_NFKC, 0, 0},
246 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
247 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
248 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
249 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
250 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
251 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
252 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
253 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
254 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
255 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
256 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_iscsi_prohibit},
257 {STRINGPREP_BIDI, 0, 0},
258 {STRINGPREP_BIDI_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
259 {STRINGPREP_BIDI_RAL_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_1},
260 {STRINGPREP_BIDI_L_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_2},
261 {STRINGPREP_UNASSIGNED_TABLE, ~STRINGPREP_NO_UNASSIGNED,
262 stringprep_rfc3454_A_1},
266 const Stringprep_table_element stringprep_saslprep_space_map[] = {
267 {0x0000A0, 0, {0x0020}}, /* 00A0; NO-BREAK SPACE */
268 {0x001680, 0, {0x0020}}, /* 1680; OGHAM SPACE MARK */
269 {0x002000, 0, {0x0020}}, /* 2000; EN QUAD */
270 {0x002001, 0, {0x0020}}, /* 2001; EM QUAD */
271 {0x002002, 0, {0x0020}}, /* 2002; EN SPACE */
272 {0x002003, 0, {0x0020}}, /* 2003; EM SPACE */
273 {0x002004, 0, {0x0020}}, /* 2004; THREE-PER-EM SPACE */
274 {0x002005, 0, {0x0020}}, /* 2005; FOUR-PER-EM SPACE */
275 {0x002006, 0, {0x0020}}, /* 2006; SIX-PER-EM SPACE */
276 {0x002007, 0, {0x0020}}, /* 2007; FIGURE SPACE */
277 {0x002008, 0, {0x0020}}, /* 2008; PUNCTUATION SPACE */
278 {0x002009, 0, {0x0020}}, /* 2009; THIN SPACE */
279 {0x00200A, 0, {0x0020}}, /* 200A; HAIR SPACE */
280 {0x00200B, 0, {0x0020}}, /* 200B; ZERO WIDTH SPACE */
281 {0x00202F, 0, {0x0020}}, /* 202F; NARROW NO-BREAK SPACE */
282 {0x00205F, 0, {0x0020}}, /* 205F; MEDIUM MATHEMATICAL SPACE */
283 {0x003000, 0, {0x0020}}, /* 3000; IDEOGRAPHIC SPACE */
287 const Stringprep_profile stringprep_saslprep[] = {
288 {STRINGPREP_MAP_TABLE, 0, stringprep_saslprep_space_map},
289 {STRINGPREP_MAP_TABLE, 0, stringprep_rfc3454_B_1},
290 {STRINGPREP_NFKC, 0, 0},
291 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_1_2},
292 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_1},
293 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_2_2},
294 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_3},
295 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_4},
296 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_5},
297 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_6},
298 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_7},
299 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
300 {STRINGPREP_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_9},
301 {STRINGPREP_BIDI, 0, 0},
302 {STRINGPREP_BIDI_PROHIBIT_TABLE, 0, stringprep_rfc3454_C_8},
303 {STRINGPREP_BIDI_RAL_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_1},
304 {STRINGPREP_BIDI_L_TABLE, ~STRINGPREP_NO_BIDI, stringprep_rfc3454_D_2},
305 {STRINGPREP_UNASSIGNED_TABLE, ~STRINGPREP_NO_UNASSIGNED,
306 stringprep_rfc3454_A_1},