1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #if HAVE_LIBIDN2
5 # include <idn2.h>
6 #elif HAVE_LIBIDN
7 # include <idna.h>
8 # include <stringprep.h>
9 #endif
10
11 #include <inttypes.h>
12
13 #if HAVE_LIBIDN2 || HAVE_LIBIDN
14 int dlopen_idn(void);
15 #else
dlopen_idn(void)16 static inline int dlopen_idn(void) {
17 return -EOPNOTSUPP;
18 }
19 #endif
20
21 #if HAVE_LIBIDN2
22 extern int (*sym_idn2_lookup_u8)(const uint8_t* src, uint8_t** lookupname, int flags);
23 extern const char *(*sym_idn2_strerror)(int rc);
24 extern int (*sym_idn2_to_unicode_8z8z)(const char * input, char ** output, int flags);
25 #endif
26
27 #if HAVE_LIBIDN
28 extern int (*sym_idna_to_ascii_4i)(const uint32_t * in, size_t inlen, char *out, int flags);
29 extern int (*sym_idna_to_unicode_44i)(const uint32_t * in, size_t inlen,uint32_t * out, size_t * outlen, int flags);
30 extern char* (*sym_stringprep_ucs4_to_utf8)(const uint32_t * str, ssize_t len, size_t * items_read, size_t * items_written);
31 extern uint32_t* (*sym_stringprep_utf8_to_ucs4)(const char *str, ssize_t len, size_t *items_written);
32 #endif
33