The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netsmb/iconv.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: iconv.h,v 1.8 2005/12/11 06:25:32 christos Exp $       */
    2 
    3 /*
    4  * Copyright (c) 2000-2001, Boris Popov
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. All advertising materials mentioning features or use of this software
   16  *    must display the following acknowledgement:
   17  *    This product includes software developed by Boris Popov.
   18  * 4. Neither the name of the author nor the names of any co-contributors
   19  *    may be used to endorse or promote products derived from this software
   20  *    without specific prior written permission.
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   32  * SUCH DAMAGE.
   33  *
   34  * $FreeBSD: src/sys/sys/iconv.h,v 1.5 2002/07/15 13:34:50 markm Exp $
   35  */
   36 #ifndef _NETSMB_ICONV_H_
   37 #define _NETSMB_ICONV_H_
   38 
   39 #define ICONV_CSNMAXLEN         31      /* maximum length of charset name */
   40 #define ICONV_CNVNMAXLEN        31      /* maximum length of converter name */
   41 #define ICONV_CSMAXDATALEN      1024    /* maximum size of data associated with cs pair */
   42 
   43 /*
   44  * Entry for cslist sysctl
   45  */
   46 #define ICONV_CSPAIR_INFO_VER   1
   47 
   48 struct iconv_cspair_info {
   49         int     cs_version;
   50         int     cs_id;
   51         int     cs_base;
   52         int     cs_refcount;
   53         char    cs_to[ICONV_CSNMAXLEN];
   54         char    cs_from[ICONV_CSNMAXLEN];
   55 };
   56 
   57 /*
   58  * Parameters for 'add' sysctl
   59  */
   60 #define ICONV_ADD_VER   1
   61 
   62 struct iconv_add_in {
   63         int     ia_version;
   64         char    ia_converter[ICONV_CNVNMAXLEN];
   65         char    ia_to[ICONV_CSNMAXLEN];
   66         char    ia_from[ICONV_CSNMAXLEN];
   67         int     ia_datalen;
   68         const void *ia_data;
   69 };
   70 
   71 struct iconv_add_out {
   72         int     ia_csid;
   73 };
   74 
   75 #ifndef _KERNEL
   76 
   77 __BEGIN_DECLS
   78 
   79 int   kiconv_add_xlat_table(const char *, const char *, const u_char *);
   80 
   81 __END_DECLS
   82 
   83 #else /* !_KERNEL */
   84 
   85 #ifndef __NetBSD__
   86 #include <sys/kobj.h>
   87 #include <sys/queue.h>                  /* can't avoid that */
   88 #include <sys/sysctl.h>                 /* can't avoid that */
   89 
   90 struct iconv_cspair;
   91 struct iconv_cspairdata;
   92 
   93 /*
   94  * iconv converter class definition
   95  */
   96 struct iconv_converter_class {
   97         KOBJ_CLASS_FIELDS;
   98         TAILQ_ENTRY(iconv_converter_class)      cc_link;
   99 };
  100 
  101 struct iconv_cspair {
  102         int             cp_id;          /* unique id of charset pair */
  103         int             cp_refcount;    /* number of references from other pairs */
  104         const char *    cp_from;
  105         const char *    cp_to;
  106         void *          cp_data;
  107         struct iconv_converter_class * cp_dcp;
  108         struct iconv_cspair *cp_base;
  109         TAILQ_ENTRY(iconv_cspair)       cp_link;
  110 };
  111 
  112 #define KICONV_CONVERTER(name,size)                             \
  113     static DEFINE_CLASS(iconv_ ## name, iconv_ ## name ## _methods, (size)); \
  114     static moduledata_t iconv_ ## name ## _mod = {      \
  115         "iconv_"#name, iconv_converter_handler,         \
  116         (void*)&iconv_ ## name ## _class                \
  117     };                                                  \
  118     DECLARE_MODULE(iconv_ ## name, iconv_ ## name ## _mod, SI_SUB_DRIVERS, SI_ORDER_ANY);
  119 
  120 #define KICONV_CES(name,size)                           \
  121     static DEFINE_CLASS(iconv_ces_ ## name, iconv_ces_ ## name ## _methods, (size)); \
  122     static moduledata_t iconv_ces_ ## name ## _mod = {  \
  123         "iconv_ces_"#name, iconv_cesmod_handler,        \
  124         (void*)&iconv_ces_ ## name ## _class            \
  125     };                                                  \
  126     DECLARE_MODULE(iconv_ces_ ## name, iconv_ces_ ## name ## _mod, SI_SUB_DRIVERS, SI_ORDER_ANY);
  127 #endif /* !NetBSD */
  128 
  129 #ifdef MALLOC_DECLARE
  130 MALLOC_DECLARE(M_ICONV);
  131 #endif
  132 
  133 /*
  134  * Basic conversion functions
  135  */
  136 int iconv_open(const char *, const char *, void **);
  137 int iconv_close(void *);
  138 int iconv_conv(void *, const char **, size_t *, char **, size_t *);
  139 char *iconv_convstr(void *, char *, const char *, size_t);
  140 void *iconv_convmem(void *, void *, const void *, int);
  141 
  142 /*
  143  * Internal functions
  144  */
  145 int iconv_lookupcp(const char **, const char *);
  146 
  147 #ifndef __NetBSD__
  148 int iconv_converter_initstub(struct iconv_converter_class *);
  149 int iconv_converter_donestub(struct iconv_converter_class *);
  150 int iconv_converter_handler(module_t, int, void *);
  151 #endif /* !NetBSD */
  152 
  153 #ifdef ICONV_DEBUG
  154 #define ICDEBUG(format, ...) printf("%s: "format, __func__ , __VA_ARGS__)
  155 #else
  156 #define ICDEBUG(format, ...)
  157 #endif
  158 
  159 #endif /* !_KERNEL */
  160 
  161 #endif /* !_NETSMB_ICONV_H_ */

Cache object: 0411e95f01f14c81b30347bccc1d5c7a


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.