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 # ifdef __cplusplus
00026 extern "C"
00027 {
00028 # endif
00029
00030 # include <stddef.h>
00031 # include <idn-int.h>
00032
00033
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
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
00049 IDNA_MALLOC_ERROR = 201,
00050 IDNA_DLOPEN_ERROR = 202
00051 } Idna_rc;
00052
00053
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
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
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