|
ICU 51.2
51.2
|
00001 /* 00002 ******************************************************************************* 00003 * 00004 * Copyright (C) 2003-2013, 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, 00108 UIDNA_CHECK_CONTEXTO=0x40 00109 }; 00110 00115 struct UIDNA; 00116 typedef struct UIDNA UIDNA; 00135 U_STABLE UIDNA * U_EXPORT2 00136 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); 00137 00143 U_STABLE void U_EXPORT2 00144 uidna_close(UIDNA *idna); 00145 00146 #if U_SHOW_CPLUSPLUS_API 00147 00148 U_NAMESPACE_BEGIN 00149 00159 U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close); 00160 00161 U_NAMESPACE_END 00162 00163 #endif 00164 00175 typedef struct UIDNAInfo { 00177 int16_t size; 00183 UBool isTransitionalDifferent; 00184 UBool reservedB3; 00190 uint32_t errors; 00191 int32_t reservedI2; 00192 int32_t reservedI3; 00193 } UIDNAInfo; 00194 00199 #define UIDNA_INFO_INITIALIZER { \ 00200 (int16_t)sizeof(UIDNAInfo), \ 00201 FALSE, FALSE, \ 00202 0, 0, 0 } 00203 00227 U_STABLE int32_t U_EXPORT2 00228 uidna_labelToASCII(const UIDNA *idna, 00229 const UChar *label, int32_t length, 00230 UChar *dest, int32_t capacity, 00231 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00232 00254 U_STABLE int32_t U_EXPORT2 00255 uidna_labelToUnicode(const UIDNA *idna, 00256 const UChar *label, int32_t length, 00257 UChar *dest, int32_t capacity, 00258 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00259 00283 U_STABLE int32_t U_EXPORT2 00284 uidna_nameToASCII(const UIDNA *idna, 00285 const UChar *name, int32_t length, 00286 UChar *dest, int32_t capacity, 00287 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00288 00310 U_STABLE int32_t U_EXPORT2 00311 uidna_nameToUnicode(const UIDNA *idna, 00312 const UChar *name, int32_t length, 00313 UChar *dest, int32_t capacity, 00314 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00315 00316 /* UTF-8 versions of the processing methods --------------------------------- */ 00317 00335 U_STABLE int32_t U_EXPORT2 00336 uidna_labelToASCII_UTF8(const UIDNA *idna, 00337 const char *label, int32_t length, 00338 char *dest, int32_t capacity, 00339 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00340 00358 U_STABLE int32_t U_EXPORT2 00359 uidna_labelToUnicodeUTF8(const UIDNA *idna, 00360 const char *label, int32_t length, 00361 char *dest, int32_t capacity, 00362 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00363 00381 U_STABLE int32_t U_EXPORT2 00382 uidna_nameToASCII_UTF8(const UIDNA *idna, 00383 const char *name, int32_t length, 00384 char *dest, int32_t capacity, 00385 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00386 00404 U_STABLE int32_t U_EXPORT2 00405 uidna_nameToUnicodeUTF8(const UIDNA *idna, 00406 const char *name, int32_t length, 00407 char *dest, int32_t capacity, 00408 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00409 00410 /* 00411 * IDNA error bit set values. 00412 * When a domain name or label fails a processing step or does not meet the 00413 * validity criteria, then one or more of these error bits are set. 00414 */ 00415 enum { 00420 UIDNA_ERROR_EMPTY_LABEL=1, 00427 UIDNA_ERROR_LABEL_TOO_LONG=2, 00434 UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4, 00439 UIDNA_ERROR_LEADING_HYPHEN=8, 00444 UIDNA_ERROR_TRAILING_HYPHEN=0x10, 00449 UIDNA_ERROR_HYPHEN_3_4=0x20, 00454 UIDNA_ERROR_LEADING_COMBINING_MARK=0x40, 00459 UIDNA_ERROR_DISALLOWED=0x80, 00465 UIDNA_ERROR_PUNYCODE=0x100, 00471 UIDNA_ERROR_LABEL_HAS_DOT=0x200, 00480 UIDNA_ERROR_INVALID_ACE_LABEL=0x400, 00485 UIDNA_ERROR_BIDI=0x800, 00490 UIDNA_ERROR_CONTEXTJ=0x1000, 00497 UIDNA_ERROR_CONTEXTO_PUNCTUATION=0x2000, 00503 UIDNA_ERROR_CONTEXTO_DIGITS=0x4000 00504 }; 00505 00506 /* IDNA2003 API ------------------------------------------------------------- */ 00507 00567 U_STABLE int32_t U_EXPORT2 00568 uidna_toASCII(const UChar* src, int32_t srcLength, 00569 UChar* dest, int32_t destCapacity, 00570 int32_t options, 00571 UParseError* parseError, 00572 UErrorCode* status); 00573 00574 00615 U_STABLE int32_t U_EXPORT2 00616 uidna_toUnicode(const UChar* src, int32_t srcLength, 00617 UChar* dest, int32_t destCapacity, 00618 int32_t options, 00619 UParseError* parseError, 00620 UErrorCode* status); 00621 00622 00666 U_STABLE int32_t U_EXPORT2 00667 uidna_IDNToASCII( const UChar* src, int32_t srcLength, 00668 UChar* dest, int32_t destCapacity, 00669 int32_t options, 00670 UParseError* parseError, 00671 UErrorCode* status); 00672 00713 U_STABLE int32_t U_EXPORT2 00714 uidna_IDNToUnicode( const UChar* src, int32_t srcLength, 00715 UChar* dest, int32_t destCapacity, 00716 int32_t options, 00717 UParseError* parseError, 00718 UErrorCode* status); 00719 00754 U_STABLE int32_t U_EXPORT2 00755 uidna_compare( const UChar *s1, int32_t length1, 00756 const UChar *s2, int32_t length2, 00757 int32_t options, 00758 UErrorCode* status); 00759 00760 #endif /* #if !UCONFIG_NO_IDNA */ 00761 00762 #endif
1.7.6.1