monotone

monotone Mtn Source Tree

Root/idna/profiles.c

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

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status