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