NetSurf
idna.h
Go to the documentation of this file.
1/*
2 * Copyright 2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file
21 * interface to international domain name handling.
22 */
23
24#ifndef NETSURF_UTILS_IDNA_H_
25#define NETSURF_UTILS_IDNA_H_
26
27/**
28 * Unicode canonical combining class for virama
29 */
30#define IDNA_UNICODE_CCC_VIRAMA 9
31
32/**
33 * Convert a hostname to an ACE version suitable for DNS lookup
34 *
35 * \param host String containing host
36 * \param len Length of host string
37 * \param ace_host Pointer to update with the output
38 * \param ace_len Pointer to update with length of ace_host
39 * \return NSERROR_OK on success, appropriate error otherwise
40 *
41 * If return value != NSERROR_OK, output will be left untouched.
42 */
43nserror idna_encode(const char *host, size_t len, char **ace_host, size_t *ace_len);
44
45
46/**
47 * Convert a hostname from ACE to UTF-8 suitable for display
48 *
49 * \param ace_host String containing host
50 * \param ace_len Length of host string
51 * \param host Pointer to update with the output
52 * \param host_len Pointer to update with length of host
53 * \return NSERROR_OK on success, appropriate error otherwise
54 *
55 * If return value != NSERROR_OK, output will be left untouched.
56 */
57nserror idna_decode(const char *ace_host, size_t ace_len, char **host, size_t *host_len);
58
59#endif
60
nserror
Enumeration of error codes.
Definition: errors.h:29
nserror idna_encode(const char *host, size_t len, char **ace_host, size_t *ace_len)
Convert a hostname to an ACE version suitable for DNS lookup.
Definition: idna.c:694
nserror idna_decode(const char *ace_host, size_t ace_len, char **host, size_t *host_len)
Convert a hostname from ACE to UTF-8 suitable for display.
Definition: idna.c:773