/usr/include/idn2.h is in libidn2-dev 2.0.4-1.1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | /* idn2.h - header file for idn2
Copyright (C) 2011-2017 Simon Josefsson
Libidn2 is free software: you can redistribute it and/or modify it
under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version.
or both in parallel, as here.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _IDN2_H
#define _IDN2_H
/* *INDENT-OFF* */
#ifndef _IDN2_API
# if defined IDN2_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
# define _IDN2_API __attribute__((__visibility__("default")))
# elif defined IDN2_BUILDING && defined _MSC_VER && ! defined IDN2_STATIC
# define _IDN2_API __declspec(dllexport)
# elif defined _MSC_VER && ! defined IDN2_STATIC
# define _IDN2_API __declspec(dllimport)
# else
# define _IDN2_API
# endif
#endif
/* *INDENT-ON* */
#include <stdint.h> /* uint32_t */
#include <string.h> /* size_t */
#ifdef __cplusplus
extern "C"
{
#endif
/**
* G_GNUC_IDN2_ATTRIBUTE_PURE
*
* Function attribute: Function is a pure function.
*/
/**
* G_GNUC_IDN2_ATTRIBUTE_CONST
*
* Function attribute: Function is a const function.
*/
/**
* G_GNUC_UNUSED
*
* Parameter attribute: Parameter is not used.
*/
/* the following G_GNUC_ prefix is for gtk-doc to recognize the attributes */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define _IDN2_ATTRIBUTE_PURE __attribute__ ((__pure__))
# define _IDN2_ATTRIBUTE_CONST __attribute__ ((__const__))
# define G_GNUC_IDN2_ATTRIBUTE_PURE __attribute__ ((__pure__))
# define G_GNUC_IDN2_ATTRIBUTE_CONST __attribute__ ((__const__))
# define G_GNUC_UNUSED __attribute__ ((__unused__))
#else
# define _IDN2_ATTRIBUTE_PURE /* empty */
# define _IDN2_ATTRIBUTE_CONST /* empty */
# define G_GNUC_IDN2_ATTRIBUTE_PURE /* empty */
# define G_GNUC_IDN2_ATTRIBUTE_CONST /* empty */
# define G_GNUC_UNUSED /* empty */
#endif
/**
* IDN2_VERSION
*
* Pre-processor symbol with a string that describe the header file
* version number. Used together with idn2_check_version() to verify
* header file and run-time library consistency.
*/
#define IDN2_VERSION "2.0.4"
/**
* IDN2_VERSION_NUMBER
*
* Pre-processor symbol with a hexadecimal value describing the header
* file version number. For example, when the header version is
* 1.2.4711 this symbol will have the value 0x01021267. The last four
* digits are used to enumerate development snapshots, but for all
* public releases they will be 0000.
*/
#define IDN2_VERSION_NUMBER 0x02000004
/**
* IDN2_VERSION_MAJOR
*
* Pre-processor symbol for the major version number (decimal).
* The version scheme is major.minor.patchlevel.
*/
#define IDN2_VERSION_MAJOR 2
/**
* IDN2_VERSION_MINOR
*
* Pre-processor symbol for the minor version number (decimal).
* The version scheme is major.minor.patchlevel.
*/
#define IDN2_VERSION_MINOR 0
/**
* IDN2_VERSION_PATCH
*
* Pre-processor symbol for the patch level number (decimal).
* The version scheme is major.minor.patchlevel.
*/
#define IDN2_VERSION_PATCH 4
/**
* IDN2_LABEL_MAX_LENGTH
*
* Constant specifying the maximum length of a DNS label to 63
* characters, as specified in RFC 1034.
*/
#define IDN2_LABEL_MAX_LENGTH 63
/**
* IDN2_DOMAIN_MAX_LENGTH
*
* Constant specifying the maximum size of the wire encoding of a DNS
* domain to 255 characters, as specified in RFC 1034. Note that the
* usual printed representation of a domain name is limited to 253
* characters if it does not end with a period, or 254 characters if
* it ends with a period.
*/
#define IDN2_DOMAIN_MAX_LENGTH 255
/**
* idn2_flags:
* @IDN2_NFC_INPUT: Normalize input string using normalization form C.
* @IDN2_ALABEL_ROUNDTRIP: Perform optional IDNA2008 lookup roundtrip check (not implemented yet).
* @IDN2_TRANSITIONAL: Perform Unicode TR46 transitional processing.
* @IDN2_NONTRANSITIONAL: Perform Unicode TR46 non-transitional processing.
* @IDN2_ALLOW_UNASSIGNED: Libidn compatibility flag, unused.
* @IDN2_USE_STD3_ASCII_RULES: Use STD3 ASCII rules.
* This is a #TR46 only flag, and will be ignored when set without either
* @IDN2_TRANSITIONAL or @IDN2_NONTRANSITIONAL.
*
* Flags to IDNA2008 functions, to be binary or:ed together. Specify
* only 0 if you want the default behaviour.
*/
typedef enum
{
IDN2_NFC_INPUT = 1,
IDN2_ALABEL_ROUNDTRIP = 2,
IDN2_TRANSITIONAL = 4,
IDN2_NONTRANSITIONAL = 8,
IDN2_ALLOW_UNASSIGNED = 16,
IDN2_USE_STD3_ASCII_RULES = 32,
} idn2_flags;
/* IDNA2008 with UTF-8 encoded inputs. */
extern _IDN2_API int
idn2_lookup_u8 (const uint8_t * src, uint8_t ** lookupname, int flags);
extern _IDN2_API int
idn2_register_u8 (const uint8_t * ulabel, const uint8_t * alabel,
uint8_t ** insertname, int flags);
/* IDNA2008 with locale encoded inputs. */
extern _IDN2_API int
idn2_lookup_ul (const char *src, char **lookupname, int flags);
extern _IDN2_API int
idn2_register_ul (const char *ulabel, const char *alabel,
char **insertname, int flags);
/**
* idn2_rc:
* @IDN2_OK: Successful return.
* @IDN2_MALLOC: Memory allocation error.
* @IDN2_NO_CODESET: Could not determine locale string encoding format.
* @IDN2_ICONV_FAIL: Could not transcode locale string to UTF-8.
* @IDN2_ENCODING_ERROR: Unicode data encoding error.
* @IDN2_NFC: Error normalizing string.
* @IDN2_PUNYCODE_BAD_INPUT: Punycode invalid input.
* @IDN2_PUNYCODE_BIG_OUTPUT: Punycode output buffer too small.
* @IDN2_PUNYCODE_OVERFLOW: Punycode conversion would overflow.
* @IDN2_TOO_BIG_DOMAIN: Domain name longer than 255 characters.
* @IDN2_TOO_BIG_LABEL: Domain label longer than 63 characters.
* @IDN2_INVALID_ALABEL: Input A-label is not valid.
* @IDN2_UALABEL_MISMATCH: Input A-label and U-label does not match.
* @IDN2_INVALID_FLAGS: Invalid combination of flags.
* @IDN2_NOT_NFC: String is not NFC.
* @IDN2_2HYPHEN: String has forbidden two hyphens.
* @IDN2_HYPHEN_STARTEND: String has forbidden starting/ending hyphen.
* @IDN2_LEADING_COMBINING: String has forbidden leading combining character.
* @IDN2_DISALLOWED: String has disallowed character.
* @IDN2_CONTEXTJ: String has forbidden context-j character.
* @IDN2_CONTEXTJ_NO_RULE: String has context-j character with no rull.
* @IDN2_CONTEXTO: String has forbidden context-o character.
* @IDN2_CONTEXTO_NO_RULE: String has context-o character with no rull.
* @IDN2_UNASSIGNED: String has forbidden unassigned character.
* @IDN2_BIDI: String has forbidden bi-directional properties.
* @IDN2_DOT_IN_LABEL: Label has forbidden dot (TR46).
* @IDN2_INVALID_TRANSITIONAL: Label has character forbidden in transitional mode (TR46).
* @IDN2_INVALID_NONTRANSITIONAL: Label has character forbidden in non-transitional mode (TR46).
*
* Return codes for IDN2 functions. All return codes are negative
* except for the successful code IDN2_OK which are guaranteed to be
* 0. Positive values are reserved for non-error return codes.
*
* Note that the #idn2_rc enumeration may be extended at a later date
* to include new return codes.
*/
typedef enum
{
IDN2_OK = 0,
IDN2_MALLOC = -100,
IDN2_NO_CODESET = -101,
IDN2_ICONV_FAIL = -102,
IDN2_ENCODING_ERROR = -200,
IDN2_NFC = -201,
IDN2_PUNYCODE_BAD_INPUT = -202,
IDN2_PUNYCODE_BIG_OUTPUT = -203,
IDN2_PUNYCODE_OVERFLOW = -204,
IDN2_TOO_BIG_DOMAIN = -205,
IDN2_TOO_BIG_LABEL = -206,
IDN2_INVALID_ALABEL = -207,
IDN2_UALABEL_MISMATCH = -208,
IDN2_INVALID_FLAGS = -209,
IDN2_NOT_NFC = -300,
IDN2_2HYPHEN = -301,
IDN2_HYPHEN_STARTEND = -302,
IDN2_LEADING_COMBINING = -303,
IDN2_DISALLOWED = -304,
IDN2_CONTEXTJ = -305,
IDN2_CONTEXTJ_NO_RULE = -306,
IDN2_CONTEXTO = -307,
IDN2_CONTEXTO_NO_RULE = -308,
IDN2_UNASSIGNED = -309,
IDN2_BIDI = -310,
IDN2_DOT_IN_LABEL = -311,
IDN2_INVALID_TRANSITIONAL = -312,
IDN2_INVALID_NONTRANSITIONAL = -313,
} idn2_rc;
/* Auxilliary functions. */
extern _IDN2_API int
idn2_to_ascii_4i (const uint32_t * input, size_t inlen, char * output, int flags);
extern _IDN2_API int
idn2_to_ascii_4z (const uint32_t * input, char ** output, int flags);
extern _IDN2_API int
idn2_to_ascii_8z (const char * input, char ** output, int flags);
extern _IDN2_API int
idn2_to_ascii_lz (const char * input, char ** output, int flags);
extern _IDN2_API int
idn2_to_unicode_8z4z (const char * input, uint32_t ** output, int flags G_GNUC_UNUSED);
extern _IDN2_API int
idn2_to_unicode_4z4z (const uint32_t * input, uint32_t ** output, int flags);
extern _IDN2_API int
idn2_to_unicode_44i (const uint32_t * in, size_t inlen, uint32_t * out, size_t * outlen, int flags);
extern _IDN2_API int
idn2_to_unicode_8z8z (const char * input, char ** output, int flags);
extern _IDN2_API int
idn2_to_unicode_8zlz (const char * input, char ** output, int flags);
extern _IDN2_API int
idn2_to_unicode_lzlz (const char * input, char ** output, int flags);
extern _IDN2_API const char *
idn2_strerror (int rc) G_GNUC_IDN2_ATTRIBUTE_CONST;
extern _IDN2_API const char *
idn2_strerror_name (int rc) G_GNUC_IDN2_ATTRIBUTE_CONST;
extern _IDN2_API const char *
idn2_check_version (const char *req_version) G_GNUC_IDN2_ATTRIBUTE_PURE;
extern _IDN2_API void
idn2_free (void *ptr);
/*** libidn compatibility layer ***/
#if !defined IDNA_H && !defined IDN2_SKIP_LIBIDN_COMPAT
typedef enum
{
IDNA_SUCCESS = IDN2_OK,
IDNA_STRINGPREP_ERROR = IDN2_ENCODING_ERROR,
IDNA_PUNYCODE_ERROR = IDN2_PUNYCODE_BAD_INPUT,
IDNA_CONTAINS_NON_LDH = IDN2_ENCODING_ERROR,
IDNA_CONTAINS_LDH = IDNA_CONTAINS_NON_LDH,
IDNA_CONTAINS_MINUS = IDN2_ENCODING_ERROR,
IDNA_INVALID_LENGTH = IDN2_DISALLOWED,
IDNA_NO_ACE_PREFIX = IDN2_ENCODING_ERROR,
IDNA_ROUNDTRIP_VERIFY_ERROR = IDN2_ENCODING_ERROR,
IDNA_CONTAINS_ACE_PREFIX = IDN2_ENCODING_ERROR,
IDNA_ICONV_ERROR = IDN2_ENCODING_ERROR,
IDNA_MALLOC_ERROR = IDN2_MALLOC,
IDNA_DLOPEN_ERROR = IDN2_MALLOC
} Idna_rc;
/* IDNA flags */
typedef enum
{
IDNA_ALLOW_UNASSIGNED = IDN2_ALLOW_UNASSIGNED,
IDNA_USE_STD3_ASCII_RULES = IDN2_USE_STD3_ASCII_RULES
} Idna_flags;
#define idna_to_ascii_4i(i,l,o,f) idn2_to_ascii_4i(i,l,o,f|IDN2_NFC_INPUT|IDN2_NONTRANSITIONAL)
#define idna_to_ascii_4z(i,o,f) idn2_to_ascii_4z(i,o,f|IDN2_NFC_INPUT|IDN2_NONTRANSITIONAL)
#define idna_to_ascii_8z(i,o,f) idn2_to_ascii_8z(i,o,f|IDN2_NFC_INPUT|IDN2_NONTRANSITIONAL)
#define idna_to_ascii_lz(i,o,f) idn2_to_ascii_lz(i,o,f|IDN2_NFC_INPUT|IDN2_NONTRANSITIONAL)
#define idna_to_unicode_8z4z idn2_to_unicode_8z4z
#define idna_to_unicode_4z4z idn2_to_unicode_4z4z
#define idna_to_unicode_44i idn2_to_unicode_44i
#define idna_to_unicode_8z8z idn2_to_unicode_8z8z
#define idna_to_unicode_8zlz idn2_to_unicode_8zlz
#define idna_to_unicode_lzlz idn2_to_unicode_lzlz
#define idna_strerror idn2_strerror
#define idn_free idn2_free
#endif /* IDNA_H */
#ifdef __cplusplus
}
#endif
#endif /* _IDN2_H */
|