ICU 49.1.1  49.1.1
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_DRAFT UIDNA * U_EXPORT2
138 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode);
139 
145 U_DRAFT void U_EXPORT2
146 uidna_close(UIDNA *idna);
147 
148 #if U_SHOW_CPLUSPLUS_API
149 
151 
161 U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close);
162 
164 
165 #endif
166 
177 struct UIDNAInfo {
179  int16_t size;
192  uint32_t errors;
193  int32_t reservedI2;
194  int32_t reservedI3;
195 };
196 typedef struct UIDNAInfo UIDNAInfo;
197 
202 #define UIDNA_INFO_INITIALIZER { \
203  (int16_t)sizeof(UIDNAInfo), \
204  FALSE, FALSE, \
205  0, 0, 0 }
206 
230 U_DRAFT int32_t U_EXPORT2
231 uidna_labelToASCII(const UIDNA *idna,
232  const UChar *label, int32_t length,
233  UChar *dest, int32_t capacity,
234  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
235 
257 U_DRAFT int32_t U_EXPORT2
258 uidna_labelToUnicode(const UIDNA *idna,
259  const UChar *label, int32_t length,
260  UChar *dest, int32_t capacity,
261  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
262 
286 U_DRAFT int32_t U_EXPORT2
287 uidna_nameToASCII(const UIDNA *idna,
288  const UChar *name, int32_t length,
289  UChar *dest, int32_t capacity,
290  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
291 
313 U_DRAFT int32_t U_EXPORT2
314 uidna_nameToUnicode(const UIDNA *idna,
315  const UChar *name, int32_t length,
316  UChar *dest, int32_t capacity,
317  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
318 
319 /* UTF-8 versions of the processing methods --------------------------------- */
320 
338 U_DRAFT int32_t U_EXPORT2
339 uidna_labelToASCII_UTF8(const UIDNA *idna,
340  const char *label, int32_t length,
341  char *dest, int32_t capacity,
342  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
343 
361 U_DRAFT int32_t U_EXPORT2
362 uidna_labelToUnicodeUTF8(const UIDNA *idna,
363  const char *label, int32_t length,
364  char *dest, int32_t capacity,
365  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
366 
384 U_DRAFT int32_t U_EXPORT2
385 uidna_nameToASCII_UTF8(const UIDNA *idna,
386  const char *name, int32_t length,
387  char *dest, int32_t capacity,
388  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
389 
407 U_DRAFT int32_t U_EXPORT2
408 uidna_nameToUnicodeUTF8(const UIDNA *idna,
409  const char *name, int32_t length,
410  char *dest, int32_t capacity,
411  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
412 
413 /*
414  * IDNA error bit set values.
415  * When a domain name or label fails a processing step or does not meet the
416  * validity criteria, then one or more of these error bits are set.
417  */
418 enum {
494 #ifndef U_HIDE_DRAFT_API
495 
508 #endif /* U_HIDE_DRAFT_API */
509 };
510 
511 /* IDNA2003 API ------------------------------------------------------------- */
512 
572 U_STABLE int32_t U_EXPORT2
573 uidna_toASCII(const UChar* src, int32_t srcLength,
574  UChar* dest, int32_t destCapacity,
575  int32_t options,
576  UParseError* parseError,
577  UErrorCode* status);
578 
579 
620 U_STABLE int32_t U_EXPORT2
621 uidna_toUnicode(const UChar* src, int32_t srcLength,
622  UChar* dest, int32_t destCapacity,
623  int32_t options,
624  UParseError* parseError,
625  UErrorCode* status);
626 
627 
671 U_STABLE int32_t U_EXPORT2
672 uidna_IDNToASCII( const UChar* src, int32_t srcLength,
673  UChar* dest, int32_t destCapacity,
674  int32_t options,
675  UParseError* parseError,
676  UErrorCode* status);
677 
718 U_STABLE int32_t U_EXPORT2
719 uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
720  UChar* dest, int32_t destCapacity,
721  int32_t options,
722  UParseError* parseError,
723  UErrorCode* status);
724 
759 U_STABLE int32_t U_EXPORT2
760 uidna_compare( const UChar *s1, int32_t length1,
761  const UChar *s2, int32_t length2,
762  int32_t options,
763  UErrorCode* status);
764 
765 #endif /* #if !UCONFIG_NO_IDNA */
766 
767 #endif