ICU 50.1.2  50.1.2
uidna.h
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  *
4  * Copyright (C) 2003-2012, 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 {
99 #ifndef U_HIDE_DRAFT_API
100 
110 #endif /* U_HIDE_DRAFT_API */
111 };
112 
117 struct UIDNA;
118 typedef struct UIDNA UIDNA;
137 U_STABLE UIDNA * U_EXPORT2
138 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode);
139 
145 U_STABLE void U_EXPORT2
146 uidna_close(UIDNA *idna);
147 
148 #if U_SHOW_CPLUSPLUS_API
149 
151 
162 
164 
165 #endif
166 
177 typedef struct UIDNAInfo {
179  int16_t size;
192  uint32_t errors;
193  int32_t reservedI2;
194  int32_t reservedI3;
195 } UIDNAInfo;
196 
201 #define UIDNA_INFO_INITIALIZER { \
202  (int16_t)sizeof(UIDNAInfo), \
203  FALSE, FALSE, \
204  0, 0, 0 }
205 
229 U_STABLE int32_t U_EXPORT2
230 uidna_labelToASCII(const UIDNA *idna,
231  const UChar *label, int32_t length,
232  UChar *dest, int32_t capacity,
233  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
234 
256 U_STABLE int32_t U_EXPORT2
257 uidna_labelToUnicode(const UIDNA *idna,
258  const UChar *label, int32_t length,
259  UChar *dest, int32_t capacity,
260  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
261 
285 U_STABLE int32_t U_EXPORT2
286 uidna_nameToASCII(const UIDNA *idna,
287  const UChar *name, int32_t length,
288  UChar *dest, int32_t capacity,
289  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
290 
312 U_STABLE int32_t U_EXPORT2
313 uidna_nameToUnicode(const UIDNA *idna,
314  const UChar *name, int32_t length,
315  UChar *dest, int32_t capacity,
316  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
317 
318 /* UTF-8 versions of the processing methods --------------------------------- */
319 
337 U_STABLE int32_t U_EXPORT2
338 uidna_labelToASCII_UTF8(const UIDNA *idna,
339  const char *label, int32_t length,
340  char *dest, int32_t capacity,
341  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
342 
360 U_STABLE int32_t U_EXPORT2
361 uidna_labelToUnicodeUTF8(const UIDNA *idna,
362  const char *label, int32_t length,
363  char *dest, int32_t capacity,
364  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
365 
383 U_STABLE int32_t U_EXPORT2
384 uidna_nameToASCII_UTF8(const UIDNA *idna,
385  const char *name, int32_t length,
386  char *dest, int32_t capacity,
387  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
388 
406 U_STABLE int32_t U_EXPORT2
407 uidna_nameToUnicodeUTF8(const UIDNA *idna,
408  const char *name, int32_t length,
409  char *dest, int32_t capacity,
410  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
411 
412 /*
413  * IDNA error bit set values.
414  * When a domain name or label fails a processing step or does not meet the
415  * validity criteria, then one or more of these error bits are set.
416  */
417 enum {
493 #ifndef U_HIDE_DRAFT_API
494 
507 #endif /* U_HIDE_DRAFT_API */
508 };
509 
510 /* IDNA2003 API ------------------------------------------------------------- */
511 
571 U_STABLE int32_t U_EXPORT2
572 uidna_toASCII(const UChar* src, int32_t srcLength,
573  UChar* dest, int32_t destCapacity,
574  int32_t options,
575  UParseError* parseError,
576  UErrorCode* status);
577 
578 
619 U_STABLE int32_t U_EXPORT2
620 uidna_toUnicode(const UChar* src, int32_t srcLength,
621  UChar* dest, int32_t destCapacity,
622  int32_t options,
623  UParseError* parseError,
624  UErrorCode* status);
625 
626 
670 U_STABLE int32_t U_EXPORT2
671 uidna_IDNToASCII( const UChar* src, int32_t srcLength,
672  UChar* dest, int32_t destCapacity,
673  int32_t options,
674  UParseError* parseError,
675  UErrorCode* status);
676 
717 U_STABLE int32_t U_EXPORT2
718 uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
719  UChar* dest, int32_t destCapacity,
720  int32_t options,
721  UParseError* parseError,
722  UErrorCode* status);
723 
758 U_STABLE int32_t U_EXPORT2
759 uidna_compare( const UChar *s1, int32_t length1,
760  const UChar *s2, int32_t length2,
761  int32_t options,
762  UErrorCode* status);
763 
764 #endif /* #if !UCONFIG_NO_IDNA */
765 
766 #endif