ICU 50.2 50.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
25#include "unicode/parseerr.h"
26
38
39/*
40 * IDNA option bit set values.
41 */
42enum {
99#ifndef U_HIDE_DRAFT_API
110#endif /* U_HIDE_DRAFT_API */
111};
112
117struct UIDNA;
118typedef struct UIDNA UIDNA;
119
137U_STABLE UIDNA * U_EXPORT2
138uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode);
139
145U_STABLE void U_EXPORT2
147
148#if U_SHOW_CPLUSPLUS_API
149
151
162
164
165#endif
166
196
201#define UIDNA_INFO_INITIALIZER { \
202 (int16_t)sizeof(UIDNAInfo), \
203 FALSE, FALSE, \
204 0, 0, 0 }
205
229U_STABLE int32_t U_EXPORT2
231 const UChar *label, int32_t length,
232 UChar *dest, int32_t capacity,
233 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
234
256U_STABLE int32_t U_EXPORT2
258 const UChar *label, int32_t length,
259 UChar *dest, int32_t capacity,
260 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
261
285U_STABLE int32_t U_EXPORT2
287 const UChar *name, int32_t length,
288 UChar *dest, int32_t capacity,
289 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
290
312U_STABLE int32_t U_EXPORT2
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
337U_STABLE int32_t U_EXPORT2
339 const char *label, int32_t length,
340 char *dest, int32_t capacity,
341 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
342
360U_STABLE int32_t U_EXPORT2
362 const char *label, int32_t length,
363 char *dest, int32_t capacity,
364 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
365
383U_STABLE int32_t U_EXPORT2
385 const char *name, int32_t length,
386 char *dest, int32_t capacity,
387 UIDNAInfo *pInfo, UErrorCode *pErrorCode);
388
406U_STABLE int32_t U_EXPORT2
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 */
417enum {
493#ifndef U_HIDE_DRAFT_API
507#endif /* U_HIDE_DRAFT_API */
508};
509
510/* IDNA2003 API ------------------------------------------------------------- */
511
571U_STABLE int32_t U_EXPORT2
572uidna_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
619U_STABLE int32_t U_EXPORT2
620uidna_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
670U_STABLE int32_t U_EXPORT2
671uidna_IDNToASCII( const UChar* src, int32_t srcLength,
672 UChar* dest, int32_t destCapacity,
673 int32_t options,
674 UParseError* parseError,
675 UErrorCode* status);
676
717U_STABLE int32_t U_EXPORT2
718uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
719 UChar* dest, int32_t destCapacity,
720 int32_t options,
721 UParseError* parseError,
722 UErrorCode* status);
723
758U_STABLE int32_t U_EXPORT2
759uidna_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
"Smart pointer" class, closes a UIDNA via uidna_close().
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
C API: Parse Error Information.
Output container for IDNA processing errors.
Definition uidna.h:177
int16_t size
sizeof(UIDNAInfo)
Definition uidna.h:179
int32_t reservedI3
Reserved field, do not use.
Definition uidna.h:194
uint32_t errors
Bit set indicating IDNA processing errors.
Definition uidna.h:192
UBool isTransitionalDifferent
Set to TRUE if transitional and nontransitional processing produce different results.
Definition uidna.h:185
UBool reservedB3
Reserved field, do not use.
Definition uidna.h:186
int32_t reservedI2
Reserved field, do not use.
Definition uidna.h:193
A UParseError struct is used to returned detailed information about parsing errors.
Definition parseerr.h:56
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.
UIDNA * uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode)
Returns a UIDNA instance which implements UTS #46.
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.
struct UIDNA UIDNA
C typedef for struct UIDNA.
Definition uidna.h:118
@ UIDNA_ERROR_CONTEXTO_DIGITS
A label does not meet the IDNA CONTEXTO requirements for digits.
Definition uidna.h:506
@ UIDNA_ERROR_TRAILING_HYPHEN
A label ends with a hyphen-minus ('-').
Definition uidna.h:446
@ UIDNA_ERROR_LEADING_COMBINING_MARK
A label starts with a combining mark.
Definition uidna.h:456
@ UIDNA_ERROR_LABEL_TOO_LONG
A domain name label is longer than 63 bytes.
Definition uidna.h:429
@ UIDNA_ERROR_CONTEXTJ
A label does not meet the IDNA CONTEXTJ requirements.
Definition uidna.h:492
@ UIDNA_ERROR_DISALLOWED
A label or domain name contains disallowed characters.
Definition uidna.h:461
@ UIDNA_ERROR_LABEL_HAS_DOT
A label contains a dot=full stop.
Definition uidna.h:473
@ UIDNA_ERROR_BIDI
A label does not meet the IDNA BiDi requirements (for right-to-left characters).
Definition uidna.h:487
@ UIDNA_ERROR_HYPHEN_3_4
A label contains hyphen-minus ('-') in the third and fourth positions.
Definition uidna.h:451
@ UIDNA_ERROR_PUNYCODE
A label starts with "xn--" but does not contain valid Punycode.
Definition uidna.h:467
@ UIDNA_ERROR_DOMAIN_NAME_TOO_LONG
A domain name is longer than 255 bytes in its storage form.
Definition uidna.h:436
@ UIDNA_ERROR_LEADING_HYPHEN
A label starts with a hyphen-minus ('-').
Definition uidna.h:441
@ UIDNA_ERROR_CONTEXTO_PUNCTUATION
A label does not meet the IDNA CONTEXTO requirements for punctuation characters.
Definition uidna.h:500
@ UIDNA_ERROR_EMPTY_LABEL
A non-final domain name label (or the whole domain name) is empty.
Definition uidna.h:422
@ UIDNA_ERROR_INVALID_ACE_LABEL
An ACE label does not contain a valid label string.
Definition uidna.h:482
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.
void uidna_close(UIDNA *idna)
Closes a UIDNA instance.
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.
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_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.
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.
@ UIDNA_CHECK_CONTEXTJ
IDNA option to check for whether the input conforms to the CONTEXTJ rules.
Definition uidna.h:80
@ UIDNA_NONTRANSITIONAL_TO_ASCII
IDNA option for nontransitional processing in ToASCII().
Definition uidna.h:89
@ UIDNA_ALLOW_UNASSIGNED
Option to allow unassigned code points in domain names and labels.
Definition uidna.h:56
@ UIDNA_CHECK_CONTEXTO
IDNA option to check for whether the input conforms to the CONTEXTO rules.
Definition uidna.h:109
@ UIDNA_CHECK_BIDI
IDNA option to check for whether the input conforms to the BiDi rules.
Definition uidna.h:72
@ UIDNA_USE_STD3_RULES
Option to check whether the input conforms to the STD3 ASCII rules, for example the restriction of la...
Definition uidna.h:64
@ UIDNA_DEFAULT
Default options value: None of the other options are set.
Definition uidna.h:48
@ UIDNA_NONTRANSITIONAL_TO_UNICODE
IDNA option for nontransitional processing in ToUnicode().
Definition uidna.h:98
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.
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.
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_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.
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_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.
int8_t UBool
The ICU boolean type.
Definition umachine.h:200
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition umachine.h:278
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition umachine.h:109
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition utypes.h:476
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:129