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