ICU 4.8.1.1
4.8.1.1
|
00001 /* 00002 ******************************************************************************* 00003 * 00004 * Copyright (C) 2003-2010, International Business Machines 00005 * Corporation and others. All Rights Reserved. 00006 * 00007 ******************************************************************************* 00008 * file name: uidna.h 00009 * encoding: US-ASCII 00010 * tab size: 8 (not used) 00011 * indentation:4 00012 * 00013 * created on: 2003feb1 00014 * created by: Ram Viswanadha 00015 */ 00016 00017 #ifndef __UIDNA_H__ 00018 #define __UIDNA_H__ 00019 00020 #include "unicode/utypes.h" 00021 00022 #if !UCONFIG_NO_IDNA 00023 00024 #include "unicode/localpointer.h" 00025 #include "unicode/parseerr.h" 00026 00039 /* 00040 * IDNA option bit set values. 00041 */ 00042 enum { 00047 UIDNA_DEFAULT=0, 00054 UIDNA_ALLOW_UNASSIGNED=1, 00061 UIDNA_USE_STD3_RULES=2, 00068 UIDNA_CHECK_BIDI=4, 00075 UIDNA_CHECK_CONTEXTJ=8, 00083 UIDNA_NONTRANSITIONAL_TO_ASCII=0x10, 00091 UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20 00092 }; 00093 00098 struct UIDNA; 00099 typedef struct UIDNA UIDNA; 00118 U_DRAFT UIDNA * U_EXPORT2 00119 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); 00120 00126 U_DRAFT void U_EXPORT2 00127 uidna_close(UIDNA *idna); 00128 00129 #if U_SHOW_CPLUSPLUS_API 00130 00131 U_NAMESPACE_BEGIN 00132 00142 U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close); 00143 00144 U_NAMESPACE_END 00145 00146 #endif 00147 00158 struct UIDNAInfo { 00160 int16_t size; 00166 UBool isTransitionalDifferent; 00167 UBool reservedB3; 00173 uint32_t errors; 00174 int32_t reservedI2; 00175 int32_t reservedI3; 00176 }; 00177 typedef struct UIDNAInfo UIDNAInfo; 00178 00183 #define UIDNA_INFO_INITIALIZER { \ 00184 (int16_t)sizeof(UIDNAInfo), \ 00185 FALSE, FALSE, \ 00186 0, 0, 0 } 00187 00211 U_DRAFT int32_t U_EXPORT2 00212 uidna_labelToASCII(const UIDNA *idna, 00213 const UChar *label, int32_t length, 00214 UChar *dest, int32_t capacity, 00215 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00216 00238 U_DRAFT int32_t U_EXPORT2 00239 uidna_labelToUnicode(const UIDNA *idna, 00240 const UChar *label, int32_t length, 00241 UChar *dest, int32_t capacity, 00242 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00243 00267 U_DRAFT int32_t U_EXPORT2 00268 uidna_nameToASCII(const UIDNA *idna, 00269 const UChar *name, int32_t length, 00270 UChar *dest, int32_t capacity, 00271 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00272 00294 U_DRAFT int32_t U_EXPORT2 00295 uidna_nameToUnicode(const UIDNA *idna, 00296 const UChar *name, int32_t length, 00297 UChar *dest, int32_t capacity, 00298 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00299 00300 /* UTF-8 versions of the processing methods --------------------------------- */ 00301 00319 U_DRAFT int32_t U_EXPORT2 00320 uidna_labelToASCII_UTF8(const UIDNA *idna, 00321 const char *label, int32_t length, 00322 char *dest, int32_t capacity, 00323 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00324 00342 U_DRAFT int32_t U_EXPORT2 00343 uidna_labelToUnicodeUTF8(const UIDNA *idna, 00344 const char *label, int32_t length, 00345 char *dest, int32_t capacity, 00346 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00347 00365 U_DRAFT int32_t U_EXPORT2 00366 uidna_nameToASCII_UTF8(const UIDNA *idna, 00367 const char *name, int32_t length, 00368 char *dest, int32_t capacity, 00369 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00370 00388 U_DRAFT int32_t U_EXPORT2 00389 uidna_nameToUnicodeUTF8(const UIDNA *idna, 00390 const char *name, int32_t length, 00391 char *dest, int32_t capacity, 00392 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00393 00394 /* 00395 * IDNA error bit set values. 00396 * When a domain name or label fails a processing step or does not meet the 00397 * validity criteria, then one or more of these error bits are set. 00398 */ 00399 enum { 00404 UIDNA_ERROR_EMPTY_LABEL=1, 00411 UIDNA_ERROR_LABEL_TOO_LONG=2, 00418 UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4, 00423 UIDNA_ERROR_LEADING_HYPHEN=8, 00428 UIDNA_ERROR_TRAILING_HYPHEN=0x10, 00433 UIDNA_ERROR_HYPHEN_3_4=0x20, 00438 UIDNA_ERROR_LEADING_COMBINING_MARK=0x40, 00443 UIDNA_ERROR_DISALLOWED=0x80, 00449 UIDNA_ERROR_PUNYCODE=0x100, 00455 UIDNA_ERROR_LABEL_HAS_DOT=0x200, 00464 UIDNA_ERROR_INVALID_ACE_LABEL=0x400, 00469 UIDNA_ERROR_BIDI=0x800, 00474 UIDNA_ERROR_CONTEXTJ=0x1000 00475 }; 00476 00477 /* IDNA2003 API ------------------------------------------------------------- */ 00478 00538 U_STABLE int32_t U_EXPORT2 00539 uidna_toASCII(const UChar* src, int32_t srcLength, 00540 UChar* dest, int32_t destCapacity, 00541 int32_t options, 00542 UParseError* parseError, 00543 UErrorCode* status); 00544 00545 00586 U_STABLE int32_t U_EXPORT2 00587 uidna_toUnicode(const UChar* src, int32_t srcLength, 00588 UChar* dest, int32_t destCapacity, 00589 int32_t options, 00590 UParseError* parseError, 00591 UErrorCode* status); 00592 00593 00637 U_STABLE int32_t U_EXPORT2 00638 uidna_IDNToASCII( const UChar* src, int32_t srcLength, 00639 UChar* dest, int32_t destCapacity, 00640 int32_t options, 00641 UParseError* parseError, 00642 UErrorCode* status); 00643 00684 U_STABLE int32_t U_EXPORT2 00685 uidna_IDNToUnicode( const UChar* src, int32_t srcLength, 00686 UChar* dest, int32_t destCapacity, 00687 int32_t options, 00688 UParseError* parseError, 00689 UErrorCode* status); 00690 00725 U_STABLE int32_t U_EXPORT2 00726 uidna_compare( const UChar *s1, int32_t length1, 00727 const UChar *s2, int32_t length2, 00728 int32_t options, 00729 UErrorCode* status); 00730 00731 #endif /* #if !UCONFIG_NO_IDNA */ 00732 00733 #endif