00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00041
00042
00043
00044 enum {
00050 UIDNA_DEFAULT=0,
00051 #ifndef U_HIDE_DEPRECATED_API
00052
00059 UIDNA_ALLOW_UNASSIGNED=1,
00060 #endif
00061
00068 UIDNA_USE_STD3_RULES=2,
00076 UIDNA_CHECK_BIDI=4,
00084 UIDNA_CHECK_CONTEXTJ=8,
00093 UIDNA_NONTRANSITIONAL_TO_ASCII=0x10,
00102 UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20,
00112 UIDNA_CHECK_CONTEXTO=0x40
00113 };
00114
00119 struct UIDNA;
00120 typedef struct UIDNA UIDNA;
00139 U_STABLE UIDNA * U_EXPORT2
00140 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode);
00141
00147 U_STABLE void U_EXPORT2
00148 uidna_close(UIDNA *idna);
00149
00150 #if U_SHOW_CPLUSPLUS_API
00151
00152 U_NAMESPACE_BEGIN
00153
00163 U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close);
00164
00165 U_NAMESPACE_END
00166
00167 #endif
00168
00179 typedef struct UIDNAInfo {
00181 int16_t size;
00187 UBool isTransitionalDifferent;
00188 UBool reservedB3;
00194 uint32_t errors;
00195 int32_t reservedI2;
00196 int32_t reservedI3;
00197 } UIDNAInfo;
00198
00203 #define UIDNA_INFO_INITIALIZER { \
00204 (int16_t)sizeof(UIDNAInfo), \
00205 FALSE, FALSE, \
00206 0, 0, 0 }
00207
00231 U_STABLE int32_t U_EXPORT2
00232 uidna_labelToASCII(const UIDNA *idna,
00233 const UChar *label, int32_t length,
00234 UChar *dest, int32_t capacity,
00235 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00236
00258 U_STABLE int32_t U_EXPORT2
00259 uidna_labelToUnicode(const UIDNA *idna,
00260 const UChar *label, int32_t length,
00261 UChar *dest, int32_t capacity,
00262 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00263
00287 U_STABLE int32_t U_EXPORT2
00288 uidna_nameToASCII(const UIDNA *idna,
00289 const UChar *name, int32_t length,
00290 UChar *dest, int32_t capacity,
00291 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00292
00314 U_STABLE int32_t U_EXPORT2
00315 uidna_nameToUnicode(const UIDNA *idna,
00316 const UChar *name, int32_t length,
00317 UChar *dest, int32_t capacity,
00318 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00319
00320
00321
00339 U_STABLE int32_t U_EXPORT2
00340 uidna_labelToASCII_UTF8(const UIDNA *idna,
00341 const char *label, int32_t length,
00342 char *dest, int32_t capacity,
00343 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00344
00362 U_STABLE int32_t U_EXPORT2
00363 uidna_labelToUnicodeUTF8(const UIDNA *idna,
00364 const char *label, int32_t length,
00365 char *dest, int32_t capacity,
00366 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00367
00385 U_STABLE int32_t U_EXPORT2
00386 uidna_nameToASCII_UTF8(const UIDNA *idna,
00387 const char *name, int32_t length,
00388 char *dest, int32_t capacity,
00389 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00390
00408 U_STABLE int32_t U_EXPORT2
00409 uidna_nameToUnicodeUTF8(const UIDNA *idna,
00410 const char *name, int32_t length,
00411 char *dest, int32_t capacity,
00412 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00413
00414
00415
00416
00417
00418
00419 enum {
00424 UIDNA_ERROR_EMPTY_LABEL=1,
00431 UIDNA_ERROR_LABEL_TOO_LONG=2,
00438 UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4,
00443 UIDNA_ERROR_LEADING_HYPHEN=8,
00448 UIDNA_ERROR_TRAILING_HYPHEN=0x10,
00453 UIDNA_ERROR_HYPHEN_3_4=0x20,
00458 UIDNA_ERROR_LEADING_COMBINING_MARK=0x40,
00463 UIDNA_ERROR_DISALLOWED=0x80,
00469 UIDNA_ERROR_PUNYCODE=0x100,
00475 UIDNA_ERROR_LABEL_HAS_DOT=0x200,
00484 UIDNA_ERROR_INVALID_ACE_LABEL=0x400,
00489 UIDNA_ERROR_BIDI=0x800,
00494 UIDNA_ERROR_CONTEXTJ=0x1000,
00501 UIDNA_ERROR_CONTEXTO_PUNCTUATION=0x2000,
00507 UIDNA_ERROR_CONTEXTO_DIGITS=0x4000
00508 };
00509
00510 #ifndef U_HIDE_DEPRECATED_API
00511
00512
00513
00573 U_DEPRECATED int32_t U_EXPORT2
00574 uidna_toASCII(const UChar* src, int32_t srcLength,
00575 UChar* dest, int32_t destCapacity,
00576 int32_t options,
00577 UParseError* parseError,
00578 UErrorCode* status);
00579
00580
00621 U_DEPRECATED int32_t U_EXPORT2
00622 uidna_toUnicode(const UChar* src, int32_t srcLength,
00623 UChar* dest, int32_t destCapacity,
00624 int32_t options,
00625 UParseError* parseError,
00626 UErrorCode* status);
00627
00628
00672 U_DEPRECATED int32_t U_EXPORT2
00673 uidna_IDNToASCII( const UChar* src, int32_t srcLength,
00674 UChar* dest, int32_t destCapacity,
00675 int32_t options,
00676 UParseError* parseError,
00677 UErrorCode* status);
00678
00719 U_DEPRECATED int32_t U_EXPORT2
00720 uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
00721 UChar* dest, int32_t destCapacity,
00722 int32_t options,
00723 UParseError* parseError,
00724 UErrorCode* status);
00725
00760 U_DEPRECATED int32_t U_EXPORT2
00761 uidna_compare( const UChar *s1, int32_t length1,
00762 const UChar *s2, int32_t length2,
00763 int32_t options,
00764 UErrorCode* status);
00765
00766 #endif
00767
00768 #endif
00769
00770 #endif