Bug 1807268 - Re-enable verifyShowClipboardSuggestionsToggleTest UI test r=jajohnson
[gecko.git] / netwerk / dns / nsIDNKitInterface.h
blob3e0f0d60ac6648507bbb3465c4f2db8d86be3e99
1 /*
2 * Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved.
4 * By using this file, you agree to the terms and conditions set forth bellow.
6 * LICENSE TERMS AND CONDITIONS
8 * The following License Terms and Conditions apply, unless a different
9 * license is obtained from Japan Network Information Center ("JPNIC"),
10 * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
11 * Chiyoda-ku, Tokyo 101-0047, Japan.
13 * 1. Use, Modification and Redistribution (including distribution of any
14 * modified or derived work) in source and/or binary forms is permitted
15 * under this License Terms and Conditions.
17 * 2. Redistribution of source code must retain the copyright notices as they
18 * appear in each source code file, this License Terms and Conditions.
20 * 3. Redistribution in binary form must reproduce the Copyright Notice,
21 * this License Terms and Conditions, in the documentation and/or other
22 * materials provided with the distribution. For the purposes of binary
23 * distribution the "Copyright Notice" refers to the following language:
24 * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
26 * 4. The name of JPNIC may not be used to endorse or promote products
27 * derived from this Software without specific prior written approval of
28 * JPNIC.
30 * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
33 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
37 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
39 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
40 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
43 #ifndef nsIDNKitWrapper_h__
44 #define nsIDNKitWrapper_h__
46 #include <stdint.h>
48 #ifdef __cplusplus
49 extern "C" {
50 #endif /* __cplusplus */
53 * libidnkit result code.
55 typedef enum {
56 idn_success,
57 idn_notfound,
58 idn_invalid_encoding,
59 idn_invalid_syntax,
60 idn_invalid_name,
61 idn_invalid_message,
62 idn_invalid_action,
63 idn_invalid_codepoint,
64 idn_invalid_length,
65 idn_buffer_overflow,
66 idn_noentry,
67 idn_nomemory,
68 idn_nofile,
69 idn_nomapping,
70 idn_context_required,
71 idn_prohibited,
72 idn_failure /* !!This must be the last one!! */
73 } idn_result_t;
76 * BIDI type codes.
78 typedef enum {
79 idn_biditype_r_al,
80 idn_biditype_l,
81 idn_biditype_others
82 } idn_biditype_t;
85 * A Handle for nameprep operations.
87 typedef struct idn_nameprep *idn_nameprep_t;
91 * The latest version of nameprep.
93 #define IDN_NAMEPREP_CURRENT "nameprep-11"
95 #undef assert
96 #define assert(a)
97 #define TRACE(a)
100 /* race.c */
101 idn_result_t race_decode_decompress(const char *from,
102 uint16_t *buf,
103 size_t buflen);
104 idn_result_t race_compress_encode(const uint16_t *p,
105 int compress_mode,
106 char *to, size_t tolen);
107 int get_compress_mode(uint16_t *p);
110 /* nameprep.c */
113 * Create a handle for nameprep operations.
114 * The handle is stored in '*handlep', which is used other functions
115 * in this module.
116 * The version of the NAMEPREP specification can be specified with
117 * 'version' parameter. If 'version' is nullptr, the latest version
118 * is used.
120 * Returns:
121 * idn_success -- ok.
122 * idn_notfound -- specified version not found.
124 idn_result_t
125 idn_nameprep_create(const char *version, idn_nameprep_t *handlep);
128 * Close a handle, which was created by 'idn_nameprep_create'.
130 void
131 idn_nameprep_destroy(idn_nameprep_t handle);
134 * Perform character mapping on an UCS4 string specified by 'from', and
135 * store the result into 'to', whose length is specified by 'tolen'.
137 * Returns:
138 * idn_success -- ok.
139 * idn_buffer_overflow -- result buffer is too small.
141 idn_result_t
142 idn_nameprep_map(idn_nameprep_t handle, const uint32_t *from,
143 uint32_t *to, size_t tolen);
146 * Check if an UCS4 string 'str' contains any prohibited characters specified
147 * by the draft. If found, the pointer to the first such character is stored
148 * into '*found'. Otherwise '*found' will be nullptr.
150 * Returns:
151 * idn_success -- check has been done properly. (But this
152 * does not mean that no prohibited character
153 * was found. Check '*found' to see the
154 * result.)
156 idn_result_t
157 idn_nameprep_isprohibited(idn_nameprep_t handle, const uint32_t *str,
158 const uint32_t **found);
161 * Check if an UCS4 string 'str' contains any unassigned characters specified
162 * by the draft. If found, the pointer to the first such character is stored
163 * into '*found'. Otherwise '*found' will be nullptr.
165 * Returns:
166 * idn_success -- check has been done properly. (But this
167 * does not mean that no unassinged character
168 * was found. Check '*found' to see the
169 * result.)
171 idn_result_t
172 idn_nameprep_isunassigned(idn_nameprep_t handle, const uint32_t *str,
173 const uint32_t **found);
176 * Check if an UCS4 string 'str' is valid string specified by ``bidi check''
177 * of the draft. If it is not valid, the pointer to the first invalid
178 * character is stored into '*found'. Otherwise '*found' will be nullptr.
180 * Returns:
181 * idn_success -- check has been done properly. (But this
182 * does not mean that the string was valid.
183 * Check '*found' to see the result.)
185 idn_result_t
186 idn_nameprep_isvalidbidi(idn_nameprep_t handle, const uint32_t *str,
187 const uint32_t **found);
191 #ifdef __cplusplus
193 #endif /* __cplusplus */
195 #endif /* nsIDNKitWrapper_h__ */