libidn 1.44
profiles.c
Go to the documentation of this file.
1/* profiles.c --- Definitions of stringprep profiles.
2 Copyright (C) 2002-2026 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 either:
8
9 * the GNU Lesser General Public License as published by the Free
10 Software Foundation; either version 3 of the License, or (at
11 your option) any later version.
12
13 or
14
15 * the GNU General Public License as published by the Free
16 Software Foundation; either version 2 of the License, or (at
17 your option) any later version.
18
19 or both in parallel, as here.
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 <https://www.gnu.org/licenses/>. */
29
30#include <config.h>
31#include "stringprep.h"
32#include "rfc3454.h"
33
35 {"Nameprep", stringprep_nameprep},
36 {"KRBprep", stringprep_kerberos5}, /* Deprecate? */
37 {"Nodeprep", stringprep_xmpp_nodeprep},
38 {"Resourceprep", stringprep_xmpp_resourceprep},
39 {"plain", stringprep_plain}, /* sasl-anon-00. */
40 {"trace", stringprep_trace}, /* sasl-anon-01,02,03. */
41 {"SASLprep", stringprep_saslprep},
42 {"ISCSIprep", stringprep_iscsi}, /* Obsolete. */
43 {"iSCSI", stringprep_iscsi}, /* IANA. */
44 {NULL, NULL}
45};
46
47/* number of elements within an array */
48#define countof(a) (sizeof(a)/sizeof(*(a)))
49
50/* helper for profile definitions */
51#define TABLE(x) stringprep_rfc3454_##x, N_STRINGPREP_rfc3454_##x
52
73
75 /* XXX this is likely to be wrong as the specification is
76 a rough draft. */
77 {STRINGPREP_MAP_TABLE, 0, TABLE (B_1)},
78 {STRINGPREP_MAP_TABLE, 0, TABLE (B_3)},
79 {STRINGPREP_NFKC, 0, 0, 0},
80 {STRINGPREP_PROHIBIT_TABLE, 0, TABLE (C_1_2)},
81 {STRINGPREP_PROHIBIT_TABLE, 0, TABLE (C_2_2)},
89 {STRINGPREP_BIDI, 0, 0, 0},
94 {0}
95};
96
98 {0x000022, 0x000022}, /* #x22 (") */
99 {0x000026, 0x000026}, /* #x26 (&) */
100 {0x000027, 0x000027}, /* #x27 (') */
101 {0x00002F, 0x00002F}, /* #x2F (/) */
102 {0x00003A, 0x00003A}, /* #x3A (:) */
103 {0x00003C, 0x00003C}, /* #x3C (<) */
104 {0x00003E, 0x00003E}, /* #x3E (>) */
105 {0x000040, 0x000040}, /* #x40 (@) */
106 {0}
107};
108
133
154
170
186
188 {0x0000, 0x002C}, /* [ASCII CONTROL CHARACTERS and SPACE through ,] */
189 {0x002F, 0x002F}, /* [ASCII /] */
190 {0x003B, 0x0040}, /* [ASCII ; through @] */
191 {0x005B, 0x0060}, /* [ASCII [ through `] */
192 {0x007B, 0x007F}, /* [ASCII { through DEL] */
193 {0x3002, 0x3002}, /* ideographic full stop */
194 {0}
195};
196
221
223 {0x00A0, 0x00A0, {0x0020}}, /* 00A0; NO-BREAK SPACE */
224 {0x1680, 0x1680, {0x0020}}, /* 1680; OGHAM SPACE MARK */
225 {0x2000, 0x200B, {0x0020}}, /* 2000; EN QUAD */
226 /* 2001; EM QUAD */
227 /* 2002; EN SPACE */
228 /* 2003; EM SPACE */
229 /* 2004; THREE-PER-EM SPACE */
230 /* 2005; FOUR-PER-EM SPACE */
231 /* 2006; SIX-PER-EM SPACE */
232 /* 2007; FIGURE SPACE */
233 /* 2008; PUNCTUATION SPACE */
234 /* 2009; THIN SPACE */
235 /* 200A; HAIR SPACE */
236 /* 200B; ZERO WIDTH SPACE */
237 {0x202F, 0x202F, {0x0020}}, /* 202F; NARROW NO-BREAK SPACE */
238 {0x205F, 0x205F, {0x0020}}, /* 205F; MEDIUM MATHEMATICAL SPACE */
239 {0x3000, 0x3000, {0x0020}}, /* 3000; IDEOGRAPHIC SPACE */
240 {0}
241};
242
#define countof(a)
Definition profiles.c:48
const Stringprep_table_element stringprep_xmpp_nodeprep_prohibit[]
Definition profiles.c:97
const Stringprep_profile stringprep_saslprep[]
Definition profiles.c:243
const Stringprep_profiles stringprep_profiles[]
Definition profiles.c:34
const Stringprep_profile stringprep_trace[]
Definition profiles.c:171
#define TABLE(x)
Definition profiles.c:51
const Stringprep_table_element stringprep_iscsi_prohibit[]
Definition profiles.c:187
const Stringprep_table_element stringprep_saslprep_space_map[]
Definition profiles.c:222
#define stringprep_xmpp_resourceprep(in, maxlen)
Definition stringprep.h:235
struct Stringprep_table Stringprep_profile
Definition stringprep.h:160
#define stringprep_xmpp_nodeprep(in, maxlen)
Definition stringprep.h:233
@ STRINGPREP_BIDI_PROHIBIT_TABLE
Definition stringprep.h:101
@ STRINGPREP_BIDI_RAL_TABLE
Definition stringprep.h:102
@ STRINGPREP_NFKC
Definition stringprep.h:96
@ STRINGPREP_PROHIBIT_TABLE
Definition stringprep.h:100
@ STRINGPREP_UNASSIGNED_TABLE
Definition stringprep.h:99
@ STRINGPREP_BIDI
Definition stringprep.h:97
@ STRINGPREP_MAP_TABLE
Definition stringprep.h:98
@ STRINGPREP_BIDI_L_TABLE
Definition stringprep.h:103
#define stringprep_kerberos5(in, maxlen)
Definition stringprep.h:223
@ STRINGPREP_NO_BIDI
Definition stringprep.h:89
@ STRINGPREP_NO_UNASSIGNED
Definition stringprep.h:90
#define stringprep_plain(in, maxlen)
Definition stringprep.h:216
#define stringprep_nameprep(in, maxlen)
Definition stringprep.h:202
#define stringprep_iscsi(in, maxlen)
Definition stringprep.h:243