libidn  1.28
idna.h
Go to the documentation of this file.
1 /* idna.h --- Prototypes for Internationalized Domain Name library.
2  Copyright (C) 2002-2013 Simon Josefsson
3 
4  This file is part of GNU Libidn.
5 
6  GNU Libidn is free software: you can redistribute it and/or
7  modify it under the terms of either:
8 
9  * the GNU Lesser General Public License as published by the Free
10  Software Foundation; either version 3 of the License, or (at
11  your option) any later version.
12 
13  or
14 
15  * the GNU General Public License as published by the Free
16  Software Foundation; either version 2 of the License, or (at
17  your option) any later version.
18 
19  or both in parallel, as here.
20 
21  GNU Libidn is distributed in the hope that it will be useful,
22  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24  General Public License for more details.
25 
26  You should have received copies of the GNU General Public License and
27  the GNU Lesser General Public License along with this program. If
28  not, see <http://www.gnu.org/licenses/>. */
29 
30 #ifndef IDNA_H
31 # define IDNA_H
32 
33 # ifndef IDNAPI
34 # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
35 # define IDNAPI __attribute__((__visibility__("default")))
36 # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC
37 # define IDNAPI __declspec(dllexport)
38 # elif defined _MSC_VER && ! defined LIBIDN_STATIC
39 # define IDNAPI __declspec(dllimport)
40 # else
41 # define IDNAPI
42 # endif
43 # endif
44 
45 # include <stddef.h> /* size_t */
46 # include <idn-int.h> /* uint32_t */
47 
48 # ifdef __cplusplus
49 extern "C"
50 {
51 # endif
52 
53  /* Error codes. */
54  typedef enum
55  {
60  /* Workaround typo in earlier versions. */
68  /* Internal errors. */
71  } Idna_rc;
72 
73  /* IDNA flags */
74  typedef enum
75  {
78  } Idna_flags;
79 
80 # ifndef IDNA_ACE_PREFIX
81 # define IDNA_ACE_PREFIX "xn--"
82 # endif
83 
84  extern IDNAPI const char *idna_strerror (Idna_rc rc);
85 
86  /* Core functions */
87  extern IDNAPI int idna_to_ascii_4i (const uint32_t * in, size_t inlen,
88  char *out, int flags);
89  extern IDNAPI int idna_to_unicode_44i (const uint32_t * in, size_t inlen,
90  uint32_t * out, size_t * outlen,
91  int flags);
92 
93  /* Wrappers that handle several labels */
94 
95  extern IDNAPI int idna_to_ascii_4z (const uint32_t * input,
96  char **output, int flags);
97 
98  extern IDNAPI int idna_to_ascii_8z (const char *input, char **output,
99  int flags);
100 
101  extern IDNAPI int idna_to_ascii_lz (const char *input, char **output,
102  int flags);
103 
104  extern IDNAPI int idna_to_unicode_4z4z (const uint32_t * input,
105  uint32_t ** output, int flags);
106 
107  extern IDNAPI int idna_to_unicode_8z4z (const char *input,
108  uint32_t ** output, int flags);
109 
110  extern IDNAPI int idna_to_unicode_8z8z (const char *input,
111  char **output, int flags);
112 
113  extern IDNAPI int idna_to_unicode_8zlz (const char *input,
114  char **output, int flags);
115 
116  extern IDNAPI int idna_to_unicode_lzlz (const char *input,
117  char **output, int flags);
118 
119 # ifdef __cplusplus
120 }
121 # endif
122 
123 #endif /* IDNA_H */