1 /* profiles.c definitions of stringprep profiles shipped with libstringprep
2 * Copyright (C) 2002 Simon Josefsson
4 * This file is part of libstringprep.
6 * Libstringprep 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 * Libstringprep 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 libstringprep; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "stringprep_generic.h"
23 #include "stringprep_nameprep.h"
24 #include "stringprep_kerberos5.h"
26 Stringprep_profile stringprep_generic
[] = {
27 /* 1) Map -- For each character in the input, check if it has a
28 mapping and, if so, replace it with its mapping. This is
29 described in section 3. */
31 {STRINGPREP_MAP_TABLE
, 0, stringprep_generic_B_1
, "B.1"}
33 {STRINGPREP_MAP_TABLE
, ~STRINGPREP_NO_NFKC
, stringprep_generic_B_2
, "B.2"}
35 {STRINGPREP_MAP_TABLE
, STRINGPREP_NO_NFKC
, stringprep_generic_B_3
, "B.3"}
38 /* 2) Normalize -- Possibly normalize the result of step 1 using
39 Unicode normalization. This is described in section 4. */
41 {STRINGPREP_NFKC
, ~STRINGPREP_NO_NFKC
, 0, "NFKC"}
44 /* 3) Prohibit -- Check for any characters that are not allowed in
45 the output. If any are found, return an error. This is
46 described in section 5. */
48 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_1_1
, "C.1.1"}
50 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_1_2
, "C.1.2"}
52 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_2_1
, "C.2.1"}
54 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_2_2
, "C.2.2"}
56 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_3
, "C.3"}
58 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_4
, "C.4"}
60 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_5
, "C.5"}
62 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_6
, "C.6"}
64 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_7
, "C.7"}
66 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_8
, "C.8"}
68 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_9
, "C.9"}
71 /* 4) Check bidi -- Possibly check for right-to-left characters, and
72 if any are found, make sure that the whole string satisfies
73 the requirements for bidirectional strings. If the string does
74 not satisfy the requirements for bidirectional strings, return
75 an error. This is described in section 6. */
77 {STRINGPREP_BIDI
, ~STRINGPREP_NO_BIDI
, 0, "BIDI"}
79 {STRINGPREP_BIDI_PROHIBIT_TABLE
, ~STRINGPREP_NO_BIDI
,
80 stringprep_generic_C_9
, "C.9"}
82 {STRINGPREP_BIDI_RAL_TABLE
, ~STRINGPREP_NO_BIDI
, stringprep_generic_D_1
,
85 {STRINGPREP_BIDI_L_TABLE
, ~STRINGPREP_NO_BIDI
, stringprep_generic_D_2
,
89 /* 5) Check unassigned code points -- Possibly check the output for
90 unassigned code points, according to the profile. This is
91 described in section 7. */
93 {STRINGPREP_UNASSIGNED_TABLE
, ~STRINGPREP_NO_UNASSIGNED
,
94 stringprep_generic_A_1
, "A.1"}
100 Stringprep_profile stringprep_nameprep
[] = {
101 {STRINGPREP_MAP_TABLE
, 0, stringprep_generic_B_1
, "B.1"}
103 {STRINGPREP_MAP_TABLE
, 0, stringprep_generic_B_2
, "B.2"}
105 {STRINGPREP_NFKC
, 0, 0, "NFKC"}
107 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_1_2
, "C.1.2"}
109 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_2_2
, "C.2.2"}
111 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_3
, "C.3"}
113 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_4
, "C.4"}
115 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_5
, "C.5"}
117 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_6
, "C.6"}
119 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_7
, "C.7"}
121 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_8
, "C.8"}
123 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_9
, "C.9"}
125 {STRINGPREP_BIDI
, 0, 0, "BIDI"}
127 {STRINGPREP_BIDI_PROHIBIT_TABLE
, ~STRINGPREP_NO_BIDI
,
128 stringprep_generic_C_9
, "C.9"}
130 {STRINGPREP_BIDI_RAL_TABLE
, 0, stringprep_generic_D_1
, "D.1"}
132 {STRINGPREP_BIDI_L_TABLE
, 0, stringprep_generic_D_2
, "D.2"}
134 {STRINGPREP_UNASSIGNED_TABLE
, ~STRINGPREP_NO_UNASSIGNED
,
135 stringprep_generic_A_1
, "A.1"}
140 Stringprep_profile stringprep_kerberos5
[] = {
141 /* XXX this is likely to be wrong as the specification is
143 {STRINGPREP_MAP_TABLE
, 0, stringprep_generic_B_1
, "B.1"}
145 {STRINGPREP_MAP_TABLE
, 0, stringprep_generic_B_3
, "B.2"}
147 {STRINGPREP_NFKC
, 0, 0, "NFKC"}
149 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_1_2
, "C.1.2"}
151 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_2_2
, "C.2.2"}
153 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_3
, "C.3"}
155 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_4
, "C.4"}
157 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_5
, "C.5"}
159 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_6
, "C.6"}
161 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_7
, "C.7"}
163 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_8
, "C.8"}
165 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_generic_C_9
, "C.9"}
167 {STRINGPREP_BIDI
, 0, 0, "BIDI"}
169 {STRINGPREP_BIDI_PROHIBIT_TABLE
, ~STRINGPREP_NO_BIDI
,
170 stringprep_generic_C_9
, "C.9"}
172 {STRINGPREP_BIDI_RAL_TABLE
, 0, stringprep_generic_D_1
, "D.1"}
174 {STRINGPREP_BIDI_L_TABLE
, 0, stringprep_generic_D_2
, "D.2"}
176 {STRINGPREP_UNASSIGNED_TABLE
, ~STRINGPREP_NO_UNASSIGNED
,
177 stringprep_generic_A_1
, "A.1"}