00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef IDNA_H
00024 # define IDNA_H
00025
00026 # ifndef IDNAPI
00027 # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
00028 # define IDNAPI __attribute__((__visibility__("default")))
00029 # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC
00030 # define IDNAPI __declspec(dllexport)
00031 # elif defined _MSC_VER && ! defined LIBIDN_STATIC
00032 # define IDNAPI __declspec(dllimport)
00033 # else
00034 # define IDNAPI
00035 # endif
00036 # endif
00037
00038 # include <stddef.h>
00039 # include <idn-int.h>
00040
00041 # ifdef __cplusplus
00042 extern "C"
00043 {
00044 # endif
00045
00046
00047 typedef enum
00048 {
00049 IDNA_SUCCESS = 0,
00050 IDNA_STRINGPREP_ERROR = 1,
00051 IDNA_PUNYCODE_ERROR = 2,
00052 IDNA_CONTAINS_NON_LDH = 3,
00053
00054 IDNA_CONTAINS_LDH = IDNA_CONTAINS_NON_LDH,
00055 IDNA_CONTAINS_MINUS = 4,
00056 IDNA_INVALID_LENGTH = 5,
00057 IDNA_NO_ACE_PREFIX = 6,
00058 IDNA_ROUNDTRIP_VERIFY_ERROR = 7,
00059 IDNA_CONTAINS_ACE_PREFIX = 8,
00060 IDNA_ICONV_ERROR = 9,
00061
00062 IDNA_MALLOC_ERROR = 201,
00063 IDNA_DLOPEN_ERROR = 202
00064 } Idna_rc;
00065
00066
00067 typedef enum
00068 {
00069 IDNA_ALLOW_UNASSIGNED = 0x0001,
00070 IDNA_USE_STD3_ASCII_RULES = 0x0002
00071 } Idna_flags;
00072
00073 # ifndef IDNA_ACE_PREFIX
00074 # define IDNA_ACE_PREFIX "xn--"
00075 # endif
00076
00077 extern IDNAPI const char *idna_strerror (Idna_rc rc);
00078
00079
00080 extern IDNAPI int idna_to_ascii_4i (const uint32_t * in, size_t inlen,
00081 char *out, int flags);
00082 extern IDNAPI int idna_to_unicode_44i (const uint32_t * in, size_t inlen,
00083 uint32_t * out, size_t * outlen,
00084 int flags);
00085
00086
00087
00088 extern IDNAPI int idna_to_ascii_4z (const uint32_t * input,
00089 char **output, int flags);
00090
00091 extern IDNAPI int idna_to_ascii_8z (const char *input, char **output,
00092 int flags);
00093
00094 extern IDNAPI int idna_to_ascii_lz (const char *input, char **output,
00095 int flags);
00096
00097 extern IDNAPI int idna_to_unicode_4z4z (const uint32_t * input,
00098 uint32_t ** output, int flags);
00099
00100 extern IDNAPI int idna_to_unicode_8z4z (const char *input,
00101 uint32_t ** output, int flags);
00102
00103 extern IDNAPI int idna_to_unicode_8z8z (const char *input,
00104 char **output, int flags);
00105
00106 extern IDNAPI int idna_to_unicode_8zlz (const char *input,
00107 char **output, int flags);
00108
00109 extern IDNAPI int idna_to_unicode_lzlz (const char *input,
00110 char **output, int flags);
00111
00112 # ifdef __cplusplus
00113 }
00114 # endif
00115
00116 #endif