1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*
2b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *******************************************************************************
3b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
48f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer *   Copyright (C) 2003-2014, International Business Machines
5b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *   Corporation and others.  All Rights Reserved.
6b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *******************************************************************************
8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *   file name:  uidna.h
9b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *   encoding:   US-ASCII
10b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *   tab size:   8 (not used)
11b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *   indentation:4
12b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
13b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *   created on: 2003feb1
14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *   created by: Ram Viswanadha
15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
16b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
17b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef __UIDNA_H__
18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define __UIDNA_H__
19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
20b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/utypes.h"
21b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
22b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if !UCONFIG_NO_IDNA
23b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
2427f654740f2a26ad62a5c155af9199af9e69b889claireho#include "unicode/localpointer.h"
25b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/parseerr.h"
2627f654740f2a26ad62a5c155af9199af9e69b889claireho
27b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \file
2927f654740f2a26ad62a5c155af9199af9e69b889claireho * \brief C API: Internationalizing Domain Names in Applications (IDNA)
30b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
3127f654740f2a26ad62a5c155af9199af9e69b889claireho * IDNA2008 is implemented according to UTS #46, see the IDNA C++ class in idna.h.
32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
3327f654740f2a26ad62a5c155af9199af9e69b889claireho * The C API functions which do take a UIDNA * service object pointer
3427f654740f2a26ad62a5c155af9199af9e69b889claireho * implement UTS #46 and IDNA2008.
358f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer *
368f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer * IDNA2003 is obsolete.
3727f654740f2a26ad62a5c155af9199af9e69b889claireho * The C API functions which do not take a service object pointer
388f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer * implement IDNA2003. They are all deprecated.
39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
40b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
4127f654740f2a26ad62a5c155af9199af9e69b889claireho/*
4227f654740f2a26ad62a5c155af9199af9e69b889claireho * IDNA option bit set values.
43b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
4427f654740f2a26ad62a5c155af9199af9e69b889clairehoenum {
4527f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
4627f654740f2a26ad62a5c155af9199af9e69b889claireho     * Default options value: None of the other options are set.
47103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * For use in static worker and factory methods.
4827f654740f2a26ad62a5c155af9199af9e69b889claireho     * @stable ICU 2.6
4927f654740f2a26ad62a5c155af9199af9e69b889claireho     */
5027f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_DEFAULT=0,
518f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer#ifndef U_HIDE_DEPRECATED_API
5227f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
5327f654740f2a26ad62a5c155af9199af9e69b889claireho     * Option to allow unassigned code points in domain names and labels.
54103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * For use in static worker and factory methods.
55103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * <p>This option is ignored by the UTS46 implementation.
5627f654740f2a26ad62a5c155af9199af9e69b889claireho     * (UTS #46 disallows unassigned code points.)
578f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer     * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA.
5827f654740f2a26ad62a5c155af9199af9e69b889claireho     */
5927f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ALLOW_UNASSIGNED=1,
608f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer#endif  /* U_HIDE_DEPRECATED_API */
6127f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
6227f654740f2a26ad62a5c155af9199af9e69b889claireho     * Option to check whether the input conforms to the STD3 ASCII rules,
6327f654740f2a26ad62a5c155af9199af9e69b889claireho     * for example the restriction of labels to LDH characters
6427f654740f2a26ad62a5c155af9199af9e69b889claireho     * (ASCII Letters, Digits and Hyphen-Minus).
65103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * For use in static worker and factory methods.
6627f654740f2a26ad62a5c155af9199af9e69b889claireho     * @stable ICU 2.6
6727f654740f2a26ad62a5c155af9199af9e69b889claireho     */
6827f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_USE_STD3_RULES=2,
6927f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
7027f654740f2a26ad62a5c155af9199af9e69b889claireho     * IDNA option to check for whether the input conforms to the BiDi rules.
71103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * For use in static worker and factory methods.
72103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * <p>This option is ignored by the IDNA2003 implementation.
7327f654740f2a26ad62a5c155af9199af9e69b889claireho     * (IDNA2003 always performs a BiDi check.)
74103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
7527f654740f2a26ad62a5c155af9199af9e69b889claireho     */
7627f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_CHECK_BIDI=4,
7727f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
7827f654740f2a26ad62a5c155af9199af9e69b889claireho     * IDNA option to check for whether the input conforms to the CONTEXTJ rules.
79103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * For use in static worker and factory methods.
80103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * <p>This option is ignored by the IDNA2003 implementation.
8127f654740f2a26ad62a5c155af9199af9e69b889claireho     * (The CONTEXTJ check is new in IDNA2008.)
82103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
8327f654740f2a26ad62a5c155af9199af9e69b889claireho     */
8427f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_CHECK_CONTEXTJ=8,
8527f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
8627f654740f2a26ad62a5c155af9199af9e69b889claireho     * IDNA option for nontransitional processing in ToASCII().
87103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * For use in static worker and factory methods.
88103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * <p>By default, ToASCII() uses transitional processing.
89103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * <p>This option is ignored by the IDNA2003 implementation.
9027f654740f2a26ad62a5c155af9199af9e69b889claireho     * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.)
91103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
9227f654740f2a26ad62a5c155af9199af9e69b889claireho     */
9327f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_NONTRANSITIONAL_TO_ASCII=0x10,
9427f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
9527f654740f2a26ad62a5c155af9199af9e69b889claireho     * IDNA option for nontransitional processing in ToUnicode().
96103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * For use in static worker and factory methods.
97103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * <p>By default, ToUnicode() uses transitional processing.
98103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * <p>This option is ignored by the IDNA2003 implementation.
9927f654740f2a26ad62a5c155af9199af9e69b889claireho     * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.)
100103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
10127f654740f2a26ad62a5c155af9199af9e69b889claireho     */
102103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20,
103103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /**
104103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * IDNA option to check for whether the input conforms to the CONTEXTO rules.
105103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * For use in static worker and factory methods.
106103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * <p>This option is ignored by the IDNA2003 implementation.
107103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * (The CONTEXTO check is new in IDNA2008.)
108103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * <p>This is for use by registries for IDNA2008 conformance.
109103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * UTS #46 does not require the CONTEXTO check.
1108393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     * @stable ICU 49
111103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     */
112103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    UIDNA_CHECK_CONTEXTO=0x40
11327f654740f2a26ad62a5c155af9199af9e69b889claireho};
11427f654740f2a26ad62a5c155af9199af9e69b889claireho
11527f654740f2a26ad62a5c155af9199af9e69b889claireho/**
11627f654740f2a26ad62a5c155af9199af9e69b889claireho * Opaque C service object type for the new IDNA API.
117103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
11927f654740f2a26ad62a5c155af9199af9e69b889clairehostruct UIDNA;
120103e9ffba2cba345d0078eb8b8db33249f81840aCraig Corneliustypedef struct UIDNA UIDNA;  /**< C typedef for struct UIDNA. @stable ICU 4.6 */
12127f654740f2a26ad62a5c155af9199af9e69b889claireho
12227f654740f2a26ad62a5c155af9199af9e69b889claireho/**
12327f654740f2a26ad62a5c155af9199af9e69b889claireho * Returns a UIDNA instance which implements UTS #46.
12427f654740f2a26ad62a5c155af9199af9e69b889claireho * Returns an unmodifiable instance, owned by the caller.
12527f654740f2a26ad62a5c155af9199af9e69b889claireho * Cache it for multiple operations, and uidna_close() it when done.
12627f654740f2a26ad62a5c155af9199af9e69b889claireho * The instance is thread-safe, that is, it can be used concurrently.
12727f654740f2a26ad62a5c155af9199af9e69b889claireho *
12827f654740f2a26ad62a5c155af9199af9e69b889claireho * For details about the UTS #46 implementation see the IDNA C++ class in idna.h.
12927f654740f2a26ad62a5c155af9199af9e69b889claireho *
13027f654740f2a26ad62a5c155af9199af9e69b889claireho * @param options Bit set to modify the processing and error checking.
13127f654740f2a26ad62a5c155af9199af9e69b889claireho *                See option bit set values in uidna.h.
13227f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pErrorCode Standard ICU error code. Its input value must
13327f654740f2a26ad62a5c155af9199af9e69b889claireho *                  pass the U_SUCCESS() test, or else the function returns
13427f654740f2a26ad62a5c155af9199af9e69b889claireho *                  immediately. Check for U_FAILURE() on output or use with
13527f654740f2a26ad62a5c155af9199af9e69b889claireho *                  function chaining. (See User Guide for details.)
13627f654740f2a26ad62a5c155af9199af9e69b889claireho * @return the UTS #46 UIDNA instance, if successful
137103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
13827f654740f2a26ad62a5c155af9199af9e69b889claireho */
13954dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UIDNA * U_EXPORT2
14027f654740f2a26ad62a5c155af9199af9e69b889clairehouidna_openUTS46(uint32_t options, UErrorCode *pErrorCode);
14127f654740f2a26ad62a5c155af9199af9e69b889claireho
14227f654740f2a26ad62a5c155af9199af9e69b889claireho/**
14327f654740f2a26ad62a5c155af9199af9e69b889claireho * Closes a UIDNA instance.
14427f654740f2a26ad62a5c155af9199af9e69b889claireho * @param idna UIDNA instance to be closed
145103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
146b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
14754dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2
14827f654740f2a26ad62a5c155af9199af9e69b889clairehouidna_close(UIDNA *idna);
14927f654740f2a26ad62a5c155af9199af9e69b889claireho
15027f654740f2a26ad62a5c155af9199af9e69b889claireho#if U_SHOW_CPLUSPLUS_API
15127f654740f2a26ad62a5c155af9199af9e69b889claireho
15227f654740f2a26ad62a5c155af9199af9e69b889clairehoU_NAMESPACE_BEGIN
153b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
154b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
15527f654740f2a26ad62a5c155af9199af9e69b889claireho * \class LocalUIDNAPointer
15627f654740f2a26ad62a5c155af9199af9e69b889claireho * "Smart pointer" class, closes a UIDNA via uidna_close().
15727f654740f2a26ad62a5c155af9199af9e69b889claireho * For most methods see the LocalPointerBase base class.
15827f654740f2a26ad62a5c155af9199af9e69b889claireho *
15927f654740f2a26ad62a5c155af9199af9e69b889claireho * @see LocalPointerBase
16027f654740f2a26ad62a5c155af9199af9e69b889claireho * @see LocalPointer
161103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
16227f654740f2a26ad62a5c155af9199af9e69b889claireho */
16327f654740f2a26ad62a5c155af9199af9e69b889clairehoU_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close);
16427f654740f2a26ad62a5c155af9199af9e69b889claireho
16527f654740f2a26ad62a5c155af9199af9e69b889clairehoU_NAMESPACE_END
16627f654740f2a26ad62a5c155af9199af9e69b889claireho
16727f654740f2a26ad62a5c155af9199af9e69b889claireho#endif
16827f654740f2a26ad62a5c155af9199af9e69b889claireho
16927f654740f2a26ad62a5c155af9199af9e69b889claireho/**
17027f654740f2a26ad62a5c155af9199af9e69b889claireho * Output container for IDNA processing errors.
17127f654740f2a26ad62a5c155af9199af9e69b889claireho * Initialize with UIDNA_INFO_INITIALIZER:
17227f654740f2a26ad62a5c155af9199af9e69b889claireho * \code
17327f654740f2a26ad62a5c155af9199af9e69b889claireho * UIDNAInfo info = UIDNA_INFO_INITIALIZER;
17427f654740f2a26ad62a5c155af9199af9e69b889claireho * int32_t length = uidna_nameToASCII(..., &info, &errorCode);
17527f654740f2a26ad62a5c155af9199af9e69b889claireho * if(U_SUCCESS(errorCode) && info.errors!=0) { ... }
17627f654740f2a26ad62a5c155af9199af9e69b889claireho * \endcode
177103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
17827f654740f2a26ad62a5c155af9199af9e69b889claireho */
17954dcd9b6a06071f647dac967e9e267abb9410720Craig Corneliustypedef struct UIDNAInfo {
180103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /** sizeof(UIDNAInfo) @stable ICU 4.6 */
18127f654740f2a26ad62a5c155af9199af9e69b889claireho    int16_t size;
18227f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
18327f654740f2a26ad62a5c155af9199af9e69b889claireho     * Set to TRUE if transitional and nontransitional processing produce different results.
18427f654740f2a26ad62a5c155af9199af9e69b889claireho     * For details see C++ IDNAInfo::isTransitionalDifferent().
185103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
18627f654740f2a26ad62a5c155af9199af9e69b889claireho     */
18727f654740f2a26ad62a5c155af9199af9e69b889claireho    UBool isTransitionalDifferent;
18827f654740f2a26ad62a5c155af9199af9e69b889claireho    UBool reservedB3;  /**< Reserved field, do not use. @internal */
18927f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
19027f654740f2a26ad62a5c155af9199af9e69b889claireho     * Bit set indicating IDNA processing errors. 0 if no errors.
19127f654740f2a26ad62a5c155af9199af9e69b889claireho     * See UIDNA_ERROR_... constants.
192103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
19327f654740f2a26ad62a5c155af9199af9e69b889claireho     */
19427f654740f2a26ad62a5c155af9199af9e69b889claireho    uint32_t errors;
19527f654740f2a26ad62a5c155af9199af9e69b889claireho    int32_t reservedI2;  /**< Reserved field, do not use. @internal */
19627f654740f2a26ad62a5c155af9199af9e69b889claireho    int32_t reservedI3;  /**< Reserved field, do not use. @internal */
19754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius} UIDNAInfo;
19827f654740f2a26ad62a5c155af9199af9e69b889claireho
19927f654740f2a26ad62a5c155af9199af9e69b889claireho/**
20027f654740f2a26ad62a5c155af9199af9e69b889claireho * Static initializer for a UIDNAInfo struct.
201103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
20227f654740f2a26ad62a5c155af9199af9e69b889claireho */
20327f654740f2a26ad62a5c155af9199af9e69b889claireho#define UIDNA_INFO_INITIALIZER { \
20427f654740f2a26ad62a5c155af9199af9e69b889claireho    (int16_t)sizeof(UIDNAInfo), \
20527f654740f2a26ad62a5c155af9199af9e69b889claireho    FALSE, FALSE, \
20627f654740f2a26ad62a5c155af9199af9e69b889claireho    0, 0, 0 }
20727f654740f2a26ad62a5c155af9199af9e69b889claireho
20827f654740f2a26ad62a5c155af9199af9e69b889claireho/**
20927f654740f2a26ad62a5c155af9199af9e69b889claireho * Converts a single domain name label into its ASCII form for DNS lookup.
21027f654740f2a26ad62a5c155af9199af9e69b889claireho * If any processing step fails, then pInfo->errors will be non-zero and
21127f654740f2a26ad62a5c155af9199af9e69b889claireho * the result might not be an ASCII string.
21227f654740f2a26ad62a5c155af9199af9e69b889claireho * The label might be modified according to the types of errors.
21327f654740f2a26ad62a5c155af9199af9e69b889claireho * Labels with severe errors will be left in (or turned into) their Unicode form.
21427f654740f2a26ad62a5c155af9199af9e69b889claireho *
21527f654740f2a26ad62a5c155af9199af9e69b889claireho * The UErrorCode indicates an error only in exceptional cases,
21627f654740f2a26ad62a5c155af9199af9e69b889claireho * such as a U_MEMORY_ALLOCATION_ERROR.
21727f654740f2a26ad62a5c155af9199af9e69b889claireho *
21827f654740f2a26ad62a5c155af9199af9e69b889claireho * @param idna UIDNA instance
21927f654740f2a26ad62a5c155af9199af9e69b889claireho * @param label Input domain name label
22027f654740f2a26ad62a5c155af9199af9e69b889claireho * @param length Label length, or -1 if NUL-terminated
22127f654740f2a26ad62a5c155af9199af9e69b889claireho * @param dest Destination string buffer
22227f654740f2a26ad62a5c155af9199af9e69b889claireho * @param capacity Destination buffer capacity
22327f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pInfo Output container of IDNA processing details.
22427f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pErrorCode Standard ICU error code. Its input value must
22527f654740f2a26ad62a5c155af9199af9e69b889claireho *                  pass the U_SUCCESS() test, or else the function returns
22627f654740f2a26ad62a5c155af9199af9e69b889claireho *                  immediately. Check for U_FAILURE() on output or use with
22727f654740f2a26ad62a5c155af9199af9e69b889claireho *                  function chaining. (See User Guide for details.)
22827f654740f2a26ad62a5c155af9199af9e69b889claireho * @return destination string length
229103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
23027f654740f2a26ad62a5c155af9199af9e69b889claireho */
23154dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int32_t U_EXPORT2
23227f654740f2a26ad62a5c155af9199af9e69b889clairehouidna_labelToASCII(const UIDNA *idna,
23327f654740f2a26ad62a5c155af9199af9e69b889claireho                   const UChar *label, int32_t length,
23427f654740f2a26ad62a5c155af9199af9e69b889claireho                   UChar *dest, int32_t capacity,
23527f654740f2a26ad62a5c155af9199af9e69b889claireho                   UIDNAInfo *pInfo, UErrorCode *pErrorCode);
23627f654740f2a26ad62a5c155af9199af9e69b889claireho
23727f654740f2a26ad62a5c155af9199af9e69b889claireho/**
23827f654740f2a26ad62a5c155af9199af9e69b889claireho * Converts a single domain name label into its Unicode form for human-readable display.
23927f654740f2a26ad62a5c155af9199af9e69b889claireho * If any processing step fails, then pInfo->errors will be non-zero.
24027f654740f2a26ad62a5c155af9199af9e69b889claireho * The label might be modified according to the types of errors.
24127f654740f2a26ad62a5c155af9199af9e69b889claireho *
24227f654740f2a26ad62a5c155af9199af9e69b889claireho * The UErrorCode indicates an error only in exceptional cases,
24327f654740f2a26ad62a5c155af9199af9e69b889claireho * such as a U_MEMORY_ALLOCATION_ERROR.
24427f654740f2a26ad62a5c155af9199af9e69b889claireho *
24527f654740f2a26ad62a5c155af9199af9e69b889claireho * @param idna UIDNA instance
24627f654740f2a26ad62a5c155af9199af9e69b889claireho * @param label Input domain name label
24727f654740f2a26ad62a5c155af9199af9e69b889claireho * @param length Label length, or -1 if NUL-terminated
24827f654740f2a26ad62a5c155af9199af9e69b889claireho * @param dest Destination string buffer
24927f654740f2a26ad62a5c155af9199af9e69b889claireho * @param capacity Destination buffer capacity
25027f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pInfo Output container of IDNA processing details.
25127f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pErrorCode Standard ICU error code. Its input value must
25227f654740f2a26ad62a5c155af9199af9e69b889claireho *                  pass the U_SUCCESS() test, or else the function returns
25327f654740f2a26ad62a5c155af9199af9e69b889claireho *                  immediately. Check for U_FAILURE() on output or use with
25427f654740f2a26ad62a5c155af9199af9e69b889claireho *                  function chaining. (See User Guide for details.)
25527f654740f2a26ad62a5c155af9199af9e69b889claireho * @return destination string length
256103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
25727f654740f2a26ad62a5c155af9199af9e69b889claireho */
25854dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int32_t U_EXPORT2
25927f654740f2a26ad62a5c155af9199af9e69b889clairehouidna_labelToUnicode(const UIDNA *idna,
26027f654740f2a26ad62a5c155af9199af9e69b889claireho                     const UChar *label, int32_t length,
26127f654740f2a26ad62a5c155af9199af9e69b889claireho                     UChar *dest, int32_t capacity,
26227f654740f2a26ad62a5c155af9199af9e69b889claireho                     UIDNAInfo *pInfo, UErrorCode *pErrorCode);
26327f654740f2a26ad62a5c155af9199af9e69b889claireho
26427f654740f2a26ad62a5c155af9199af9e69b889claireho/**
26527f654740f2a26ad62a5c155af9199af9e69b889claireho * Converts a whole domain name into its ASCII form for DNS lookup.
26627f654740f2a26ad62a5c155af9199af9e69b889claireho * If any processing step fails, then pInfo->errors will be non-zero and
26727f654740f2a26ad62a5c155af9199af9e69b889claireho * the result might not be an ASCII string.
26827f654740f2a26ad62a5c155af9199af9e69b889claireho * The domain name might be modified according to the types of errors.
26927f654740f2a26ad62a5c155af9199af9e69b889claireho * Labels with severe errors will be left in (or turned into) their Unicode form.
27027f654740f2a26ad62a5c155af9199af9e69b889claireho *
27127f654740f2a26ad62a5c155af9199af9e69b889claireho * The UErrorCode indicates an error only in exceptional cases,
27227f654740f2a26ad62a5c155af9199af9e69b889claireho * such as a U_MEMORY_ALLOCATION_ERROR.
27327f654740f2a26ad62a5c155af9199af9e69b889claireho *
27427f654740f2a26ad62a5c155af9199af9e69b889claireho * @param idna UIDNA instance
27527f654740f2a26ad62a5c155af9199af9e69b889claireho * @param name Input domain name
27627f654740f2a26ad62a5c155af9199af9e69b889claireho * @param length Domain name length, or -1 if NUL-terminated
27727f654740f2a26ad62a5c155af9199af9e69b889claireho * @param dest Destination string buffer
27827f654740f2a26ad62a5c155af9199af9e69b889claireho * @param capacity Destination buffer capacity
27927f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pInfo Output container of IDNA processing details.
28027f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pErrorCode Standard ICU error code. Its input value must
28127f654740f2a26ad62a5c155af9199af9e69b889claireho *                  pass the U_SUCCESS() test, or else the function returns
28227f654740f2a26ad62a5c155af9199af9e69b889claireho *                  immediately. Check for U_FAILURE() on output or use with
28327f654740f2a26ad62a5c155af9199af9e69b889claireho *                  function chaining. (See User Guide for details.)
28427f654740f2a26ad62a5c155af9199af9e69b889claireho * @return destination string length
285103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
28627f654740f2a26ad62a5c155af9199af9e69b889claireho */
28754dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int32_t U_EXPORT2
28827f654740f2a26ad62a5c155af9199af9e69b889clairehouidna_nameToASCII(const UIDNA *idna,
28927f654740f2a26ad62a5c155af9199af9e69b889claireho                  const UChar *name, int32_t length,
29027f654740f2a26ad62a5c155af9199af9e69b889claireho                  UChar *dest, int32_t capacity,
29127f654740f2a26ad62a5c155af9199af9e69b889claireho                  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
29227f654740f2a26ad62a5c155af9199af9e69b889claireho
29327f654740f2a26ad62a5c155af9199af9e69b889claireho/**
29427f654740f2a26ad62a5c155af9199af9e69b889claireho * Converts a whole domain name into its Unicode form for human-readable display.
29527f654740f2a26ad62a5c155af9199af9e69b889claireho * If any processing step fails, then pInfo->errors will be non-zero.
29627f654740f2a26ad62a5c155af9199af9e69b889claireho * The domain name might be modified according to the types of errors.
29727f654740f2a26ad62a5c155af9199af9e69b889claireho *
29827f654740f2a26ad62a5c155af9199af9e69b889claireho * The UErrorCode indicates an error only in exceptional cases,
29927f654740f2a26ad62a5c155af9199af9e69b889claireho * such as a U_MEMORY_ALLOCATION_ERROR.
30027f654740f2a26ad62a5c155af9199af9e69b889claireho *
30127f654740f2a26ad62a5c155af9199af9e69b889claireho * @param idna UIDNA instance
30227f654740f2a26ad62a5c155af9199af9e69b889claireho * @param name Input domain name
30327f654740f2a26ad62a5c155af9199af9e69b889claireho * @param length Domain name length, or -1 if NUL-terminated
30427f654740f2a26ad62a5c155af9199af9e69b889claireho * @param dest Destination string buffer
30527f654740f2a26ad62a5c155af9199af9e69b889claireho * @param capacity Destination buffer capacity
30627f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pInfo Output container of IDNA processing details.
30727f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pErrorCode Standard ICU error code. Its input value must
30827f654740f2a26ad62a5c155af9199af9e69b889claireho *                  pass the U_SUCCESS() test, or else the function returns
30927f654740f2a26ad62a5c155af9199af9e69b889claireho *                  immediately. Check for U_FAILURE() on output or use with
31027f654740f2a26ad62a5c155af9199af9e69b889claireho *                  function chaining. (See User Guide for details.)
31127f654740f2a26ad62a5c155af9199af9e69b889claireho * @return destination string length
312103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
31327f654740f2a26ad62a5c155af9199af9e69b889claireho */
31454dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int32_t U_EXPORT2
31527f654740f2a26ad62a5c155af9199af9e69b889clairehouidna_nameToUnicode(const UIDNA *idna,
31627f654740f2a26ad62a5c155af9199af9e69b889claireho                    const UChar *name, int32_t length,
31727f654740f2a26ad62a5c155af9199af9e69b889claireho                    UChar *dest, int32_t capacity,
31827f654740f2a26ad62a5c155af9199af9e69b889claireho                    UIDNAInfo *pInfo, UErrorCode *pErrorCode);
31927f654740f2a26ad62a5c155af9199af9e69b889claireho
32027f654740f2a26ad62a5c155af9199af9e69b889claireho/* UTF-8 versions of the processing methods --------------------------------- */
32127f654740f2a26ad62a5c155af9199af9e69b889claireho
32227f654740f2a26ad62a5c155af9199af9e69b889claireho/**
32327f654740f2a26ad62a5c155af9199af9e69b889claireho * Converts a single domain name label into its ASCII form for DNS lookup.
32427f654740f2a26ad62a5c155af9199af9e69b889claireho * UTF-8 version of uidna_labelToASCII(), same behavior.
32527f654740f2a26ad62a5c155af9199af9e69b889claireho *
32627f654740f2a26ad62a5c155af9199af9e69b889claireho * @param idna UIDNA instance
32727f654740f2a26ad62a5c155af9199af9e69b889claireho * @param label Input domain name label
32827f654740f2a26ad62a5c155af9199af9e69b889claireho * @param length Label length, or -1 if NUL-terminated
32927f654740f2a26ad62a5c155af9199af9e69b889claireho * @param dest Destination string buffer
33027f654740f2a26ad62a5c155af9199af9e69b889claireho * @param capacity Destination buffer capacity
33127f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pInfo Output container of IDNA processing details.
33227f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pErrorCode Standard ICU error code. Its input value must
33327f654740f2a26ad62a5c155af9199af9e69b889claireho *                  pass the U_SUCCESS() test, or else the function returns
33427f654740f2a26ad62a5c155af9199af9e69b889claireho *                  immediately. Check for U_FAILURE() on output or use with
33527f654740f2a26ad62a5c155af9199af9e69b889claireho *                  function chaining. (See User Guide for details.)
33627f654740f2a26ad62a5c155af9199af9e69b889claireho * @return destination string length
337103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
33827f654740f2a26ad62a5c155af9199af9e69b889claireho */
33954dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int32_t U_EXPORT2
34027f654740f2a26ad62a5c155af9199af9e69b889clairehouidna_labelToASCII_UTF8(const UIDNA *idna,
34127f654740f2a26ad62a5c155af9199af9e69b889claireho                        const char *label, int32_t length,
34227f654740f2a26ad62a5c155af9199af9e69b889claireho                        char *dest, int32_t capacity,
34327f654740f2a26ad62a5c155af9199af9e69b889claireho                        UIDNAInfo *pInfo, UErrorCode *pErrorCode);
34427f654740f2a26ad62a5c155af9199af9e69b889claireho
34527f654740f2a26ad62a5c155af9199af9e69b889claireho/**
34627f654740f2a26ad62a5c155af9199af9e69b889claireho * Converts a single domain name label into its Unicode form for human-readable display.
34727f654740f2a26ad62a5c155af9199af9e69b889claireho * UTF-8 version of uidna_labelToUnicode(), same behavior.
34827f654740f2a26ad62a5c155af9199af9e69b889claireho *
34927f654740f2a26ad62a5c155af9199af9e69b889claireho * @param idna UIDNA instance
35027f654740f2a26ad62a5c155af9199af9e69b889claireho * @param label Input domain name label
35127f654740f2a26ad62a5c155af9199af9e69b889claireho * @param length Label length, or -1 if NUL-terminated
35227f654740f2a26ad62a5c155af9199af9e69b889claireho * @param dest Destination string buffer
35327f654740f2a26ad62a5c155af9199af9e69b889claireho * @param capacity Destination buffer capacity
35427f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pInfo Output container of IDNA processing details.
35527f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pErrorCode Standard ICU error code. Its input value must
35627f654740f2a26ad62a5c155af9199af9e69b889claireho *                  pass the U_SUCCESS() test, or else the function returns
35727f654740f2a26ad62a5c155af9199af9e69b889claireho *                  immediately. Check for U_FAILURE() on output or use with
35827f654740f2a26ad62a5c155af9199af9e69b889claireho *                  function chaining. (See User Guide for details.)
35927f654740f2a26ad62a5c155af9199af9e69b889claireho * @return destination string length
360103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
36127f654740f2a26ad62a5c155af9199af9e69b889claireho */
36254dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int32_t U_EXPORT2
36327f654740f2a26ad62a5c155af9199af9e69b889clairehouidna_labelToUnicodeUTF8(const UIDNA *idna,
36427f654740f2a26ad62a5c155af9199af9e69b889claireho                         const char *label, int32_t length,
36527f654740f2a26ad62a5c155af9199af9e69b889claireho                         char *dest, int32_t capacity,
36627f654740f2a26ad62a5c155af9199af9e69b889claireho                         UIDNAInfo *pInfo, UErrorCode *pErrorCode);
36727f654740f2a26ad62a5c155af9199af9e69b889claireho
36827f654740f2a26ad62a5c155af9199af9e69b889claireho/**
36927f654740f2a26ad62a5c155af9199af9e69b889claireho * Converts a whole domain name into its ASCII form for DNS lookup.
37027f654740f2a26ad62a5c155af9199af9e69b889claireho * UTF-8 version of uidna_nameToASCII(), same behavior.
37127f654740f2a26ad62a5c155af9199af9e69b889claireho *
37227f654740f2a26ad62a5c155af9199af9e69b889claireho * @param idna UIDNA instance
37327f654740f2a26ad62a5c155af9199af9e69b889claireho * @param name Input domain name
37427f654740f2a26ad62a5c155af9199af9e69b889claireho * @param length Domain name length, or -1 if NUL-terminated
37527f654740f2a26ad62a5c155af9199af9e69b889claireho * @param dest Destination string buffer
37627f654740f2a26ad62a5c155af9199af9e69b889claireho * @param capacity Destination buffer capacity
37727f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pInfo Output container of IDNA processing details.
37827f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pErrorCode Standard ICU error code. Its input value must
37927f654740f2a26ad62a5c155af9199af9e69b889claireho *                  pass the U_SUCCESS() test, or else the function returns
38027f654740f2a26ad62a5c155af9199af9e69b889claireho *                  immediately. Check for U_FAILURE() on output or use with
38127f654740f2a26ad62a5c155af9199af9e69b889claireho *                  function chaining. (See User Guide for details.)
38227f654740f2a26ad62a5c155af9199af9e69b889claireho * @return destination string length
383103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
38427f654740f2a26ad62a5c155af9199af9e69b889claireho */
38554dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int32_t U_EXPORT2
38627f654740f2a26ad62a5c155af9199af9e69b889clairehouidna_nameToASCII_UTF8(const UIDNA *idna,
38727f654740f2a26ad62a5c155af9199af9e69b889claireho                       const char *name, int32_t length,
38827f654740f2a26ad62a5c155af9199af9e69b889claireho                       char *dest, int32_t capacity,
38927f654740f2a26ad62a5c155af9199af9e69b889claireho                       UIDNAInfo *pInfo, UErrorCode *pErrorCode);
39027f654740f2a26ad62a5c155af9199af9e69b889claireho
39127f654740f2a26ad62a5c155af9199af9e69b889claireho/**
39227f654740f2a26ad62a5c155af9199af9e69b889claireho * Converts a whole domain name into its Unicode form for human-readable display.
39327f654740f2a26ad62a5c155af9199af9e69b889claireho * UTF-8 version of uidna_nameToUnicode(), same behavior.
39427f654740f2a26ad62a5c155af9199af9e69b889claireho *
39527f654740f2a26ad62a5c155af9199af9e69b889claireho * @param idna UIDNA instance
39627f654740f2a26ad62a5c155af9199af9e69b889claireho * @param name Input domain name
39727f654740f2a26ad62a5c155af9199af9e69b889claireho * @param length Domain name length, or -1 if NUL-terminated
39827f654740f2a26ad62a5c155af9199af9e69b889claireho * @param dest Destination string buffer
39927f654740f2a26ad62a5c155af9199af9e69b889claireho * @param capacity Destination buffer capacity
40027f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pInfo Output container of IDNA processing details.
40127f654740f2a26ad62a5c155af9199af9e69b889claireho * @param pErrorCode Standard ICU error code. Its input value must
40227f654740f2a26ad62a5c155af9199af9e69b889claireho *                  pass the U_SUCCESS() test, or else the function returns
40327f654740f2a26ad62a5c155af9199af9e69b889claireho *                  immediately. Check for U_FAILURE() on output or use with
40427f654740f2a26ad62a5c155af9199af9e69b889claireho *                  function chaining. (See User Guide for details.)
40527f654740f2a26ad62a5c155af9199af9e69b889claireho * @return destination string length
406103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
40727f654740f2a26ad62a5c155af9199af9e69b889claireho */
40854dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int32_t U_EXPORT2
40927f654740f2a26ad62a5c155af9199af9e69b889clairehouidna_nameToUnicodeUTF8(const UIDNA *idna,
41027f654740f2a26ad62a5c155af9199af9e69b889claireho                        const char *name, int32_t length,
41127f654740f2a26ad62a5c155af9199af9e69b889claireho                        char *dest, int32_t capacity,
41227f654740f2a26ad62a5c155af9199af9e69b889claireho                        UIDNAInfo *pInfo, UErrorCode *pErrorCode);
41327f654740f2a26ad62a5c155af9199af9e69b889claireho
41427f654740f2a26ad62a5c155af9199af9e69b889claireho/*
41527f654740f2a26ad62a5c155af9199af9e69b889claireho * IDNA error bit set values.
41627f654740f2a26ad62a5c155af9199af9e69b889claireho * When a domain name or label fails a processing step or does not meet the
41727f654740f2a26ad62a5c155af9199af9e69b889claireho * validity criteria, then one or more of these error bits are set.
41827f654740f2a26ad62a5c155af9199af9e69b889claireho */
41927f654740f2a26ad62a5c155af9199af9e69b889clairehoenum {
42027f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
42127f654740f2a26ad62a5c155af9199af9e69b889claireho     * A non-final domain name label (or the whole domain name) is empty.
422103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
42327f654740f2a26ad62a5c155af9199af9e69b889claireho     */
42427f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ERROR_EMPTY_LABEL=1,
42527f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
42627f654740f2a26ad62a5c155af9199af9e69b889claireho     * A domain name label is longer than 63 bytes.
42727f654740f2a26ad62a5c155af9199af9e69b889claireho     * (See STD13/RFC1034 3.1. Name space specifications and terminology.)
42827f654740f2a26ad62a5c155af9199af9e69b889claireho     * This is only checked in ToASCII operations, and only if the output label is all-ASCII.
429103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
43027f654740f2a26ad62a5c155af9199af9e69b889claireho     */
43127f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ERROR_LABEL_TOO_LONG=2,
43227f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
43327f654740f2a26ad62a5c155af9199af9e69b889claireho     * A domain name is longer than 255 bytes in its storage form.
43427f654740f2a26ad62a5c155af9199af9e69b889claireho     * (See STD13/RFC1034 3.1. Name space specifications and terminology.)
43527f654740f2a26ad62a5c155af9199af9e69b889claireho     * This is only checked in ToASCII operations, and only if the output domain name is all-ASCII.
436103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
43727f654740f2a26ad62a5c155af9199af9e69b889claireho     */
43827f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4,
43927f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
44027f654740f2a26ad62a5c155af9199af9e69b889claireho     * A label starts with a hyphen-minus ('-').
441103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
44227f654740f2a26ad62a5c155af9199af9e69b889claireho     */
44327f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ERROR_LEADING_HYPHEN=8,
44427f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
44527f654740f2a26ad62a5c155af9199af9e69b889claireho     * A label ends with a hyphen-minus ('-').
446103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
44727f654740f2a26ad62a5c155af9199af9e69b889claireho     */
44827f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ERROR_TRAILING_HYPHEN=0x10,
44927f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
45027f654740f2a26ad62a5c155af9199af9e69b889claireho     * A label contains hyphen-minus ('-') in the third and fourth positions.
451103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
45227f654740f2a26ad62a5c155af9199af9e69b889claireho     */
45327f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ERROR_HYPHEN_3_4=0x20,
45427f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
45527f654740f2a26ad62a5c155af9199af9e69b889claireho     * A label starts with a combining mark.
456103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
45727f654740f2a26ad62a5c155af9199af9e69b889claireho     */
45827f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ERROR_LEADING_COMBINING_MARK=0x40,
45927f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
46027f654740f2a26ad62a5c155af9199af9e69b889claireho     * A label or domain name contains disallowed characters.
461103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
46227f654740f2a26ad62a5c155af9199af9e69b889claireho     */
46327f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ERROR_DISALLOWED=0x80,
46427f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
46527f654740f2a26ad62a5c155af9199af9e69b889claireho     * A label starts with "xn--" but does not contain valid Punycode.
46627f654740f2a26ad62a5c155af9199af9e69b889claireho     * That is, an xn-- label failed Punycode decoding.
467103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
46827f654740f2a26ad62a5c155af9199af9e69b889claireho     */
46927f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ERROR_PUNYCODE=0x100,
47027f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
47127f654740f2a26ad62a5c155af9199af9e69b889claireho     * A label contains a dot=full stop.
47227f654740f2a26ad62a5c155af9199af9e69b889claireho     * This can occur in an input string for a single-label function.
473103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
47427f654740f2a26ad62a5c155af9199af9e69b889claireho     */
47527f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ERROR_LABEL_HAS_DOT=0x200,
47627f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
47727f654740f2a26ad62a5c155af9199af9e69b889claireho     * An ACE label does not contain a valid label string.
47827f654740f2a26ad62a5c155af9199af9e69b889claireho     * The label was successfully ACE (Punycode) decoded but the resulting
47927f654740f2a26ad62a5c155af9199af9e69b889claireho     * string had severe validation errors. For example,
48027f654740f2a26ad62a5c155af9199af9e69b889claireho     * it might contain characters that are not allowed in ACE labels,
48127f654740f2a26ad62a5c155af9199af9e69b889claireho     * or it might not be normalized.
482103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
48327f654740f2a26ad62a5c155af9199af9e69b889claireho     */
48427f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ERROR_INVALID_ACE_LABEL=0x400,
48527f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
48627f654740f2a26ad62a5c155af9199af9e69b889claireho     * A label does not meet the IDNA BiDi requirements (for right-to-left characters).
487103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
48827f654740f2a26ad62a5c155af9199af9e69b889claireho     */
48927f654740f2a26ad62a5c155af9199af9e69b889claireho    UIDNA_ERROR_BIDI=0x800,
49027f654740f2a26ad62a5c155af9199af9e69b889claireho    /**
49127f654740f2a26ad62a5c155af9199af9e69b889claireho     * A label does not meet the IDNA CONTEXTJ requirements.
492103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @stable ICU 4.6
493103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     */
494103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    UIDNA_ERROR_CONTEXTJ=0x1000,
495103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /**
496103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * A label does not meet the IDNA CONTEXTO requirements for punctuation characters.
497103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * Some punctuation characters "Would otherwise have been DISALLOWED"
498103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * but are allowed in certain contexts. (RFC 5892)
4998393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     * @stable ICU 49
500103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     */
501103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    UIDNA_ERROR_CONTEXTO_PUNCTUATION=0x2000,
502103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /**
503103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * A label does not meet the IDNA CONTEXTO requirements for digits.
504103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * Arabic-Indic Digits (U+066x) must not be mixed with Extended Arabic-Indic Digits (U+06Fx).
5058393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     * @stable ICU 49
50627f654740f2a26ad62a5c155af9199af9e69b889claireho     */
507103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    UIDNA_ERROR_CONTEXTO_DIGITS=0x4000
50827f654740f2a26ad62a5c155af9199af9e69b889claireho};
50927f654740f2a26ad62a5c155af9199af9e69b889claireho
5108f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer#ifndef U_HIDE_DEPRECATED_API
5118f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer
51227f654740f2a26ad62a5c155af9199af9e69b889claireho/* IDNA2003 API ------------------------------------------------------------- */
51327f654740f2a26ad62a5c155af9199af9e69b889claireho
51427f654740f2a26ad62a5c155af9199af9e69b889claireho/**
51527f654740f2a26ad62a5c155af9199af9e69b889claireho * IDNA2003: This function implements the ToASCII operation as defined in the IDNA RFC.
516b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This operation is done on <b>single labels</b> before sending it to something that expects
517b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ASCII names. A label is an individual part of a domain name. Labels are usually
51850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * separated by dots; e.g. "www.example.com" is composed of 3 labels "www","example", and "com".
519b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
52027f654740f2a26ad62a5c155af9199af9e69b889claireho * IDNA2003 API Overview:
52127f654740f2a26ad62a5c155af9199af9e69b889claireho *
52227f654740f2a26ad62a5c155af9199af9e69b889claireho * The uidna_ API implements the IDNA protocol as defined in the IDNA RFC
52327f654740f2a26ad62a5c155af9199af9e69b889claireho * (http://www.ietf.org/rfc/rfc3490.txt).
52427f654740f2a26ad62a5c155af9199af9e69b889claireho * The RFC defines 2 operations: ToASCII and ToUnicode. Domain name labels
52527f654740f2a26ad62a5c155af9199af9e69b889claireho * containing non-ASCII code points are processed by the
52627f654740f2a26ad62a5c155af9199af9e69b889claireho * ToASCII operation before passing it to resolver libraries. Domain names
52727f654740f2a26ad62a5c155af9199af9e69b889claireho * that are obtained from resolver libraries are processed by the
52827f654740f2a26ad62a5c155af9199af9e69b889claireho * ToUnicode operation before displaying the domain name to the user.
52927f654740f2a26ad62a5c155af9199af9e69b889claireho * IDNA requires that implementations process input strings with Nameprep
53027f654740f2a26ad62a5c155af9199af9e69b889claireho * (http://www.ietf.org/rfc/rfc3491.txt),
53127f654740f2a26ad62a5c155af9199af9e69b889claireho * which is a profile of Stringprep (http://www.ietf.org/rfc/rfc3454.txt),
53227f654740f2a26ad62a5c155af9199af9e69b889claireho * and then with Punycode (http://www.ietf.org/rfc/rfc3492.txt).
53327f654740f2a26ad62a5c155af9199af9e69b889claireho * Implementations of IDNA MUST fully implement Nameprep and Punycode;
53427f654740f2a26ad62a5c155af9199af9e69b889claireho * neither Nameprep nor Punycode are optional.
53527f654740f2a26ad62a5c155af9199af9e69b889claireho * The input and output of ToASCII and ToUnicode operations are Unicode
53627f654740f2a26ad62a5c155af9199af9e69b889claireho * and are designed to be chainable, i.e., applying ToASCII or ToUnicode operations
53727f654740f2a26ad62a5c155af9199af9e69b889claireho * multiple times to an input string will yield the same result as applying the operation
53827f654740f2a26ad62a5c155af9199af9e69b889claireho * once.
53927f654740f2a26ad62a5c155af9199af9e69b889claireho * ToUnicode(ToUnicode(ToUnicode...(ToUnicode(string)))) == ToUnicode(string)
54027f654740f2a26ad62a5c155af9199af9e69b889claireho * ToASCII(ToASCII(ToASCII...(ToASCII(string))) == ToASCII(string).
541b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
542b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src               Input UChar array containing label in Unicode.
543b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength         Number of UChars in src, or -1 if NUL-terminated.
544b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest              Output UChar array with ASCII (ACE encoded) label.
545b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity      Size of dest.
546b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options           A bit set of options:
547b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
548b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_DEFAULT             Use default options, i.e., do not process unassigned code points
549b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              and do not use STD3 ASCII rules
550b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If unassigned code points are found the operation fails with
551b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              U_UNASSIGNED_ERROR error code.
552b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
553b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_ALLOW_UNASSIGNED    Unassigned values can be converted to ASCII for query operations
554b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If this option is set, the unassigned code points are in the input
555b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              are treated as normal Unicode code points.
55627f654740f2a26ad62a5c155af9199af9e69b889claireho *
557b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_USE_STD3_RULES      Use STD3 ASCII rules for host name syntax restrictions
558b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If this option is set and the input does not satisfy STD3 rules,
559b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
560b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
561b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param parseError        Pointer to UParseError struct to receive information on position
562b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          of error if an error is encountered. Can be NULL.
563b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status            ICU in/out error code parameter.
564b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          U_INVALID_CHAR_FOUND if src contains
565b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          unmatched single surrogates.
566b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          U_INDEX_OUTOFBOUNDS_ERROR if src contains
567b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          too many code points.
568b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough
569b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the result string, if successful - or in case of a buffer overflow,
570b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *         in which case it will be greater than destCapacity.
5718f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA.
572b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
5731b7d32f919554dda9c193b32188251337bc756f1Fredrik RoubertU_DEPRECATED int32_t U_EXPORT2
574b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuidna_toASCII(const UChar* src, int32_t srcLength,
575b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru              UChar* dest, int32_t destCapacity,
576b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru              int32_t options,
577b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru              UParseError* parseError,
578b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru              UErrorCode* status);
579b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
580b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
581b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
58227f654740f2a26ad62a5c155af9199af9e69b889claireho * IDNA2003: This function implements the ToUnicode operation as defined in the IDNA RFC.
583b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This operation is done on <b>single labels</b> before sending it to something that expects
584b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unicode names. A label is an individual part of a domain name. Labels are usually
58550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * separated by dots; for e.g. "www.example.com" is composed of 3 labels "www","example", and "com".
586b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
587b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src               Input UChar array containing ASCII (ACE encoded) label.
588b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength         Number of UChars in src, or -1 if NUL-terminated.
589b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest Output       Converted UChar array containing Unicode equivalent of label.
590b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity      Size of dest.
591b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options           A bit set of options:
59227f654740f2a26ad62a5c155af9199af9e69b889claireho *
593b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_DEFAULT             Use default options, i.e., do not process unassigned code points
594b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              and do not use STD3 ASCII rules
595b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If unassigned code points are found the operation fails with
596b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              U_UNASSIGNED_ERROR error code.
597b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
598b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_ALLOW_UNASSIGNED      Unassigned values can be converted to ASCII for query operations
599b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If this option is set, the unassigned code points are in the input
600b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              are treated as normal Unicode code points. <b> Note: </b> This option is
601b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              required on toUnicode operation because the RFC mandates
602b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              verification of decoded ACE input by applying toASCII and comparing
603b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              its output with source
604b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
605b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_USE_STD3_RULES      Use STD3 ASCII rules for host name syntax restrictions
606b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If this option is set and the input does not satisfy STD3 rules,
607b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
608b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
609b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param parseError        Pointer to UParseError struct to receive information on position
610b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          of error if an error is encountered. Can be NULL.
611b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status            ICU in/out error code parameter.
612b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          U_INVALID_CHAR_FOUND if src contains
613b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          unmatched single surrogates.
614b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          U_INDEX_OUTOFBOUNDS_ERROR if src contains
615b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          too many code points.
616b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough
617b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the result string, if successful - or in case of a buffer overflow,
618b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *         in which case it will be greater than destCapacity.
6198f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA.
620b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
6211b7d32f919554dda9c193b32188251337bc756f1Fredrik RoubertU_DEPRECATED int32_t U_EXPORT2
622b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuidna_toUnicode(const UChar* src, int32_t srcLength,
623b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                UChar* dest, int32_t destCapacity,
624b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                int32_t options,
625b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                UParseError* parseError,
626b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                UErrorCode* status);
627b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
628b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
629b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
63027f654740f2a26ad62a5c155af9199af9e69b889claireho * IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC.
631b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This operation is done on complete domain names, e.g: "www.example.com".
632b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * It is important to note that this operation can fail. If it fails, then the input
633b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * domain name cannot be used as an Internationalized Domain Name and the application
634b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * should have methods defined to deal with the failure.
63527f654740f2a26ad62a5c155af9199af9e69b889claireho *
636b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <b>Note:</b> IDNA RFC specifies that a conformant application should divide a domain name
637b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each,
638b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and then convert. This function does not offer that level of granularity. The options once
639b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * set will apply to all labels in the domain name
640b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
641b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src               Input UChar array containing IDN in Unicode.
642b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength         Number of UChars in src, or -1 if NUL-terminated.
643b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest              Output UChar array with ASCII (ACE encoded) IDN.
644b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity      Size of dest.
645b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options           A bit set of options:
64627f654740f2a26ad62a5c155af9199af9e69b889claireho *
647b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_DEFAULT             Use default options, i.e., do not process unassigned code points
648b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              and do not use STD3 ASCII rules
649b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If unassigned code points are found the operation fails with
650b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              U_UNASSIGNED_CODE_POINT_FOUND error code.
651b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
652b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_ALLOW_UNASSIGNED    Unassigned values can be converted to ASCII for query operations
653b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If this option is set, the unassigned code points are in the input
654b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              are treated as normal Unicode code points.
65527f654740f2a26ad62a5c155af9199af9e69b889claireho *
656b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_USE_STD3_RULES      Use STD3 ASCII rules for host name syntax restrictions
657b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If this option is set and the input does not satisfy STD3 rules,
658b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
65927f654740f2a26ad62a5c155af9199af9e69b889claireho *
660b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param parseError        Pointer to UParseError struct to receive information on position
661b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          of error if an error is encountered. Can be NULL.
662b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status            ICU in/out error code parameter.
663b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          U_INVALID_CHAR_FOUND if src contains
664b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          unmatched single surrogates.
665b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          U_INDEX_OUTOFBOUNDS_ERROR if src contains
666b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          too many code points.
667b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough
668b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the result string, if successful - or in case of a buffer overflow,
669b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *         in which case it will be greater than destCapacity.
6708f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA.
671b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
6721b7d32f919554dda9c193b32188251337bc756f1Fredrik RoubertU_DEPRECATED int32_t U_EXPORT2
673b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuidna_IDNToASCII(  const UChar* src, int32_t srcLength,
674b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                   UChar* dest, int32_t destCapacity,
675b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                   int32_t options,
676b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                   UParseError* parseError,
677b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                   UErrorCode* status);
678b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
679b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
68027f654740f2a26ad62a5c155af9199af9e69b889claireho * IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC.
681b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This operation is done on complete domain names, e.g: "www.example.com".
682b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
683b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <b>Note:</b> IDNA RFC specifies that a conformant application should divide a domain name
684b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each,
685b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and then convert. This function does not offer that level of granularity. The options once
686b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * set will apply to all labels in the domain name
687b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
688b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src               Input UChar array containing IDN in ASCII (ACE encoded) form.
689b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength         Number of UChars in src, or -1 if NUL-terminated.
690b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest Output       UChar array containing Unicode equivalent of source IDN.
691b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity      Size of dest.
692b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options           A bit set of options:
69327f654740f2a26ad62a5c155af9199af9e69b889claireho *
694b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_DEFAULT             Use default options, i.e., do not process unassigned code points
695b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              and do not use STD3 ASCII rules
696b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If unassigned code points are found the operation fails with
697b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              U_UNASSIGNED_CODE_POINT_FOUND error code.
698b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
699b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_ALLOW_UNASSIGNED    Unassigned values can be converted to ASCII for query operations
700b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If this option is set, the unassigned code points are in the input
701b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              are treated as normal Unicode code points.
70227f654740f2a26ad62a5c155af9199af9e69b889claireho *
703b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_USE_STD3_RULES      Use STD3 ASCII rules for host name syntax restrictions
704b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If this option is set and the input does not satisfy STD3 rules,
705b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
706b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
707b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param parseError        Pointer to UParseError struct to receive information on position
708b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          of error if an error is encountered. Can be NULL.
709b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status            ICU in/out error code parameter.
710b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          U_INVALID_CHAR_FOUND if src contains
711b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          unmatched single surrogates.
712b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          U_INDEX_OUTOFBOUNDS_ERROR if src contains
713b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          too many code points.
714b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough
715b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the result string, if successful - or in case of a buffer overflow,
716b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *         in which case it will be greater than destCapacity.
7178f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA.
718b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
7191b7d32f919554dda9c193b32188251337bc756f1Fredrik RoubertU_DEPRECATED int32_t U_EXPORT2
720b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuidna_IDNToUnicode(  const UChar* src, int32_t srcLength,
721b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                     UChar* dest, int32_t destCapacity,
722b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                     int32_t options,
723b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                     UParseError* parseError,
724b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                     UErrorCode* status);
725b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
726b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
72727f654740f2a26ad62a5c155af9199af9e69b889claireho * IDNA2003: Compare two IDN strings for equivalence.
728b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function splits the domain names into labels and compares them.
729b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * According to IDN RFC, whenever two labels are compared, they are
730b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * considered equal if and only if their ASCII forms (obtained by
731b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * applying toASCII) match using an case-insensitive ASCII comparison.
732b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Two domain names are considered a match if and only if all labels
733b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * match regardless of whether label separators match.
734b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
735b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s1                First source string.
736b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length1           Length of first source string, or -1 if NUL-terminated.
737b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
738b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s2                Second source string.
739b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length2           Length of second source string, or -1 if NUL-terminated.
740b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options           A bit set of options:
74127f654740f2a26ad62a5c155af9199af9e69b889claireho *
742b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_DEFAULT             Use default options, i.e., do not process unassigned code points
743b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              and do not use STD3 ASCII rules
744b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If unassigned code points are found the operation fails with
745b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              U_UNASSIGNED_CODE_POINT_FOUND error code.
746b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
747b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_ALLOW_UNASSIGNED    Unassigned values can be converted to ASCII for query operations
748b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If this option is set, the unassigned code points are in the input
749b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              are treated as normal Unicode code points.
75027f654740f2a26ad62a5c155af9199af9e69b889claireho *
751b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  - UIDNA_USE_STD3_RULES      Use STD3 ASCII rules for host name syntax restrictions
752b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              If this option is set and the input does not satisfy STD3 rules,
753b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                              the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
754b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
755b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status            ICU error code in/out parameter.
756b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                          Must fulfill U_SUCCESS before the function call.
757b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return <0 or 0 or >0 as usual for string comparisons
7588f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA.
759b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
7601b7d32f919554dda9c193b32188251337bc756f1Fredrik RoubertU_DEPRECATED int32_t U_EXPORT2
761b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuidna_compare(  const UChar *s1, int32_t length1,
762b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                const UChar *s2, int32_t length2,
763b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                int32_t options,
764b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                UErrorCode* status);
765b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
7668f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer#endif  /* U_HIDE_DEPRECATED_API */
7678f185e9f9b8dc2323f0daaa0218d2d818aa0e7edMarkus Scherer
768b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_IDNA */
769b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
770b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif
771