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