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
00039
00040
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
00111 };
00112
00117 struct UIDNA;
00118 typedef struct UIDNA UIDNA;
00137 U_STABLE UIDNA * U_EXPORT2
00138 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode);
00139
00145 U_STABLE 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 typedef 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 } UIDNAInfo;
00196
00201 #define UIDNA_INFO_INITIALIZER { \
00202 (int16_t)sizeof(UIDNAInfo), \
00203 FALSE, FALSE, \
00204 0, 0, 0 }
00205
00229 U_STABLE int32_t U_EXPORT2
00230 uidna_labelToASCII(const UIDNA *idna,
00231 const UChar *label, int32_t length,
00232 UChar *dest, int32_t capacity,
00233 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00234
00256 U_STABLE int32_t U_EXPORT2
00257 uidna_labelToUnicode(const UIDNA *idna,
00258 const UChar *label, int32_t length,
00259 UChar *dest, int32_t capacity,
00260 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00261
00285 U_STABLE int32_t U_EXPORT2
00286 uidna_nameToASCII(const UIDNA *idna,
00287 const UChar *name, int32_t length,
00288 UChar *dest, int32_t capacity,
00289 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00290
00312 U_STABLE int32_t U_EXPORT2
00313 uidna_nameToUnicode(const UIDNA *idna,
00314 const UChar *name, int32_t length,
00315 UChar *dest, int32_t capacity,
00316 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00317
00318
00319
00337 U_STABLE int32_t U_EXPORT2
00338 uidna_labelToASCII_UTF8(const UIDNA *idna,
00339 const char *label, int32_t length,
00340 char *dest, int32_t capacity,
00341 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00342
00360 U_STABLE int32_t U_EXPORT2
00361 uidna_labelToUnicodeUTF8(const UIDNA *idna,
00362 const char *label, int32_t length,
00363 char *dest, int32_t capacity,
00364 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00365
00383 U_STABLE int32_t U_EXPORT2
00384 uidna_nameToASCII_UTF8(const UIDNA *idna,
00385 const char *name, int32_t length,
00386 char *dest, int32_t capacity,
00387 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00388
00406 U_STABLE int32_t U_EXPORT2
00407 uidna_nameToUnicodeUTF8(const UIDNA *idna,
00408 const char *name, int32_t length,
00409 char *dest, int32_t capacity,
00410 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00411
00412
00413
00414
00415
00416
00417 enum {
00422 UIDNA_ERROR_EMPTY_LABEL=1,
00429 UIDNA_ERROR_LABEL_TOO_LONG=2,
00436 UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4,
00441 UIDNA_ERROR_LEADING_HYPHEN=8,
00446 UIDNA_ERROR_TRAILING_HYPHEN=0x10,
00451 UIDNA_ERROR_HYPHEN_3_4=0x20,
00456 UIDNA_ERROR_LEADING_COMBINING_MARK=0x40,
00461 UIDNA_ERROR_DISALLOWED=0x80,
00467 UIDNA_ERROR_PUNYCODE=0x100,
00473 UIDNA_ERROR_LABEL_HAS_DOT=0x200,
00482 UIDNA_ERROR_INVALID_ACE_LABEL=0x400,
00487 UIDNA_ERROR_BIDI=0x800,
00492 UIDNA_ERROR_CONTEXTJ=0x1000,
00493 #ifndef U_HIDE_DRAFT_API
00494
00500 UIDNA_ERROR_CONTEXTO_PUNCTUATION=0x2000,
00506 UIDNA_ERROR_CONTEXTO_DIGITS=0x4000
00507 #endif
00508 };
00509
00510
00511
00571 U_STABLE int32_t U_EXPORT2
00572 uidna_toASCII(const UChar* src, int32_t srcLength,
00573 UChar* dest, int32_t destCapacity,
00574 int32_t options,
00575 UParseError* parseError,
00576 UErrorCode* status);
00577
00578
00619 U_STABLE int32_t U_EXPORT2
00620 uidna_toUnicode(const UChar* src, int32_t srcLength,
00621 UChar* dest, int32_t destCapacity,
00622 int32_t options,
00623 UParseError* parseError,
00624 UErrorCode* status);
00625
00626
00670 U_STABLE int32_t U_EXPORT2
00671 uidna_IDNToASCII( const UChar* src, int32_t srcLength,
00672 UChar* dest, int32_t destCapacity,
00673 int32_t options,
00674 UParseError* parseError,
00675 UErrorCode* status);
00676
00717 U_STABLE int32_t U_EXPORT2
00718 uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
00719 UChar* dest, int32_t destCapacity,
00720 int32_t options,
00721 UParseError* parseError,
00722 UErrorCode* status);
00723
00758 U_STABLE int32_t U_EXPORT2
00759 uidna_compare( const UChar *s1, int32_t length1,
00760 const UChar *s2, int32_t length2,
00761 int32_t options,
00762 UErrorCode* status);
00763
00764 #endif
00765
00766 #endif