|
ICU 73.2
73.2
|
00001 // © 2016 and later: Unicode, Inc. and others. 00002 // License & terms of use: http://www.unicode.org/copyright.html 00003 /* 00004 ******************************************************************************* 00005 * 00006 * Copyright (C) 2003-2014, International Business Machines 00007 * Corporation and others. All Rights Reserved. 00008 * 00009 ******************************************************************************* 00010 * file name: uidna.h 00011 * encoding: UTF-8 00012 * tab size: 8 (not used) 00013 * indentation:4 00014 * 00015 * created on: 2003feb1 00016 * created by: Ram Viswanadha 00017 */ 00018 00019 #ifndef __UIDNA_H__ 00020 #define __UIDNA_H__ 00021 00022 #include "unicode/utypes.h" 00023 00024 #if !UCONFIG_NO_IDNA 00025 00026 #include <stdbool.h> 00027 #include "unicode/parseerr.h" 00028 00029 #if U_SHOW_CPLUSPLUS_API 00030 #include "unicode/localpointer.h" 00031 #endif // U_SHOW_CPLUSPLUS_API 00032 00047 /* 00048 * IDNA option bit set values. 00049 */ 00050 enum { 00056 UIDNA_DEFAULT=0, 00057 #ifndef U_HIDE_DEPRECATED_API 00058 00065 UIDNA_ALLOW_UNASSIGNED=1, 00066 #endif /* U_HIDE_DEPRECATED_API */ 00067 00074 UIDNA_USE_STD3_RULES=2, 00082 UIDNA_CHECK_BIDI=4, 00090 UIDNA_CHECK_CONTEXTJ=8, 00099 UIDNA_NONTRANSITIONAL_TO_ASCII=0x10, 00108 UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20, 00118 UIDNA_CHECK_CONTEXTO=0x40 00119 }; 00120 00125 struct UIDNA; 00126 typedef struct UIDNA UIDNA; 00145 U_CAPI UIDNA * U_EXPORT2 00146 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); 00147 00153 U_CAPI void U_EXPORT2 00154 uidna_close(UIDNA *idna); 00155 00156 #if U_SHOW_CPLUSPLUS_API 00157 00158 U_NAMESPACE_BEGIN 00159 00169 U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close); 00170 00171 U_NAMESPACE_END 00172 00173 #endif 00174 00185 typedef struct UIDNAInfo { 00187 int16_t size; 00193 UBool isTransitionalDifferent; 00194 UBool reservedB3; 00200 uint32_t errors; 00201 int32_t reservedI2; 00202 int32_t reservedI3; 00203 } UIDNAInfo; 00204 00209 #define UIDNA_INFO_INITIALIZER { \ 00210 (int16_t)sizeof(UIDNAInfo), \ 00211 false, false, \ 00212 0, 0, 0 } 00213 00237 U_CAPI int32_t U_EXPORT2 00238 uidna_labelToASCII(const UIDNA *idna, 00239 const UChar *label, int32_t length, 00240 UChar *dest, int32_t capacity, 00241 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00242 00264 U_CAPI int32_t U_EXPORT2 00265 uidna_labelToUnicode(const UIDNA *idna, 00266 const UChar *label, int32_t length, 00267 UChar *dest, int32_t capacity, 00268 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00269 00293 U_CAPI int32_t U_EXPORT2 00294 uidna_nameToASCII(const UIDNA *idna, 00295 const UChar *name, int32_t length, 00296 UChar *dest, int32_t capacity, 00297 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00298 00320 U_CAPI int32_t U_EXPORT2 00321 uidna_nameToUnicode(const UIDNA *idna, 00322 const UChar *name, int32_t length, 00323 UChar *dest, int32_t capacity, 00324 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00325 00326 /* UTF-8 versions of the processing methods --------------------------------- */ 00327 00345 U_CAPI int32_t U_EXPORT2 00346 uidna_labelToASCII_UTF8(const UIDNA *idna, 00347 const char *label, int32_t length, 00348 char *dest, int32_t capacity, 00349 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00350 00368 U_CAPI int32_t U_EXPORT2 00369 uidna_labelToUnicodeUTF8(const UIDNA *idna, 00370 const char *label, int32_t length, 00371 char *dest, int32_t capacity, 00372 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00373 00391 U_CAPI int32_t U_EXPORT2 00392 uidna_nameToASCII_UTF8(const UIDNA *idna, 00393 const char *name, int32_t length, 00394 char *dest, int32_t capacity, 00395 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00396 00414 U_CAPI int32_t U_EXPORT2 00415 uidna_nameToUnicodeUTF8(const UIDNA *idna, 00416 const char *name, int32_t length, 00417 char *dest, int32_t capacity, 00418 UIDNAInfo *pInfo, UErrorCode *pErrorCode); 00419 00420 /* 00421 * IDNA error bit set values. 00422 * When a domain name or label fails a processing step or does not meet the 00423 * validity criteria, then one or more of these error bits are set. 00424 */ 00425 enum { 00430 UIDNA_ERROR_EMPTY_LABEL=1, 00437 UIDNA_ERROR_LABEL_TOO_LONG=2, 00444 UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4, 00449 UIDNA_ERROR_LEADING_HYPHEN=8, 00454 UIDNA_ERROR_TRAILING_HYPHEN=0x10, 00459 UIDNA_ERROR_HYPHEN_3_4=0x20, 00464 UIDNA_ERROR_LEADING_COMBINING_MARK=0x40, 00469 UIDNA_ERROR_DISALLOWED=0x80, 00475 UIDNA_ERROR_PUNYCODE=0x100, 00481 UIDNA_ERROR_LABEL_HAS_DOT=0x200, 00490 UIDNA_ERROR_INVALID_ACE_LABEL=0x400, 00495 UIDNA_ERROR_BIDI=0x800, 00500 UIDNA_ERROR_CONTEXTJ=0x1000, 00507 UIDNA_ERROR_CONTEXTO_PUNCTUATION=0x2000, 00513 UIDNA_ERROR_CONTEXTO_DIGITS=0x4000 00514 }; 00515 00516 #ifndef U_HIDE_DEPRECATED_API 00517 00518 /* IDNA2003 API ------------------------------------------------------------- */ 00519 00579 U_DEPRECATED int32_t U_EXPORT2 00580 uidna_toASCII(const UChar* src, int32_t srcLength, 00581 UChar* dest, int32_t destCapacity, 00582 int32_t options, 00583 UParseError* parseError, 00584 UErrorCode* status); 00585 00586 00627 U_DEPRECATED int32_t U_EXPORT2 00628 uidna_toUnicode(const UChar* src, int32_t srcLength, 00629 UChar* dest, int32_t destCapacity, 00630 int32_t options, 00631 UParseError* parseError, 00632 UErrorCode* status); 00633 00634 00678 U_DEPRECATED int32_t U_EXPORT2 00679 uidna_IDNToASCII( const UChar* src, int32_t srcLength, 00680 UChar* dest, int32_t destCapacity, 00681 int32_t options, 00682 UParseError* parseError, 00683 UErrorCode* status); 00684 00725 U_DEPRECATED int32_t U_EXPORT2 00726 uidna_IDNToUnicode( const UChar* src, int32_t srcLength, 00727 UChar* dest, int32_t destCapacity, 00728 int32_t options, 00729 UParseError* parseError, 00730 UErrorCode* status); 00731 00766 U_DEPRECATED int32_t U_EXPORT2 00767 uidna_compare( const UChar *s1, int32_t length1, 00768 const UChar *s2, int32_t length2, 00769 int32_t options, 00770 UErrorCode* status); 00771 00772 #endif /* U_HIDE_DEPRECATED_API */ 00773 00774 #endif /* #if !UCONFIG_NO_IDNA */ 00775 00776 #endif
1.7.6.1