ICU 54.1 54.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
uidna.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 *
4 * Copyright (C) 2003-2013, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 *******************************************************************************
8 * file name: uidna.h
9 * encoding: US-ASCII
10 * tab size: 8 (not used)
11 * indentation:4
12 *
13 * created on: 2003feb1
14 * created by: Ram Viswanadha
15 */
16
17 #ifndef __UIDNA_H__
18 #define __UIDNA_H__
19
20 #include "unicode/utypes.h"
21
22 #if !UCONFIG_NO_IDNA
23
24 #include "unicode/localpointer.h"
25 #include "unicode/parseerr.h"
26
39 /*
40 * IDNA option bit set values.
41 */
42 enum {
48 UIDNA_DEFAULT=0,
56 UIDNA_ALLOW_UNASSIGNED=1,
64 UIDNA_USE_STD3_RULES=2,
72 UIDNA_CHECK_BIDI=4,
80 UIDNA_CHECK_CONTEXTJ=8,
89 UIDNA_NONTRANSITIONAL_TO_ASCII=0x10,
98 UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20,
108 UIDNA_CHECK_CONTEXTO=0x40
109 };
110
115 struct UIDNA;
116 typedef struct UIDNA UIDNA;
135 U_STABLE UIDNA * U_EXPORT2
136 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode);
137
143 U_STABLE void U_EXPORT2
144 uidna_close(UIDNA *idna);
145
146 #if U_SHOW_CPLUSPLUS_API
147
148 U_NAMESPACE_BEGIN
149
159 U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close);
160
161 U_NAMESPACE_END
162
163 #endif
164
175 typedef struct UIDNAInfo {
177 int16_t size;
183 UBool isTransitionalDifferent;
184 UBool reservedB3;
190 uint32_t errors;
191 int32_t reservedI2;
192 int32_t reservedI3;
193 } UIDNAInfo;
194
199 #define UIDNA_INFO_INITIALIZER { \
200 (int16_t)sizeof(UIDNAInfo), \
201 FALSE, FALSE, \
202 0, 0, 0 }
203
227 U_STABLE int32_t U_EXPORT2
228 uidna_labelToASCII(const UIDNA *idna,
229 const UChar *label, int32_t length,
230 UChar *dest, int32_t capacity,
231 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
232
254 U_STABLE int32_t U_EXPORT2
255 uidna_labelToUnicode(const UIDNA *idna,
256 const UChar *label, int32_t length,
257 UChar *dest, int32_t capacity,
258 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
259
283 U_STABLE int32_t U_EXPORT2
284 uidna_nameToASCII(const UIDNA *idna,
285 const UChar *name, int32_t length,
286 UChar *dest, int32_t capacity,
287 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
288
310 U_STABLE int32_t U_EXPORT2
311 uidna_nameToUnicode(const UIDNA *idna,
312 const UChar *name, int32_t length,
313 UChar *dest, int32_t capacity,
314 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
315
316 /* UTF-8 versions of the processing methods --------------------------------- */
317
335 U_STABLE int32_t U_EXPORT2
336 uidna_labelToASCII_UTF8(const UIDNA *idna,
337 const char *label, int32_t length,
338 char *dest, int32_t capacity,
339 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
340
358 U_STABLE int32_t U_EXPORT2
359 uidna_labelToUnicodeUTF8(const UIDNA *idna,
360 const char *label, int32_t length,
361 char *dest, int32_t capacity,
362 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
363
381 U_STABLE int32_t U_EXPORT2
382 uidna_nameToASCII_UTF8(const UIDNA *idna,
383 const char *name, int32_t length,
384 char *dest, int32_t capacity,
385 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
386
404 U_STABLE int32_t U_EXPORT2
405 uidna_nameToUnicodeUTF8(const UIDNA *idna,
406 const char *name, int32_t length,
407 char *dest, int32_t capacity,
408 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
409
410 /*
411 * IDNA error bit set values.
412 * When a domain name or label fails a processing step or does not meet the
413 * validity criteria, then one or more of these error bits are set.
414 */
415 enum {
420 UIDNA_ERROR_EMPTY_LABEL=1,
427 UIDNA_ERROR_LABEL_TOO_LONG=2,
434 UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4,
439 UIDNA_ERROR_LEADING_HYPHEN=8,
444 UIDNA_ERROR_TRAILING_HYPHEN=0x10,
449 UIDNA_ERROR_HYPHEN_3_4=0x20,
454 UIDNA_ERROR_LEADING_COMBINING_MARK=0x40,
459 UIDNA_ERROR_DISALLOWED=0x80,
465 UIDNA_ERROR_PUNYCODE=0x100,
471 UIDNA_ERROR_LABEL_HAS_DOT=0x200,
480 UIDNA_ERROR_INVALID_ACE_LABEL=0x400,
485 UIDNA_ERROR_BIDI=0x800,
490 UIDNA_ERROR_CONTEXTJ=0x1000,
497 UIDNA_ERROR_CONTEXTO_PUNCTUATION=0x2000,
503 UIDNA_ERROR_CONTEXTO_DIGITS=0x4000
504 };
505
506 /* IDNA2003 API ------------------------------------------------------------- */
507
567 U_STABLE int32_t U_EXPORT2
568 uidna_toASCII(const UChar* src, int32_t srcLength,
569 UChar* dest, int32_t destCapacity,
570 int32_t options,
571 UParseError* parseError,
572 UErrorCode* status);
573
574
615 U_STABLE int32_t U_EXPORT2
616 uidna_toUnicode(const UChar* src, int32_t srcLength,
617 UChar* dest, int32_t destCapacity,
618 int32_t options,
619 UParseError* parseError,
620 UErrorCode* status);
621
622
666 U_STABLE int32_t U_EXPORT2
667 uidna_IDNToASCII( const UChar* src, int32_t srcLength,
668 UChar* dest, int32_t destCapacity,
669 int32_t options,
670 UParseError* parseError,
671 UErrorCode* status);
672
713 U_STABLE int32_t U_EXPORT2
714 uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
715 UChar* dest, int32_t destCapacity,
716 int32_t options,
717 UParseError* parseError,
718 UErrorCode* status);
719
754 U_STABLE int32_t U_EXPORT2
755 uidna_compare( const UChar *s1, int32_t length1,
756 const UChar *s2, int32_t length2,
757 int32_t options,
758 UErrorCode* status);
759
760 #endif /* #if !UCONFIG_NO_IDNA */
761
762 #endif