ICU 49.1.1
49.1.1
|
00001 /* 00002 ******************************************************************************* 00003 * 00004 * Copyright (C) 2003-2012, 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 { 00048 UIDNA_DEFAULT=0, 00056 UIDNA_ALLOW_UNASSIGNED=1, 00064 UIDNA_USE_STD3_RULES=2, 00072 UIDNA_CHECK_BIDI=4, 00080 UIDNA_CHECK_CONTEXTJ=8, 00089 UIDNA_NONTRANSITIONAL_TO_ASCII=0x10, 00098 UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20, 00099 #ifndef U_HIDE_DRAFT_API 00100 00109 UIDNA_CHECK_CONTEXTO=0x40 00110 #endif /* U_HIDE_DRAFT_API */ 00111 }; 00112 00117 struct UIDNA; 00118 typedef struct UIDNA UIDNA; 00137 U_DRAFT UIDNA * U_EXPORT2 00138 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); 00139 00145 U_DRAFT void U_EXPORT2 00146 uidna_close(UIDNA *idna); 00147 00148 #if U_SHOW_CPLUSPLUS_API 00149 00150 U_NAMESPACE_BEGIN 00151 00161 U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close); 00162 00163 U_NAMESPACE_END 00164 00165 #endif 00166 00177 struct UIDNAInfo { 00179 int16_t size; 00185 UBool isTransitionalDifferent; 00186 UBool reservedB3; 00192 uint32_t errors; 00193 int32_t reservedI2; 00194 int32_t reservedI3; 00195 }; 00196 typedef struct UIDNAInfo UIDNAInfo; 00197 00202 #define UIDNA_INFO_INITIALIZER { \ 00203 (int16_t)sizeof(UIDNAInfo), \ 00204 FALSE, FALSE, \ 00205 0, 0, 0 } 00206 00230 U_DRAFT int32_t U_EXPORT2 00231 uidna_labelToASCII(const UIDNA *idna, 00232 const UChar *label, int32_t length, 00233 UChar *dest, int32_t capacity, 00234 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00235 00257 U_DRAFT int32_t U_EXPORT2 00258 uidna_labelToUnicode(const UIDNA *idna, 00259 const UChar *label, int32_t length, 00260 UChar *dest, int32_t capacity, 00261 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00262 00286 U_DRAFT int32_t U_EXPORT2 00287 uidna_nameToASCII(const UIDNA *idna, 00288 const UChar *name, int32_t length, 00289 UChar *dest, int32_t capacity, 00290 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00291 00313 U_DRAFT int32_t U_EXPORT2 00314 uidna_nameToUnicode(const UIDNA *idna, 00315 const UChar *name, int32_t length, 00316 UChar *dest, int32_t capacity, 00317 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00318 00319 /* UTF-8 versions of the processing methods --------------------------------- */ 00320 00338 U_DRAFT int32_t U_EXPORT2 00339 uidna_labelToASCII_UTF8(const UIDNA *idna, 00340 const char *label, int32_t length, 00341 char *dest, int32_t capacity, 00342 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00343 00361 U_DRAFT int32_t U_EXPORT2 00362 uidna_labelToUnicodeUTF8(const UIDNA *idna, 00363 const char *label, int32_t length, 00364 char *dest, int32_t capacity, 00365 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00366 00384 U_DRAFT int32_t U_EXPORT2 00385 uidna_nameToASCII_UTF8(const UIDNA *idna, 00386 const char *name, int32_t length, 00387 char *dest, int32_t capacity, 00388 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00389 00407 U_DRAFT int32_t U_EXPORT2 00408 uidna_nameToUnicodeUTF8(const UIDNA *idna, 00409 const char *name, int32_t length, 00410 char *dest, int32_t capacity, 00411 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00412 00413 /* 00414 * IDNA error bit set values. 00415 * When a domain name or label fails a processing step or does not meet the 00416 * validity criteria, then one or more of these error bits are set. 00417 */ 00418 enum { 00423 UIDNA_ERROR_EMPTY_LABEL=1, 00430 UIDNA_ERROR_LABEL_TOO_LONG=2, 00437 UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4, 00442 UIDNA_ERROR_LEADING_HYPHEN=8, 00447 UIDNA_ERROR_TRAILING_HYPHEN=0x10, 00452 UIDNA_ERROR_HYPHEN_3_4=0x20, 00457 UIDNA_ERROR_LEADING_COMBINING_MARK=0x40, 00462 UIDNA_ERROR_DISALLOWED=0x80, 00468 UIDNA_ERROR_PUNYCODE=0x100, 00474 UIDNA_ERROR_LABEL_HAS_DOT=0x200, 00483 UIDNA_ERROR_INVALID_ACE_LABEL=0x400, 00488 UIDNA_ERROR_BIDI=0x800, 00493 UIDNA_ERROR_CONTEXTJ=0x1000, 00494 #ifndef U_HIDE_DRAFT_API 00495 00501 UIDNA_ERROR_CONTEXTO_PUNCTUATION=0x2000, 00507 UIDNA_ERROR_CONTEXTO_DIGITS=0x4000 00508 #endif /* U_HIDE_DRAFT_API */ 00509 }; 00510 00511 /* IDNA2003 API ------------------------------------------------------------- */ 00512 00572 U_STABLE int32_t U_EXPORT2 00573 uidna_toASCII(const UChar* src, int32_t srcLength, 00574 UChar* dest, int32_t destCapacity, 00575 int32_t options, 00576 UParseError* parseError, 00577 UErrorCode* status); 00578 00579 00620 U_STABLE int32_t U_EXPORT2 00621 uidna_toUnicode(const UChar* src, int32_t srcLength, 00622 UChar* dest, int32_t destCapacity, 00623 int32_t options, 00624 UParseError* parseError, 00625 UErrorCode* status); 00626 00627 00671 U_STABLE int32_t U_EXPORT2 00672 uidna_IDNToASCII( const UChar* src, int32_t srcLength, 00673 UChar* dest, int32_t destCapacity, 00674 int32_t options, 00675 UParseError* parseError, 00676 UErrorCode* status); 00677 00718 U_STABLE int32_t U_EXPORT2 00719 uidna_IDNToUnicode( const UChar* src, int32_t srcLength, 00720 UChar* dest, int32_t destCapacity, 00721 int32_t options, 00722 UParseError* parseError, 00723 UErrorCode* status); 00724 00759 U_STABLE int32_t U_EXPORT2 00760 uidna_compare( const UChar *s1, int32_t length1, 00761 const UChar *s2, int32_t length2, 00762 int32_t options, 00763 UErrorCode* status); 00764 00765 #endif /* #if !UCONFIG_NO_IDNA */ 00766 00767 #endif