idna.h

Go to the documentation of this file.
00001 /* idna.h --- Declarations for Internationalized Domain Name in Applications.
00002  * Copyright (C) 2002, 2003, 2004  Simon Josefsson
00003  *
00004  * This file is part of GNU Libidn.
00005  *
00006  * GNU Libidn is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * GNU Libidn is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with GNU Libidn; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
00019  *
00020  */
00021 
00022 #ifndef _IDNA_H
00023 # define _IDNA_H
00024 
00025 # ifdef __cplusplus
00026 extern "C"
00027 {
00028 # endif
00029 
00030 # include <stddef.h>            /* size_t */
00031 # include <idn-int.h>           /* uint32_t */
00032 
00033   /* Error codes. */
00034   typedef enum
00035   {
00036     IDNA_SUCCESS = 0,
00037     IDNA_STRINGPREP_ERROR = 1,
00038     IDNA_PUNYCODE_ERROR = 2,
00039     IDNA_CONTAINS_NON_LDH = 3,
00040     /* Workaround typo in earlier versions. */
00041     IDNA_CONTAINS_LDH = IDNA_CONTAINS_NON_LDH,
00042     IDNA_CONTAINS_MINUS = 4,
00043     IDNA_INVALID_LENGTH = 5,
00044     IDNA_NO_ACE_PREFIX = 6,
00045     IDNA_ROUNDTRIP_VERIFY_ERROR = 7,
00046     IDNA_CONTAINS_ACE_PREFIX = 8,
00047     IDNA_ICONV_ERROR = 9,
00048     /* Internal errors. */
00049     IDNA_MALLOC_ERROR = 201,
00050     IDNA_DLOPEN_ERROR = 202
00051   } Idna_rc;
00052 
00053   /* IDNA flags */
00054   typedef enum
00055   {
00056     IDNA_ALLOW_UNASSIGNED = 0x0001,
00057     IDNA_USE_STD3_ASCII_RULES = 0x0002
00058   } Idna_flags;
00059 
00060 # ifndef IDNA_ACE_PREFIX
00061 #  define IDNA_ACE_PREFIX "xn--"
00062 # endif
00063 
00064   extern const char *idna_strerror (Idna_rc rc);
00065 
00066   /* Core functions */
00067   extern int idna_to_ascii_4i (const uint32_t * in, size_t inlen,
00068                                char *out, int flags);
00069   extern int idna_to_unicode_44i (const uint32_t * in, size_t inlen,
00070                                   uint32_t * out, size_t * outlen, int flags);
00071 
00072   /* Wrappers that handle several labels */
00073 
00074   extern int idna_to_ascii_4z (const uint32_t * input,
00075                                char **output, int flags);
00076 
00077   extern int idna_to_ascii_8z (const char *input, char **output, int flags);
00078 
00079   extern int idna_to_ascii_lz (const char *input, char **output, int flags);
00080 
00081 
00082   extern int idna_to_unicode_4z4z (const uint32_t * input,
00083                                    uint32_t ** output, int flags);
00084 
00085   extern int idna_to_unicode_8z4z (const char *input,
00086                                    uint32_t ** output, int flags);
00087 
00088   extern int idna_to_unicode_8z8z (const char *input,
00089                                    char **output, int flags);
00090 
00091   extern int idna_to_unicode_8zlz (const char *input,
00092                                    char **output, int flags);
00093 
00094   extern int idna_to_unicode_lzlz (const char *input,
00095                                    char **output, int flags);
00096 
00097 # ifdef __cplusplus
00098 }
00099 # endif
00100 #endif                          /* _IDNA_H */

Generated on Wed Sep 13 10:20:31 2006 for libidn by  doxygen 1.4.7