Developer Area

root/apps/iphone/superbook/trunk/idna.h @ 896

Revision 546, 3.3 kB (checked in by henri, 4 years ago)

Significant update to 1.4.
Long labels, subdomain IDNs, Google MapKit?. Required OS Version 3.0.

Line 
1/* idna.h --- Declarations for Internationalized Domain Name in Applications.
2 * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009  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 the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * GNU Libidn is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with GNU Libidn; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 */
21
22#ifndef IDNA_H
23# define IDNA_H
24
25# ifndef IDNAPI
26#  if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
27#   define IDNAPI __attribute__((__visibility__("default")))
28#  elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC
29#   define IDNAPI __declspec(dllexport)
30#  elif defined _MSC_VER && ! defined LIBIDN_STATIC
31#   define IDNAPI __declspec(dllimport)
32#  else
33#   define IDNAPI
34#  endif
35# endif
36
37# include <stddef.h>            /* size_t */
38# include <stdint.h>            /* uint32_t */
39
40# ifdef __cplusplus
41extern "C"
42{
43# endif
44
45  /* Error codes. */
46  typedef enum
47  {
48    IDNA_SUCCESS = 0,
49    IDNA_STRINGPREP_ERROR = 1,
50    IDNA_PUNYCODE_ERROR = 2,
51    IDNA_CONTAINS_NON_LDH = 3,
52    /* Workaround typo in earlier versions. */
53    IDNA_CONTAINS_LDH = IDNA_CONTAINS_NON_LDH,
54    IDNA_CONTAINS_MINUS = 4,
55    IDNA_INVALID_LENGTH = 5,
56    IDNA_NO_ACE_PREFIX = 6,
57    IDNA_ROUNDTRIP_VERIFY_ERROR = 7,
58    IDNA_CONTAINS_ACE_PREFIX = 8,
59    IDNA_ICONV_ERROR = 9,
60    /* Internal errors. */
61    IDNA_MALLOC_ERROR = 201,
62    IDNA_DLOPEN_ERROR = 202
63  } Idna_rc;
64
65  /* IDNA flags */
66  typedef enum
67  {
68    IDNA_ALLOW_UNASSIGNED = 0x0001,
69    IDNA_USE_STD3_ASCII_RULES = 0x0002
70  } Idna_flags;
71
72# ifndef IDNA_ACE_PREFIX
73#  define IDNA_ACE_PREFIX "xn--"
74# endif
75
76  extern IDNAPI const char *idna_strerror (Idna_rc rc);
77
78  /* Core functions */
79  extern IDNAPI int idna_to_ascii_4i (const uint32_t * in, size_t inlen,
80                                      char *out, int flags);
81  extern IDNAPI int idna_to_unicode_44i (const uint32_t * in, size_t inlen,
82                                         uint32_t * out, size_t * outlen,
83                                         int flags);
84
85  /* Wrappers that handle several labels */
86
87  extern IDNAPI int idna_to_ascii_4z (const uint32_t * input,
88                                      char **output, int flags);
89
90  extern IDNAPI int idna_to_ascii_8z (const char *input, char **output,
91                                      int flags);
92
93  extern IDNAPI int idna_to_ascii_lz (const char *input, char **output,
94                                      int flags);
95
96  extern IDNAPI int idna_to_unicode_4z4z (const uint32_t * input,
97                                          uint32_t ** output, int flags);
98
99  extern IDNAPI int idna_to_unicode_8z4z (const char *input,
100                                          uint32_t ** output, int flags);
101
102  extern IDNAPI int idna_to_unicode_8z8z (const char *input,
103                                          char **output, int flags);
104
105  extern IDNAPI int idna_to_unicode_8zlz (const char *input,
106                                          char **output, int flags);
107
108  extern IDNAPI int idna_to_unicode_lzlz (const char *input,
109                                          char **output, int flags);
110
111# ifdef __cplusplus
112}
113# endif
114
115#endif                          /* IDNA_H */
Note: See TracBrowser for help on using the browser.
Telnic
Search This Site
Partners
Neustar
ICANN
Main site | WHOIS | Sell .tel | FAQ | Archived Site | About Telnic | Contact Us