1/* $FreeBSD$ */
2/* $NetBSD: citrus_iconv.h,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */
3
4/*-
5 * SPDX-License-Identifier: BSD-2-Clause
6 *
7 * Copyright (c)2003 Citrus Project,
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#ifndef _CITRUS_ICONV_H_
33#define _CITRUS_ICONV_H_
34
35struct _citrus_iconv_shared;
36struct _citrus_iconv_ops;
37struct _citrus_iconv;
38
39__BEGIN_DECLS
40int		 _citrus_iconv_open(struct _citrus_iconv * __restrict * __restrict,
41		    const char * __restrict, const char * __restrict);
42void		 _citrus_iconv_close(struct _citrus_iconv *);
43const char	*_citrus_iconv_canonicalize(const char *);
44__END_DECLS
45
46
47#include "citrus_iconv_local.h"
48
49#define _CITRUS_ICONV_F_HIDE_INVALID	0x0001
50
51/*
52 * _citrus_iconv_convert:
53 *	convert a string.
54 */
55static __inline int
56_citrus_iconv_convert(struct _citrus_iconv * __restrict cv,
57    char * __restrict * __restrict in, size_t * __restrict inbytes,
58    char * __restrict * __restrict out, size_t * __restrict outbytes,
59    uint32_t flags, size_t * __restrict nresults)
60{
61
62	return (*cv->cv_shared->ci_ops->io_convert)(cv, in, inbytes, out,
63	    outbytes, flags, nresults);
64}
65
66#endif
67