xref: /libuv/src/idna.h (revision f3889085)
1 /* Copyright libuv contributors. All rights reserved.
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14  */
15 
16 #ifndef UV_SRC_IDNA_H_
17 #define UV_SRC_IDNA_H_
18 
19 /* Decode a single codepoint. Returns the codepoint or UINT32_MAX on error.
20  * |p| is updated on success _and_ error, i.e., bad multi-byte sequences are
21  * skipped in their entirety, not just the first bad byte.
22  */
23 unsigned uv__utf8_decode1(const char** p, const char* pe);
24 
25 /* Convert a UTF-8 domain name to IDNA 2008 / Punycode. A return value >= 0
26  * is the number of bytes written to |d|, including the trailing nul byte.
27  * A return value < 0 is a libuv error code. |s| and |d| can not overlap.
28  */
29 ssize_t uv__idna_toascii(const char* s, const char* se, char* d, char* de);
30 
31 #endif  /* UV_SRC_IDNA_H_ */
32