/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_KICONV_H
#define _SYS_KICONV_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
/*
* of (name, id) pair. The id values of fromcode and tocode are used to
* find out the corresponding code conversions.
*/
typedef struct {
char *name;
/*
* Each unique kiconv code conversion identified by tocode and fromcode ids
* have corresponding module id and internal function pointers to open(),
* kiconv(), close(), and kiconvstr().
*/
typedef struct {
void *(*open)(void);
int *);
int (*close)(void *);
int *);
/*
* Each module id has a corresponding module name that is used to load
* the module as needed and a reference counter.
*/
typedef struct {
char *name;
/*
* The following two data structures are being used to transfer information
* on the supported kiconv code conversions from a module to the framework.
*
* Details can be found from kiconv_ops(9S) and kiconv_module_info(9S)
* man pages at PSARC/2007/173.
*/
typedef struct {
char *tocode;
char *fromcode;
void *(*kiconv_open)(void);
int *);
int (*kiconv_close)(void *);
int *);
} kiconv_ops_t;
typedef struct kiconv_mod_info {
char *module_name;
char **aliases;
char **canonicals;
int nowait;
/* The kiconv code conversion descriptor data structure. */
typedef struct {
/* Common conversion state data structure. */
typedef struct {
/* Common component types for possible code conversion mapping tables. */
typedef struct {
typedef struct {
/*
* The maximum name length for any given codeset or alias names; the following
* should be plenty big enough.
*/
/* The following characters do not exist in the normalized code names. */
#define KICONV_SKIPPABLE_CHAR(c) \
((c) == '-' || (c) == '_' || (c) == '.' || (c) == '@')
/*
* When we encounter non-identical characters, as like iconv(3C) we have,
* map them into either one of the replacement characters based on what is
* the current target tocde.
*
* The 0xefbfdb in UTF-8 is U+FFFD in Unicode scalar value.
*/
/* Numeric ids for kiconv modules. */
#define KICONV_EMBEDDED (0)
/* Functions used in kiconv conversion and module management. */
extern void kiconv_init();
extern int kiconv_register_module(kiconv_module_info_t *);
extern int kiconv_unregister_module(kiconv_module_info_t *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_KICONV_H */