Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / netwerk / dns / src / nsIDNKitInterface.h
blob2dc5ad1482c90b3129b5249c9ebb11824d7eb352
1 /*
2 * Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved.
3 *
4 * By using this file, you agree to the terms and conditions set forth bellow.
5 *
6 * LICENSE TERMS AND CONDITIONS
7 *
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 #ifdef __cplusplus
47 extern "C" {
48 #endif /* __cplusplus */
50 #include "prtypes.h"
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.
77 */
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 #define assert(a)
96 #define TRACE(a)
99 /* race.c */
100 idn_result_t race_decode_decompress(const char *from,
101 PRUint16 *buf,
102 size_t buflen);
103 idn_result_t race_compress_encode(const PRUint16 *p,
104 int compress_mode,
105 char *to, size_t tolen);
106 int get_compress_mode(PRUint16 *p);
109 /* nameprep.c */
112 * Create a handle for nameprep operations.
113 * The handle is stored in '*handlep', which is used other functions
114 * in this module.
115 * The version of the NAMEPREP specification can be specified with
116 * 'version' parameter. If 'version' is NULL, the latest version
117 * is used.
119 * Returns:
120 * idn_success -- ok.
121 * idn_notfound -- specified version not found.
123 idn_result_t
124 idn_nameprep_create(const char *version, idn_nameprep_t *handlep);
127 * Close a handle, which was created by 'idn_nameprep_create'.
129 void
130 idn_nameprep_destroy(idn_nameprep_t handle);
133 * Perform character mapping on an UCS4 string specified by 'from', and
134 * store the result into 'to', whose length is specified by 'tolen'.
136 * Returns:
137 * idn_success -- ok.
138 * idn_buffer_overflow -- result buffer is too small.
140 idn_result_t
141 idn_nameprep_map(idn_nameprep_t handle, const PRUint32 *from,
142 PRUint32 *to, size_t tolen);
145 * Check if an UCS4 string 'str' contains any prohibited characters specified
146 * by the draft. If found, the pointer to the first such character is stored
147 * into '*found'. Otherwise '*found' will be NULL.
149 * Returns:
150 * idn_success -- check has been done properly. (But this
151 * does not mean that no prohibited character
152 * was found. Check '*found' to see the
153 * result.)
155 idn_result_t
156 idn_nameprep_isprohibited(idn_nameprep_t handle, const PRUint32 *str,
157 const PRUint32 **found);
160 * Check if an UCS4 string 'str' contains any unassigned characters specified
161 * by the draft. If found, the pointer to the first such character is stored
162 * into '*found'. Otherwise '*found' will be NULL.
164 * Returns:
165 * idn_success -- check has been done properly. (But this
166 * does not mean that no unassinged character
167 * was found. Check '*found' to see the
168 * result.)
170 idn_result_t
171 idn_nameprep_isunassigned(idn_nameprep_t handle, const PRUint32 *str,
172 const PRUint32 **found);
175 * Check if an UCS4 string 'str' is valid string specified by ``bidi check''
176 * of the draft. If it is not valid, the pointer to the first invalid
177 * character is stored into '*found'. Otherwise '*found' will be NULL.
179 * Returns:
180 * idn_success -- check has been done properly. (But this
181 * does not mean that the string was valid.
182 * Check '*found' to see the result.)
184 idn_result_t
185 idn_nameprep_isvalidbidi(idn_nameprep_t handle, const PRUint32 *str,
186 const PRUint32 **found);
190 #ifdef __cplusplus
192 #endif /* __cplusplus */
194 #endif /* nsIDNKitWrapper_h__ */