ICU 4.8.1.1  4.8.1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
uidna.h
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  *
4  * Copyright (C) 2003-2010, International Business Machines
5  * Corporation and others. All Rights Reserved.
6  *
7  *******************************************************************************
8  * file name: uidna.h
9  * encoding: US-ASCII
10  * tab size: 8 (not used)
11  * indentation:4
12  *
13  * created on: 2003feb1
14  * created by: Ram Viswanadha
15  */
16 
17 #ifndef __UIDNA_H__
18 #define __UIDNA_H__
19 
20 #include "unicode/utypes.h"
21 
22 #if !UCONFIG_NO_IDNA
23 
24 #include "unicode/localpointer.h"
25 #include "unicode/parseerr.h"
26 
39 /*
40  * IDNA option bit set values.
41  */
42 enum {
92 };
93 
98 struct UIDNA;
99 typedef struct UIDNA UIDNA;
119 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode);
120 
126 U_DRAFT void U_EXPORT2
127 uidna_close(UIDNA *idna);
128 
129 #if U_SHOW_CPLUSPLUS_API
130 
132 
142 U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close);
143 
145 
146 #endif
147 
158 struct UIDNAInfo {
160  int16_t size;
173  uint32_t errors;
174  int32_t reservedI2;
175  int32_t reservedI3;
176 };
177 typedef struct UIDNAInfo UIDNAInfo;
178 
183 #define UIDNA_INFO_INITIALIZER { \
184  (int16_t)sizeof(UIDNAInfo), \
185  FALSE, FALSE, \
186  0, 0, 0 }
187 
211 U_DRAFT int32_t U_EXPORT2
212 uidna_labelToASCII(const UIDNA *idna,
213  const UChar *label, int32_t length,
214  UChar *dest, int32_t capacity,
215  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
216 
238 U_DRAFT int32_t U_EXPORT2
239 uidna_labelToUnicode(const UIDNA *idna,
240  const UChar *label, int32_t length,
241  UChar *dest, int32_t capacity,
242  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
243 
267 U_DRAFT int32_t U_EXPORT2
268 uidna_nameToASCII(const UIDNA *idna,
269  const UChar *name, int32_t length,
270  UChar *dest, int32_t capacity,
271  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
272 
294 U_DRAFT int32_t U_EXPORT2
295 uidna_nameToUnicode(const UIDNA *idna,
296  const UChar *name, int32_t length,
297  UChar *dest, int32_t capacity,
298  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
299 
300 /* UTF-8 versions of the processing methods --------------------------------- */
301 
319 U_DRAFT int32_t U_EXPORT2
320 uidna_labelToASCII_UTF8(const UIDNA *idna,
321  const char *label, int32_t length,
322  char *dest, int32_t capacity,
323  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
324 
342 U_DRAFT int32_t U_EXPORT2
343 uidna_labelToUnicodeUTF8(const UIDNA *idna,
344  const char *label, int32_t length,
345  char *dest, int32_t capacity,
346  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
347 
365 U_DRAFT int32_t U_EXPORT2
366 uidna_nameToASCII_UTF8(const UIDNA *idna,
367  const char *name, int32_t length,
368  char *dest, int32_t capacity,
369  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
370 
388 U_DRAFT int32_t U_EXPORT2
389 uidna_nameToUnicodeUTF8(const UIDNA *idna,
390  const char *name, int32_t length,
391  char *dest, int32_t capacity,
392  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
393 
394 /*
395  * IDNA error bit set values.
396  * When a domain name or label fails a processing step or does not meet the
397  * validity criteria, then one or more of these error bits are set.
398  */
399 enum {
475 };
476 
477 /* IDNA2003 API ------------------------------------------------------------- */
478 
538 U_STABLE int32_t U_EXPORT2
539 uidna_toASCII(const UChar* src, int32_t srcLength,
540  UChar* dest, int32_t destCapacity,
541  int32_t options,
542  UParseError* parseError,
543  UErrorCode* status);
544 
545 
586 U_STABLE int32_t U_EXPORT2
587 uidna_toUnicode(const UChar* src, int32_t srcLength,
588  UChar* dest, int32_t destCapacity,
589  int32_t options,
590  UParseError* parseError,
591  UErrorCode* status);
592 
593 
637 U_STABLE int32_t U_EXPORT2
638 uidna_IDNToASCII( const UChar* src, int32_t srcLength,
639  UChar* dest, int32_t destCapacity,
640  int32_t options,
641  UParseError* parseError,
642  UErrorCode* status);
643 
684 U_STABLE int32_t U_EXPORT2
685 uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
686  UChar* dest, int32_t destCapacity,
687  int32_t options,
688  UParseError* parseError,
689  UErrorCode* status);
690 
725 U_STABLE int32_t U_EXPORT2
726 uidna_compare( const UChar *s1, int32_t length1,
727  const UChar *s2, int32_t length2,
728  int32_t options,
729  UErrorCode* status);
730 
731 #endif /* #if !UCONFIG_NO_IDNA */
732 
733 #endif
int32_t uidna_IDNToUnicode(const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, int32_t options, UParseError *parseError, UErrorCode *status)
IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC...
Option to check whether the input conforms to the STD3 ASCII rules, for example the restriction of la...
Definition: uidna.h:61
A label contains hyphen-minus ('-') in the third and fourth positions.
Definition: uidna.h:433
A label does not meet the IDNA BiDi requirements (for right-to-left characters).
Definition: uidna.h:469
A label does not meet the IDNA CONTEXTJ requirements.
Definition: uidna.h:474
A label starts with a hyphen-minus ('-').
Definition: uidna.h:423
A label contains a dot=full stop.
Definition: uidna.h:455
A domain name is longer than 255 bytes in its storage form.
Definition: uidna.h:418
IDNA option for nontransitional processing in ToUnicode().
Definition: uidna.h:91
IDNA option to check for whether the input conforms to the CONTEXTJ rules.
Definition: uidna.h:75
int32_t uidna_labelToUnicodeUTF8(const UIDNA *idna, const char *label, int32_t length, char *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode)
Converts a single domain name label into its Unicode form for human-readable display.
Output container for IDNA processing errors.
Definition: uidna.h:158
A non-final domain name label (or the whole domain name) is empty.
Definition: uidna.h:404
A label or domain name contains disallowed characters.
Definition: uidna.h:443
A label ends with a hyphen-minus ('-').
Definition: uidna.h:428
int16_t size
sizeof(UIDNAInfo)
Definition: uidna.h:160
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
int32_t uidna_toUnicode(const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, int32_t options, UParseError *parseError, UErrorCode *status)
IDNA2003: This function implements the ToUnicode operation as defined in the IDNA RFC...
IDNA option for nontransitional processing in ToASCII().
Definition: uidna.h:83
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
UBool reservedB3
Reserved field, do not use.
Definition: uidna.h:167
IDNA option to check for whether the input conforms to the BiDi rules.
Definition: uidna.h:68
UBool isTransitionalDifferent
Set to TRUE if transitional and nontransitional processing produce different results.
Definition: uidna.h:166
Option to allow unassigned code points in domain names and labels.
Definition: uidna.h:54
#define U_EXPORT2
Definition: platform.h:314
An ACE label does not contain a valid label string.
Definition: uidna.h:464
int32_t reservedI3
Reserved field, do not use.
Definition: uidna.h:175
uint16_t UChar
Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
Definition: umachine.h:325
struct UIDNA UIDNA
C typedef for struct UIDNA.
Definition: uidna.h:99
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
C API: Parse Error Information.
uint32_t errors
Bit set indicating IDNA processing errors.
Definition: uidna.h:173
int32_t uidna_toASCII(const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, int32_t options, UParseError *parseError, UErrorCode *status)
IDNA2003: This function implements the ToASCII operation as defined in the IDNA RFC.
void uidna_close(UIDNA *idna)
Closes a UIDNA instance.
UIDNA * uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode)
Returns a UIDNA instance which implements UTS #46.
int32_t uidna_compare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, int32_t options, UErrorCode *status)
IDNA2003: Compare two IDN strings for equivalence.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:639
A domain name label is longer than 63 bytes.
Definition: uidna.h:411
int32_t uidna_nameToUnicode(const UIDNA *idna, const UChar *name, int32_t length, UChar *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode)
Converts a whole domain name into its Unicode form for human-readable display.
int32_t uidna_nameToUnicodeUTF8(const UIDNA *idna, const char *name, int32_t length, char *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode)
Converts a whole domain name into its Unicode form for human-readable display.
int32_t uidna_labelToASCII(const UIDNA *idna, const UChar *label, int32_t length, UChar *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode)
Converts a single domain name label into its ASCII form for DNS lookup.
int32_t uidna_labelToASCII_UTF8(const UIDNA *idna, const char *label, int32_t length, char *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode)
Converts a single domain name label into its ASCII form for DNS lookup.
int32_t uidna_nameToASCII_UTF8(const UIDNA *idna, const char *name, int32_t length, char *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode)
Converts a whole domain name into its ASCII form for DNS lookup.
int32_t uidna_labelToUnicode(const UIDNA *idna, const UChar *label, int32_t length, UChar *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode)
Converts a single domain name label into its Unicode form for human-readable display.
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:56
Basic definitions for ICU, for both C and C++ APIs.
A label starts with a combining mark.
Definition: uidna.h:438
int32_t uidna_IDNToASCII(const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, int32_t options, UParseError *parseError, UErrorCode *status)
IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC...
Default options value: None of the other options are set.
Definition: uidna.h:47
int32_t reservedI2
Reserved field, do not use.
Definition: uidna.h:174
int32_t uidna_nameToASCII(const UIDNA *idna, const UChar *name, int32_t length, UChar *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode)
Converts a whole domain name into its ASCII form for DNS lookup.
#define U_DRAFT
This is used to declare a function as a draft public ICU C API.
Definition: umachine.h:139
A label starts with "xn--" but does not contain valid Punycode.
Definition: uidna.h:449
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:137
int8_t UBool
The ICU boolean type.
Definition: umachine.h:228