00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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 "unicode/localpointer.h"
00027 #include "unicode/parseerr.h"
00028
00043
00044
00045
00046 enum {
00052 UIDNA_DEFAULT=0,
00053 #ifndef U_HIDE_DEPRECATED_API
00054
00061 UIDNA_ALLOW_UNASSIGNED=1,
00062 #endif
00063
00070 UIDNA_USE_STD3_RULES=2,
00078 UIDNA_CHECK_BIDI=4,
00086 UIDNA_CHECK_CONTEXTJ=8,
00095 UIDNA_NONTRANSITIONAL_TO_ASCII=0x10,
00104 UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20,
00114 UIDNA_CHECK_CONTEXTO=0x40
00115 };
00116
00121 struct UIDNA;
00122 typedef struct UIDNA UIDNA;
00141 U_STABLE UIDNA * U_EXPORT2
00142 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode);
00143
00149 U_STABLE void U_EXPORT2
00150 uidna_close(UIDNA *idna);
00151
00152 #if U_SHOW_CPLUSPLUS_API
00153
00154 U_NAMESPACE_BEGIN
00155
00165 U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close);
00166
00167 U_NAMESPACE_END
00168
00169 #endif
00170
00181 typedef struct UIDNAInfo {
00183 int16_t size;
00189 UBool isTransitionalDifferent;
00190 UBool reservedB3;
00196 uint32_t errors;
00197 int32_t reservedI2;
00198 int32_t reservedI3;
00199 } UIDNAInfo;
00200
00205 #define UIDNA_INFO_INITIALIZER { \
00206 (int16_t)sizeof(UIDNAInfo), \
00207 FALSE, FALSE, \
00208 0, 0, 0 }
00209
00233 U_STABLE int32_t U_EXPORT2
00234 uidna_labelToASCII(const UIDNA *idna,
00235 const UChar *label, int32_t length,
00236 UChar *dest, int32_t capacity,
00237 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00238
00260 U_STABLE int32_t U_EXPORT2
00261 uidna_labelToUnicode(const UIDNA *idna,
00262 const UChar *label, int32_t length,
00263 UChar *dest, int32_t capacity,
00264 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00265
00289 U_STABLE int32_t U_EXPORT2
00290 uidna_nameToASCII(const UIDNA *idna,
00291 const UChar *name, int32_t length,
00292 UChar *dest, int32_t capacity,
00293 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00294
00316 U_STABLE int32_t U_EXPORT2
00317 uidna_nameToUnicode(const UIDNA *idna,
00318 const UChar *name, int32_t length,
00319 UChar *dest, int32_t capacity,
00320 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00321
00322
00323
00341 U_STABLE int32_t U_EXPORT2
00342 uidna_labelToASCII_UTF8(const UIDNA *idna,
00343 const char *label, int32_t length,
00344 char *dest, int32_t capacity,
00345 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00346
00364 U_STABLE int32_t U_EXPORT2
00365 uidna_labelToUnicodeUTF8(const UIDNA *idna,
00366 const char *label, int32_t length,
00367 char *dest, int32_t capacity,
00368 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00369
00387 U_STABLE int32_t U_EXPORT2
00388 uidna_nameToASCII_UTF8(const UIDNA *idna,
00389 const char *name, int32_t length,
00390 char *dest, int32_t capacity,
00391 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00392
00410 U_STABLE int32_t U_EXPORT2
00411 uidna_nameToUnicodeUTF8(const UIDNA *idna,
00412 const char *name, int32_t length,
00413 char *dest, int32_t capacity,
00414 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
00415
00416
00417
00418
00419
00420
00421 enum {
00426 UIDNA_ERROR_EMPTY_LABEL=1,
00433 UIDNA_ERROR_LABEL_TOO_LONG=2,
00440 UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4,
00445 UIDNA_ERROR_LEADING_HYPHEN=8,
00450 UIDNA_ERROR_TRAILING_HYPHEN=0x10,
00455 UIDNA_ERROR_HYPHEN_3_4=0x20,
00460 UIDNA_ERROR_LEADING_COMBINING_MARK=0x40,
00465 UIDNA_ERROR_DISALLOWED=0x80,
00471 UIDNA_ERROR_PUNYCODE=0x100,
00477 UIDNA_ERROR_LABEL_HAS_DOT=0x200,
00486 UIDNA_ERROR_INVALID_ACE_LABEL=0x400,
00491 UIDNA_ERROR_BIDI=0x800,
00496 UIDNA_ERROR_CONTEXTJ=0x1000,
00503 UIDNA_ERROR_CONTEXTO_PUNCTUATION=0x2000,
00509 UIDNA_ERROR_CONTEXTO_DIGITS=0x4000
00510 };
00511
00512 #ifndef U_HIDE_DEPRECATED_API
00513
00514
00515
00575 U_DEPRECATED int32_t U_EXPORT2
00576 uidna_toASCII(const UChar* src, int32_t srcLength,
00577 UChar* dest, int32_t destCapacity,
00578 int32_t options,
00579 UParseError* parseError,
00580 UErrorCode* status);
00581
00582
00623 U_DEPRECATED int32_t U_EXPORT2
00624 uidna_toUnicode(const UChar* src, int32_t srcLength,
00625 UChar* dest, int32_t destCapacity,
00626 int32_t options,
00627 UParseError* parseError,
00628 UErrorCode* status);
00629
00630
00674 U_DEPRECATED int32_t U_EXPORT2
00675 uidna_IDNToASCII( const UChar* src, int32_t srcLength,
00676 UChar* dest, int32_t destCapacity,
00677 int32_t options,
00678 UParseError* parseError,
00679 UErrorCode* status);
00680
00721 U_DEPRECATED int32_t U_EXPORT2
00722 uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
00723 UChar* dest, int32_t destCapacity,
00724 int32_t options,
00725 UParseError* parseError,
00726 UErrorCode* status);
00727
00762 U_DEPRECATED int32_t U_EXPORT2
00763 uidna_compare( const UChar *s1, int32_t length1,
00764 const UChar *s2, int32_t length2,
00765 int32_t options,
00766 UErrorCode* status);
00767
00768 #endif
00769
00770 #endif
00771
00772 #endif