1 /* idna.h - internal IDNA function prototypes
2    Copyright (C) 2011-2021 Simon Josefsson
3 
4    Libidn2 is free software: you can redistribute it and/or modify it
5    under the terms of either:
6 
7      * the GNU Lesser General Public License as published by the Free
8        Software Foundation; either version 3 of the License, or (at
9        your option) any later version.
10 
11    or
12 
13      * the GNU General Public License as published by the Free
14        Software Foundation; either version 2 of the License, or (at
15        your option) any later version.
16 
17    or both in parallel, as here.
18 
19    This program is distributed in the hope that it will be useful,
20    but WITHOUT ANY WARRANTY; without even the implied warranty of
21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22    GNU General Public License for more details.
23 
24    You should have received copies of the GNU General Public License and
25    the GNU Lesser General Public License along with this program.  If
26    not, see <http://www.gnu.org/licenses/>.
27 */
28 
29 #ifndef LIBIDN2_IDNA_H
30 #define LIBIDN2_IDNA_H
31 
32 #include <stdint.h>
33 #include <stdbool.h>
34 #include "idn2.h"
35 
36 enum
37 {
38   TEST_NFC = 0x0001,
39   TEST_2HYPHEN = 0x0002,
40   TEST_HYPHEN_STARTEND = 0x0004,
41   TEST_LEADING_COMBINING = 0x0008,
42   TEST_DISALLOWED = 0x0010,
43   /* is code point a CONTEXTJ code point? */
44   TEST_CONTEXTJ = 0x0020,
45   /* does code point pass CONTEXTJ rule? */
46   TEST_CONTEXTJ_RULE = 0x0040,
47   /* is code point a CONTEXTO code point? */
48   TEST_CONTEXTO = 0x0080,
49   /* is there a CONTEXTO rule for code point? */
50   TEST_CONTEXTO_WITH_RULE = 0x0100,
51   /* does code point pass CONTEXTO rule? */
52   TEST_CONTEXTO_RULE = 0x0200,
53   TEST_UNASSIGNED = 0x0400,
54   TEST_BIDI = 0x0800,
55   TEST_TRANSITIONAL = 0x1000,
56   TEST_NONTRANSITIONAL = 0x2000,
57   TEST_ALLOW_STD3_DISALLOWED = 0x4000,
58 };
59 
60 extern int
61 _idn2_u8_to_u32_nfc (const uint8_t * src, size_t srclen,
62 		     uint32_t ** out, size_t *outlen, int nfc);
63 
64 extern G_GNUC_IDN2_ATTRIBUTE_PURE bool
65 _idn2_ascii_p (const uint8_t * src, size_t srclen);
66 
67 extern int _idn2_label_test (int what, const uint32_t * label, size_t llen);
68 
69 #endif /* LIBIDN2_IDNA_H */
70