17777dab0Sopenharmony_ci// © 2016 and later: Unicode, Inc. and others. 27777dab0Sopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html 37777dab0Sopenharmony_ci/* 47777dab0Sopenharmony_ci ******************************************************************************* 57777dab0Sopenharmony_ci * 67777dab0Sopenharmony_ci * Copyright (C) 2003-2014, International Business Machines 77777dab0Sopenharmony_ci * Corporation and others. All Rights Reserved. 87777dab0Sopenharmony_ci * 97777dab0Sopenharmony_ci ******************************************************************************* 107777dab0Sopenharmony_ci * file name: uidna.h 117777dab0Sopenharmony_ci * encoding: UTF-8 127777dab0Sopenharmony_ci * tab size: 8 (not used) 137777dab0Sopenharmony_ci * indentation:4 147777dab0Sopenharmony_ci * 157777dab0Sopenharmony_ci * created on: 2003feb1 167777dab0Sopenharmony_ci * created by: Ram Viswanadha 177777dab0Sopenharmony_ci */ 187777dab0Sopenharmony_ci 197777dab0Sopenharmony_ci#ifndef __UIDNA_H__ 207777dab0Sopenharmony_ci#define __UIDNA_H__ 217777dab0Sopenharmony_ci 227777dab0Sopenharmony_ci#include "unicode/utypes.h" 237777dab0Sopenharmony_ci 247777dab0Sopenharmony_ci#if !UCONFIG_NO_IDNA 257777dab0Sopenharmony_ci 267777dab0Sopenharmony_ci#include <stdbool.h> 277777dab0Sopenharmony_ci#include "unicode/parseerr.h" 287777dab0Sopenharmony_ci 297777dab0Sopenharmony_ci/** 307777dab0Sopenharmony_ci * \file 317777dab0Sopenharmony_ci * \brief C API: Internationalizing Domain Names in Applications (IDNA) 327777dab0Sopenharmony_ci * 337777dab0Sopenharmony_ci * IDNA2008 is implemented according to UTS #46, see the IDNA C++ class in idna.h. 347777dab0Sopenharmony_ci * 357777dab0Sopenharmony_ci * The C API functions which do take a UIDNA * service object pointer 367777dab0Sopenharmony_ci * implement UTS #46 and IDNA2008. 377777dab0Sopenharmony_ci * 387777dab0Sopenharmony_ci * IDNA2003 is obsolete. 397777dab0Sopenharmony_ci * The C API functions which do not take a service object pointer 407777dab0Sopenharmony_ci * implement IDNA2003. They are all deprecated. 417777dab0Sopenharmony_ci */ 427777dab0Sopenharmony_ci 437777dab0Sopenharmony_ci/* 447777dab0Sopenharmony_ci * IDNA option bit set values. 457777dab0Sopenharmony_ci */ 467777dab0Sopenharmony_cienum { 477777dab0Sopenharmony_ci /** 487777dab0Sopenharmony_ci * Default options value: None of the other options are set. 497777dab0Sopenharmony_ci * For use in static worker and factory methods. 507777dab0Sopenharmony_ci * @stable ICU 2.6 517777dab0Sopenharmony_ci */ 527777dab0Sopenharmony_ci UIDNA_DEFAULT=0, 537777dab0Sopenharmony_ci /** 547777dab0Sopenharmony_ci * Option to check whether the input conforms to the STD3 ASCII rules, 557777dab0Sopenharmony_ci * for example the restriction of labels to LDH characters 567777dab0Sopenharmony_ci * (ASCII Letters, Digits and Hyphen-Minus). 577777dab0Sopenharmony_ci * For use in static worker and factory methods. 587777dab0Sopenharmony_ci * @stable ICU 2.6 597777dab0Sopenharmony_ci */ 607777dab0Sopenharmony_ci UIDNA_USE_STD3_RULES=2, 617777dab0Sopenharmony_ci /** 627777dab0Sopenharmony_ci * IDNA option to check for whether the input conforms to the BiDi rules. 637777dab0Sopenharmony_ci * For use in static worker and factory methods. 647777dab0Sopenharmony_ci * <p>This option is ignored by the IDNA2003 implementation. 657777dab0Sopenharmony_ci * (IDNA2003 always performs a BiDi check.) 667777dab0Sopenharmony_ci * @stable ICU 4.6 677777dab0Sopenharmony_ci */ 687777dab0Sopenharmony_ci UIDNA_CHECK_BIDI=4, 697777dab0Sopenharmony_ci /** 707777dab0Sopenharmony_ci * IDNA option to check for whether the input conforms to the CONTEXTJ rules. 717777dab0Sopenharmony_ci * For use in static worker and factory methods. 727777dab0Sopenharmony_ci * <p>This option is ignored by the IDNA2003 implementation. 737777dab0Sopenharmony_ci * (The CONTEXTJ check is new in IDNA2008.) 747777dab0Sopenharmony_ci * @stable ICU 4.6 757777dab0Sopenharmony_ci */ 767777dab0Sopenharmony_ci UIDNA_CHECK_CONTEXTJ=8, 777777dab0Sopenharmony_ci /** 787777dab0Sopenharmony_ci * IDNA option for nontransitional processing in ToASCII(). 797777dab0Sopenharmony_ci * For use in static worker and factory methods. 807777dab0Sopenharmony_ci * <p>By default, ToASCII() uses transitional processing. 817777dab0Sopenharmony_ci * <p>This option is ignored by the IDNA2003 implementation. 827777dab0Sopenharmony_ci * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.) 837777dab0Sopenharmony_ci * @stable ICU 4.6 847777dab0Sopenharmony_ci */ 857777dab0Sopenharmony_ci UIDNA_NONTRANSITIONAL_TO_ASCII=0x10, 867777dab0Sopenharmony_ci /** 877777dab0Sopenharmony_ci * IDNA option for nontransitional processing in ToUnicode(). 887777dab0Sopenharmony_ci * For use in static worker and factory methods. 897777dab0Sopenharmony_ci * <p>By default, ToUnicode() uses transitional processing. 907777dab0Sopenharmony_ci * <p>This option is ignored by the IDNA2003 implementation. 917777dab0Sopenharmony_ci * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.) 927777dab0Sopenharmony_ci * @stable ICU 4.6 937777dab0Sopenharmony_ci */ 947777dab0Sopenharmony_ci UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20, 957777dab0Sopenharmony_ci /** 967777dab0Sopenharmony_ci * IDNA option to check for whether the input conforms to the CONTEXTO rules. 977777dab0Sopenharmony_ci * For use in static worker and factory methods. 987777dab0Sopenharmony_ci * <p>This option is ignored by the IDNA2003 implementation. 997777dab0Sopenharmony_ci * (The CONTEXTO check is new in IDNA2008.) 1007777dab0Sopenharmony_ci * <p>This is for use by registries for IDNA2008 conformance. 1017777dab0Sopenharmony_ci * UTS #46 does not require the CONTEXTO check. 1027777dab0Sopenharmony_ci * @stable ICU 49 1037777dab0Sopenharmony_ci */ 1047777dab0Sopenharmony_ci UIDNA_CHECK_CONTEXTO=0x40 1057777dab0Sopenharmony_ci}; 1067777dab0Sopenharmony_ci 1077777dab0Sopenharmony_ci/** 1087777dab0Sopenharmony_ci * Opaque C service object type for the new IDNA API. 1097777dab0Sopenharmony_ci * @stable ICU 4.6 1107777dab0Sopenharmony_ci */ 1117777dab0Sopenharmony_cistruct UIDNA; 1127777dab0Sopenharmony_citypedef struct UIDNA UIDNA; /**< C typedef for struct UIDNA. @stable ICU 4.6 */ 1137777dab0Sopenharmony_ci 1147777dab0Sopenharmony_ci/** 1157777dab0Sopenharmony_ci * Returns a UIDNA instance which implements UTS #46. 1167777dab0Sopenharmony_ci * Returns an unmodifiable instance, owned by the caller. 1177777dab0Sopenharmony_ci * Cache it for multiple operations, and uidna_close() it when done. 1187777dab0Sopenharmony_ci * The instance is thread-safe, that is, it can be used concurrently. 1197777dab0Sopenharmony_ci * 1207777dab0Sopenharmony_ci * For details about the UTS #46 implementation see the IDNA C++ class in idna.h. 1217777dab0Sopenharmony_ci * 1227777dab0Sopenharmony_ci * @param options Bit set to modify the processing and error checking. 1237777dab0Sopenharmony_ci * See option bit set values in uidna.h. 1247777dab0Sopenharmony_ci * @param pErrorCode Standard ICU error code. Its input value must 1257777dab0Sopenharmony_ci * pass the U_SUCCESS() test, or else the function returns 1267777dab0Sopenharmony_ci * immediately. Check for U_FAILURE() on output or use with 1277777dab0Sopenharmony_ci * function chaining. (See User Guide for details.) 1287777dab0Sopenharmony_ci * @return the UTS #46 UIDNA instance, if successful 1297777dab0Sopenharmony_ci * @stable ICU 4.6 1307777dab0Sopenharmony_ci */ 1317777dab0Sopenharmony_ciU_CAPI UIDNA * U_EXPORT2 1327777dab0Sopenharmony_ciuidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); 1337777dab0Sopenharmony_ci 1347777dab0Sopenharmony_ci/** 1357777dab0Sopenharmony_ci * Closes a UIDNA instance. 1367777dab0Sopenharmony_ci * @param idna UIDNA instance to be closed 1377777dab0Sopenharmony_ci * @stable ICU 4.6 1387777dab0Sopenharmony_ci */ 1397777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 1407777dab0Sopenharmony_ciuidna_close(UIDNA *idna); 1417777dab0Sopenharmony_ci 1427777dab0Sopenharmony_ci/** 1437777dab0Sopenharmony_ci * Output container for IDNA processing errors. 1447777dab0Sopenharmony_ci * Initialize with UIDNA_INFO_INITIALIZER: 1457777dab0Sopenharmony_ci * \code 1467777dab0Sopenharmony_ci * UIDNAInfo info = UIDNA_INFO_INITIALIZER; 1477777dab0Sopenharmony_ci * int32_t length = uidna_nameToASCII(..., &info, &errorCode); 1487777dab0Sopenharmony_ci * if(U_SUCCESS(errorCode) && info.errors!=0) { ... } 1497777dab0Sopenharmony_ci * \endcode 1507777dab0Sopenharmony_ci * @stable ICU 4.6 1517777dab0Sopenharmony_ci */ 1527777dab0Sopenharmony_citypedef struct UIDNAInfo { 1537777dab0Sopenharmony_ci /** sizeof(UIDNAInfo) @stable ICU 4.6 */ 1547777dab0Sopenharmony_ci int16_t size; 1557777dab0Sopenharmony_ci /** 1567777dab0Sopenharmony_ci * Set to true if transitional and nontransitional processing produce different results. 1577777dab0Sopenharmony_ci * For details see C++ IDNAInfo::isTransitionalDifferent(). 1587777dab0Sopenharmony_ci * @stable ICU 4.6 1597777dab0Sopenharmony_ci */ 1607777dab0Sopenharmony_ci UBool isTransitionalDifferent; 1617777dab0Sopenharmony_ci UBool reservedB3; /**< Reserved field, do not use. @internal */ 1627777dab0Sopenharmony_ci /** 1637777dab0Sopenharmony_ci * Bit set indicating IDNA processing errors. 0 if no errors. 1647777dab0Sopenharmony_ci * See UIDNA_ERROR_... constants. 1657777dab0Sopenharmony_ci * @stable ICU 4.6 1667777dab0Sopenharmony_ci */ 1677777dab0Sopenharmony_ci uint32_t errors; 1687777dab0Sopenharmony_ci int32_t reservedI2; /**< Reserved field, do not use. @internal */ 1697777dab0Sopenharmony_ci int32_t reservedI3; /**< Reserved field, do not use. @internal */ 1707777dab0Sopenharmony_ci} UIDNAInfo; 1717777dab0Sopenharmony_ci 1727777dab0Sopenharmony_ci/** 1737777dab0Sopenharmony_ci * Static initializer for a UIDNAInfo struct. 1747777dab0Sopenharmony_ci * @stable ICU 4.6 1757777dab0Sopenharmony_ci */ 1767777dab0Sopenharmony_ci#define UIDNA_INFO_INITIALIZER { \ 1777777dab0Sopenharmony_ci (int16_t)sizeof(UIDNAInfo), \ 1787777dab0Sopenharmony_ci false, false, \ 1797777dab0Sopenharmony_ci 0, 0, 0 } 1807777dab0Sopenharmony_ci 1817777dab0Sopenharmony_ci/** 1827777dab0Sopenharmony_ci * Converts a single domain name label into its ASCII form for DNS lookup. 1837777dab0Sopenharmony_ci * If any processing step fails, then pInfo->errors will be non-zero and 1847777dab0Sopenharmony_ci * the result might not be an ASCII string. 1857777dab0Sopenharmony_ci * The label might be modified according to the types of errors. 1867777dab0Sopenharmony_ci * Labels with severe errors will be left in (or turned into) their Unicode form. 1877777dab0Sopenharmony_ci * 1887777dab0Sopenharmony_ci * The UErrorCode indicates an error only in exceptional cases, 1897777dab0Sopenharmony_ci * such as a U_MEMORY_ALLOCATION_ERROR. 1907777dab0Sopenharmony_ci * 1917777dab0Sopenharmony_ci * @param idna UIDNA instance 1927777dab0Sopenharmony_ci * @param label Input domain name label 1937777dab0Sopenharmony_ci * @param length Label length, or -1 if NUL-terminated 1947777dab0Sopenharmony_ci * @param dest Destination string buffer 1957777dab0Sopenharmony_ci * @param capacity Destination buffer capacity 1967777dab0Sopenharmony_ci * @param pInfo Output container of IDNA processing details. 1977777dab0Sopenharmony_ci * @param pErrorCode Standard ICU error code. Its input value must 1987777dab0Sopenharmony_ci * pass the U_SUCCESS() test, or else the function returns 1997777dab0Sopenharmony_ci * immediately. Check for U_FAILURE() on output or use with 2007777dab0Sopenharmony_ci * function chaining. (See User Guide for details.) 2017777dab0Sopenharmony_ci * @return destination string length 2027777dab0Sopenharmony_ci * @stable ICU 4.6 2037777dab0Sopenharmony_ci */ 2047777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 2057777dab0Sopenharmony_ciuidna_labelToASCII(const UIDNA *idna, 2067777dab0Sopenharmony_ci const UChar *label, int32_t length, 2077777dab0Sopenharmony_ci UChar *dest, int32_t capacity, 2087777dab0Sopenharmony_ci UIDNAInfo *pInfo, UErrorCode *pErrorCode); 2097777dab0Sopenharmony_ci 2107777dab0Sopenharmony_ci/** 2117777dab0Sopenharmony_ci * Converts a single domain name label into its Unicode form for human-readable display. 2127777dab0Sopenharmony_ci * If any processing step fails, then pInfo->errors will be non-zero. 2137777dab0Sopenharmony_ci * The label might be modified according to the types of errors. 2147777dab0Sopenharmony_ci * 2157777dab0Sopenharmony_ci * The UErrorCode indicates an error only in exceptional cases, 2167777dab0Sopenharmony_ci * such as a U_MEMORY_ALLOCATION_ERROR. 2177777dab0Sopenharmony_ci * 2187777dab0Sopenharmony_ci * @param idna UIDNA instance 2197777dab0Sopenharmony_ci * @param label Input domain name label 2207777dab0Sopenharmony_ci * @param length Label length, or -1 if NUL-terminated 2217777dab0Sopenharmony_ci * @param dest Destination string buffer 2227777dab0Sopenharmony_ci * @param capacity Destination buffer capacity 2237777dab0Sopenharmony_ci * @param pInfo Output container of IDNA processing details. 2247777dab0Sopenharmony_ci * @param pErrorCode Standard ICU error code. Its input value must 2257777dab0Sopenharmony_ci * pass the U_SUCCESS() test, or else the function returns 2267777dab0Sopenharmony_ci * immediately. Check for U_FAILURE() on output or use with 2277777dab0Sopenharmony_ci * function chaining. (See User Guide for details.) 2287777dab0Sopenharmony_ci * @return destination string length 2297777dab0Sopenharmony_ci * @stable ICU 4.6 2307777dab0Sopenharmony_ci */ 2317777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 2327777dab0Sopenharmony_ciuidna_labelToUnicode(const UIDNA *idna, 2337777dab0Sopenharmony_ci const UChar *label, int32_t length, 2347777dab0Sopenharmony_ci UChar *dest, int32_t capacity, 2357777dab0Sopenharmony_ci UIDNAInfo *pInfo, UErrorCode *pErrorCode); 2367777dab0Sopenharmony_ci 2377777dab0Sopenharmony_ci/** 2387777dab0Sopenharmony_ci * Converts a whole domain name into its ASCII form for DNS lookup. 2397777dab0Sopenharmony_ci * If any processing step fails, then pInfo->errors will be non-zero and 2407777dab0Sopenharmony_ci * the result might not be an ASCII string. 2417777dab0Sopenharmony_ci * The domain name might be modified according to the types of errors. 2427777dab0Sopenharmony_ci * Labels with severe errors will be left in (or turned into) their Unicode form. 2437777dab0Sopenharmony_ci * 2447777dab0Sopenharmony_ci * The UErrorCode indicates an error only in exceptional cases, 2457777dab0Sopenharmony_ci * such as a U_MEMORY_ALLOCATION_ERROR. 2467777dab0Sopenharmony_ci * 2477777dab0Sopenharmony_ci * @param idna UIDNA instance 2487777dab0Sopenharmony_ci * @param name Input domain name 2497777dab0Sopenharmony_ci * @param length Domain name length, or -1 if NUL-terminated 2507777dab0Sopenharmony_ci * @param dest Destination string buffer 2517777dab0Sopenharmony_ci * @param capacity Destination buffer capacity 2527777dab0Sopenharmony_ci * @param pInfo Output container of IDNA processing details. 2537777dab0Sopenharmony_ci * @param pErrorCode Standard ICU error code. Its input value must 2547777dab0Sopenharmony_ci * pass the U_SUCCESS() test, or else the function returns 2557777dab0Sopenharmony_ci * immediately. Check for U_FAILURE() on output or use with 2567777dab0Sopenharmony_ci * function chaining. (See User Guide for details.) 2577777dab0Sopenharmony_ci * @return destination string length 2587777dab0Sopenharmony_ci * @stable ICU 4.6 2597777dab0Sopenharmony_ci */ 2607777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 2617777dab0Sopenharmony_ciuidna_nameToASCII(const UIDNA *idna, 2627777dab0Sopenharmony_ci const UChar *name, int32_t length, 2637777dab0Sopenharmony_ci UChar *dest, int32_t capacity, 2647777dab0Sopenharmony_ci UIDNAInfo *pInfo, UErrorCode *pErrorCode); 2657777dab0Sopenharmony_ci 2667777dab0Sopenharmony_ci/** 2677777dab0Sopenharmony_ci * Converts a whole domain name into its Unicode form for human-readable display. 2687777dab0Sopenharmony_ci * If any processing step fails, then pInfo->errors will be non-zero. 2697777dab0Sopenharmony_ci * The domain name might be modified according to the types of errors. 2707777dab0Sopenharmony_ci * 2717777dab0Sopenharmony_ci * The UErrorCode indicates an error only in exceptional cases, 2727777dab0Sopenharmony_ci * such as a U_MEMORY_ALLOCATION_ERROR. 2737777dab0Sopenharmony_ci * 2747777dab0Sopenharmony_ci * @param idna UIDNA instance 2757777dab0Sopenharmony_ci * @param name Input domain name 2767777dab0Sopenharmony_ci * @param length Domain name length, or -1 if NUL-terminated 2777777dab0Sopenharmony_ci * @param dest Destination string buffer 2787777dab0Sopenharmony_ci * @param capacity Destination buffer capacity 2797777dab0Sopenharmony_ci * @param pInfo Output container of IDNA processing details. 2807777dab0Sopenharmony_ci * @param pErrorCode Standard ICU error code. Its input value must 2817777dab0Sopenharmony_ci * pass the U_SUCCESS() test, or else the function returns 2827777dab0Sopenharmony_ci * immediately. Check for U_FAILURE() on output or use with 2837777dab0Sopenharmony_ci * function chaining. (See User Guide for details.) 2847777dab0Sopenharmony_ci * @return destination string length 2857777dab0Sopenharmony_ci * @stable ICU 4.6 2867777dab0Sopenharmony_ci */ 2877777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 2887777dab0Sopenharmony_ciuidna_nameToUnicode(const UIDNA *idna, 2897777dab0Sopenharmony_ci const UChar *name, int32_t length, 2907777dab0Sopenharmony_ci UChar *dest, int32_t capacity, 2917777dab0Sopenharmony_ci UIDNAInfo *pInfo, UErrorCode *pErrorCode); 2927777dab0Sopenharmony_ci 2937777dab0Sopenharmony_ci/* UTF-8 versions of the processing methods --------------------------------- */ 2947777dab0Sopenharmony_ci 2957777dab0Sopenharmony_ci/** 2967777dab0Sopenharmony_ci * Converts a single domain name label into its ASCII form for DNS lookup. 2977777dab0Sopenharmony_ci * UTF-8 version of uidna_labelToASCII(), same behavior. 2987777dab0Sopenharmony_ci * 2997777dab0Sopenharmony_ci * @param idna UIDNA instance 3007777dab0Sopenharmony_ci * @param label Input domain name label 3017777dab0Sopenharmony_ci * @param length Label length, or -1 if NUL-terminated 3027777dab0Sopenharmony_ci * @param dest Destination string buffer 3037777dab0Sopenharmony_ci * @param capacity Destination buffer capacity 3047777dab0Sopenharmony_ci * @param pInfo Output container of IDNA processing details. 3057777dab0Sopenharmony_ci * @param pErrorCode Standard ICU error code. Its input value must 3067777dab0Sopenharmony_ci * pass the U_SUCCESS() test, or else the function returns 3077777dab0Sopenharmony_ci * immediately. Check for U_FAILURE() on output or use with 3087777dab0Sopenharmony_ci * function chaining. (See User Guide for details.) 3097777dab0Sopenharmony_ci * @return destination string length 3107777dab0Sopenharmony_ci * @stable ICU 4.6 3117777dab0Sopenharmony_ci */ 3127777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 3137777dab0Sopenharmony_ciuidna_labelToASCII_UTF8(const UIDNA *idna, 3147777dab0Sopenharmony_ci const char *label, int32_t length, 3157777dab0Sopenharmony_ci char *dest, int32_t capacity, 3167777dab0Sopenharmony_ci UIDNAInfo *pInfo, UErrorCode *pErrorCode); 3177777dab0Sopenharmony_ci 3187777dab0Sopenharmony_ci/** 3197777dab0Sopenharmony_ci * Converts a single domain name label into its Unicode form for human-readable display. 3207777dab0Sopenharmony_ci * UTF-8 version of uidna_labelToUnicode(), same behavior. 3217777dab0Sopenharmony_ci * 3227777dab0Sopenharmony_ci * @param idna UIDNA instance 3237777dab0Sopenharmony_ci * @param label Input domain name label 3247777dab0Sopenharmony_ci * @param length Label length, or -1 if NUL-terminated 3257777dab0Sopenharmony_ci * @param dest Destination string buffer 3267777dab0Sopenharmony_ci * @param capacity Destination buffer capacity 3277777dab0Sopenharmony_ci * @param pInfo Output container of IDNA processing details. 3287777dab0Sopenharmony_ci * @param pErrorCode Standard ICU error code. Its input value must 3297777dab0Sopenharmony_ci * pass the U_SUCCESS() test, or else the function returns 3307777dab0Sopenharmony_ci * immediately. Check for U_FAILURE() on output or use with 3317777dab0Sopenharmony_ci * function chaining. (See User Guide for details.) 3327777dab0Sopenharmony_ci * @return destination string length 3337777dab0Sopenharmony_ci * @stable ICU 4.6 3347777dab0Sopenharmony_ci */ 3357777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 3367777dab0Sopenharmony_ciuidna_labelToUnicodeUTF8(const UIDNA *idna, 3377777dab0Sopenharmony_ci const char *label, int32_t length, 3387777dab0Sopenharmony_ci char *dest, int32_t capacity, 3397777dab0Sopenharmony_ci UIDNAInfo *pInfo, UErrorCode *pErrorCode); 3407777dab0Sopenharmony_ci 3417777dab0Sopenharmony_ci/** 3427777dab0Sopenharmony_ci * Converts a whole domain name into its ASCII form for DNS lookup. 3437777dab0Sopenharmony_ci * UTF-8 version of uidna_nameToASCII(), same behavior. 3447777dab0Sopenharmony_ci * 3457777dab0Sopenharmony_ci * @param idna UIDNA instance 3467777dab0Sopenharmony_ci * @param name Input domain name 3477777dab0Sopenharmony_ci * @param length Domain name length, or -1 if NUL-terminated 3487777dab0Sopenharmony_ci * @param dest Destination string buffer 3497777dab0Sopenharmony_ci * @param capacity Destination buffer capacity 3507777dab0Sopenharmony_ci * @param pInfo Output container of IDNA processing details. 3517777dab0Sopenharmony_ci * @param pErrorCode Standard ICU error code. Its input value must 3527777dab0Sopenharmony_ci * pass the U_SUCCESS() test, or else the function returns 3537777dab0Sopenharmony_ci * immediately. Check for U_FAILURE() on output or use with 3547777dab0Sopenharmony_ci * function chaining. (See User Guide for details.) 3557777dab0Sopenharmony_ci * @return destination string length 3567777dab0Sopenharmony_ci * @stable ICU 4.6 3577777dab0Sopenharmony_ci */ 3587777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 3597777dab0Sopenharmony_ciuidna_nameToASCII_UTF8(const UIDNA *idna, 3607777dab0Sopenharmony_ci const char *name, int32_t length, 3617777dab0Sopenharmony_ci char *dest, int32_t capacity, 3627777dab0Sopenharmony_ci UIDNAInfo *pInfo, UErrorCode *pErrorCode); 3637777dab0Sopenharmony_ci 3647777dab0Sopenharmony_ci/** 3657777dab0Sopenharmony_ci * Converts a whole domain name into its Unicode form for human-readable display. 3667777dab0Sopenharmony_ci * UTF-8 version of uidna_nameToUnicode(), same behavior. 3677777dab0Sopenharmony_ci * 3687777dab0Sopenharmony_ci * @param idna UIDNA instance 3697777dab0Sopenharmony_ci * @param name Input domain name 3707777dab0Sopenharmony_ci * @param length Domain name length, or -1 if NUL-terminated 3717777dab0Sopenharmony_ci * @param dest Destination string buffer 3727777dab0Sopenharmony_ci * @param capacity Destination buffer capacity 3737777dab0Sopenharmony_ci * @param pInfo Output container of IDNA processing details. 3747777dab0Sopenharmony_ci * @param pErrorCode Standard ICU error code. Its input value must 3757777dab0Sopenharmony_ci * pass the U_SUCCESS() test, or else the function returns 3767777dab0Sopenharmony_ci * immediately. Check for U_FAILURE() on output or use with 3777777dab0Sopenharmony_ci * function chaining. (See User Guide for details.) 3787777dab0Sopenharmony_ci * @return destination string length 3797777dab0Sopenharmony_ci * @stable ICU 4.6 3807777dab0Sopenharmony_ci */ 3817777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 3827777dab0Sopenharmony_ciuidna_nameToUnicodeUTF8(const UIDNA *idna, 3837777dab0Sopenharmony_ci const char *name, int32_t length, 3847777dab0Sopenharmony_ci char *dest, int32_t capacity, 3857777dab0Sopenharmony_ci UIDNAInfo *pInfo, UErrorCode *pErrorCode); 3867777dab0Sopenharmony_ci 3877777dab0Sopenharmony_ci/* 3887777dab0Sopenharmony_ci * IDNA error bit set values. 3897777dab0Sopenharmony_ci * When a domain name or label fails a processing step or does not meet the 3907777dab0Sopenharmony_ci * validity criteria, then one or more of these error bits are set. 3917777dab0Sopenharmony_ci */ 3927777dab0Sopenharmony_cienum { 3937777dab0Sopenharmony_ci /** 3947777dab0Sopenharmony_ci * A non-final domain name label (or the whole domain name) is empty. 3957777dab0Sopenharmony_ci * @stable ICU 4.6 3967777dab0Sopenharmony_ci */ 3977777dab0Sopenharmony_ci UIDNA_ERROR_EMPTY_LABEL=1, 3987777dab0Sopenharmony_ci /** 3997777dab0Sopenharmony_ci * A domain name label is longer than 63 bytes. 4007777dab0Sopenharmony_ci * (See STD13/RFC1034 3.1. Name space specifications and terminology.) 4017777dab0Sopenharmony_ci * This is only checked in ToASCII operations, and only if the output label is all-ASCII. 4027777dab0Sopenharmony_ci * @stable ICU 4.6 4037777dab0Sopenharmony_ci */ 4047777dab0Sopenharmony_ci UIDNA_ERROR_LABEL_TOO_LONG=2, 4057777dab0Sopenharmony_ci /** 4067777dab0Sopenharmony_ci * A domain name is longer than 255 bytes in its storage form. 4077777dab0Sopenharmony_ci * (See STD13/RFC1034 3.1. Name space specifications and terminology.) 4087777dab0Sopenharmony_ci * This is only checked in ToASCII operations, and only if the output domain name is all-ASCII. 4097777dab0Sopenharmony_ci * @stable ICU 4.6 4107777dab0Sopenharmony_ci */ 4117777dab0Sopenharmony_ci UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4, 4127777dab0Sopenharmony_ci /** 4137777dab0Sopenharmony_ci * A label starts with a hyphen-minus ('-'). 4147777dab0Sopenharmony_ci * @stable ICU 4.6 4157777dab0Sopenharmony_ci */ 4167777dab0Sopenharmony_ci UIDNA_ERROR_LEADING_HYPHEN=8, 4177777dab0Sopenharmony_ci /** 4187777dab0Sopenharmony_ci * A label ends with a hyphen-minus ('-'). 4197777dab0Sopenharmony_ci * @stable ICU 4.6 4207777dab0Sopenharmony_ci */ 4217777dab0Sopenharmony_ci UIDNA_ERROR_TRAILING_HYPHEN=0x10, 4227777dab0Sopenharmony_ci /** 4237777dab0Sopenharmony_ci * A label contains hyphen-minus ('-') in the third and fourth positions. 4247777dab0Sopenharmony_ci * @stable ICU 4.6 4257777dab0Sopenharmony_ci */ 4267777dab0Sopenharmony_ci UIDNA_ERROR_HYPHEN_3_4=0x20, 4277777dab0Sopenharmony_ci /** 4287777dab0Sopenharmony_ci * A label starts with a combining mark. 4297777dab0Sopenharmony_ci * @stable ICU 4.6 4307777dab0Sopenharmony_ci */ 4317777dab0Sopenharmony_ci UIDNA_ERROR_LEADING_COMBINING_MARK=0x40, 4327777dab0Sopenharmony_ci /** 4337777dab0Sopenharmony_ci * A label or domain name contains disallowed characters. 4347777dab0Sopenharmony_ci * @stable ICU 4.6 4357777dab0Sopenharmony_ci */ 4367777dab0Sopenharmony_ci UIDNA_ERROR_DISALLOWED=0x80, 4377777dab0Sopenharmony_ci /** 4387777dab0Sopenharmony_ci * A label starts with "xn--" but does not contain valid Punycode. 4397777dab0Sopenharmony_ci * That is, an xn-- label failed Punycode decoding. 4407777dab0Sopenharmony_ci * @stable ICU 4.6 4417777dab0Sopenharmony_ci */ 4427777dab0Sopenharmony_ci UIDNA_ERROR_PUNYCODE=0x100, 4437777dab0Sopenharmony_ci /** 4447777dab0Sopenharmony_ci * A label contains a dot=full stop. 4457777dab0Sopenharmony_ci * This can occur in an input string for a single-label function. 4467777dab0Sopenharmony_ci * @stable ICU 4.6 4477777dab0Sopenharmony_ci */ 4487777dab0Sopenharmony_ci UIDNA_ERROR_LABEL_HAS_DOT=0x200, 4497777dab0Sopenharmony_ci /** 4507777dab0Sopenharmony_ci * An ACE label does not contain a valid label string. 4517777dab0Sopenharmony_ci * The label was successfully ACE (Punycode) decoded but the resulting 4527777dab0Sopenharmony_ci * string had severe validation errors. For example, 4537777dab0Sopenharmony_ci * it might contain characters that are not allowed in ACE labels, 4547777dab0Sopenharmony_ci * or it might not be normalized. 4557777dab0Sopenharmony_ci * @stable ICU 4.6 4567777dab0Sopenharmony_ci */ 4577777dab0Sopenharmony_ci UIDNA_ERROR_INVALID_ACE_LABEL=0x400, 4587777dab0Sopenharmony_ci /** 4597777dab0Sopenharmony_ci * A label does not meet the IDNA BiDi requirements (for right-to-left characters). 4607777dab0Sopenharmony_ci * @stable ICU 4.6 4617777dab0Sopenharmony_ci */ 4627777dab0Sopenharmony_ci UIDNA_ERROR_BIDI=0x800, 4637777dab0Sopenharmony_ci /** 4647777dab0Sopenharmony_ci * A label does not meet the IDNA CONTEXTJ requirements. 4657777dab0Sopenharmony_ci * @stable ICU 4.6 4667777dab0Sopenharmony_ci */ 4677777dab0Sopenharmony_ci UIDNA_ERROR_CONTEXTJ=0x1000, 4687777dab0Sopenharmony_ci /** 4697777dab0Sopenharmony_ci * A label does not meet the IDNA CONTEXTO requirements for punctuation characters. 4707777dab0Sopenharmony_ci * Some punctuation characters "Would otherwise have been DISALLOWED" 4717777dab0Sopenharmony_ci * but are allowed in certain contexts. (RFC 5892) 4727777dab0Sopenharmony_ci * @stable ICU 49 4737777dab0Sopenharmony_ci */ 4747777dab0Sopenharmony_ci UIDNA_ERROR_CONTEXTO_PUNCTUATION=0x2000, 4757777dab0Sopenharmony_ci /** 4767777dab0Sopenharmony_ci * A label does not meet the IDNA CONTEXTO requirements for digits. 4777777dab0Sopenharmony_ci * Arabic-Indic Digits (U+066x) must not be mixed with Extended Arabic-Indic Digits (U+06Fx). 4787777dab0Sopenharmony_ci * @stable ICU 49 4797777dab0Sopenharmony_ci */ 4807777dab0Sopenharmony_ci UIDNA_ERROR_CONTEXTO_DIGITS=0x4000 4817777dab0Sopenharmony_ci}; 4827777dab0Sopenharmony_ci#endif /* #if !UCONFIG_NO_IDNA */ 4837777dab0Sopenharmony_ci 4847777dab0Sopenharmony_ci#endif 485