Remove building with NOCRYPTO option
[minix3.git] / lib / libc / citrus / citrus_mapper_local.h
blob4861e6655c6654f4484d8dab9a60bb7e0664b5b2
1 /* $NetBSD: citrus_mapper_local.h,v 1.2 2008/02/09 14:56:20 junyoung Exp $ */
3 /*-
4 * Copyright (c)2003 Citrus Project,
5 * All rights reserved.
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.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
29 #ifndef _CITRUS_MAPPER_LOCAL_H_
30 #define _CITRUS_MAPPER_LOCAL_H_
32 #define _CITRUS_MAPPER_GETOPS_FUNC_BASE(_n_) \
33 int _n_(struct _citrus_mapper_ops *, size_t, uint32_t)
34 #define _CITRUS_MAPPER_GETOPS_FUNC(_n_) \
35 _CITRUS_MAPPER_GETOPS_FUNC_BASE(_citrus_##_n_##_mapper_getops)
37 #define _CITRUS_MAPPER_DECLS(_m_) \
38 static int _citrus_##_m_##_mapper_init \
39 (struct _citrus_mapper_area *__restrict, \
40 struct _citrus_mapper * __restrict, const char * __restrict, \
41 const void * __restrict, size_t, \
42 struct _citrus_mapper_traits * __restrict, size_t); \
43 static void _citrus_##_m_##_mapper_uninit(struct _citrus_mapper *); \
44 static int _citrus_##_m_##_mapper_convert \
45 (struct _citrus_mapper * __restrict, \
46 _citrus_index_t * __restrict, _citrus_index_t, \
47 void * __restrict); \
48 static void _citrus_##_m_##_mapper_init_state \
49 (struct _citrus_mapper * __restrict, void * __restrict);
51 #define _CITRUS_MAPPER_DEF_OPS(_m_) \
52 struct _citrus_mapper_ops _citrus_##_m_##_mapper_ops = { \
53 /* mo_abi_version */ _CITRUS_MAPPER_ABI_VERSION, \
54 /* mo_init */ &_citrus_##_m_##_mapper_init, \
55 /* mo_uninit */ &_citrus_##_m_##_mapper_uninit, \
56 /* mo_convert */ &_citrus_##_m_##_mapper_convert, \
57 /* mo_init_state */ &_citrus_##_m_##_mapper_init_state \
60 typedef _CITRUS_MAPPER_GETOPS_FUNC_BASE((*_citrus_mapper_getops_t));
61 typedef int (*_citrus_mapper_init_t)(
62 struct _citrus_mapper_area *__restrict,
63 struct _citrus_mapper *__restrict, const char *__restrict,
64 const void *__restrict, size_t,
65 struct _citrus_mapper_traits * __restrict, size_t);
66 typedef void (*_citrus_mapper_uninit_t)(struct _citrus_mapper *);
67 typedef int (*_citrus_mapper_convert_t)(struct _citrus_mapper * __restrict,
68 _citrus_index_t * __restrict,
69 _citrus_index_t,
70 void * __restrict);
71 typedef void (*_citrus_mapper_init_state_t)(
72 struct _citrus_mapper * __restrict, void * __restrict);
75 * ABI version change log
76 * 0x00000001
77 * initial version
79 #define _CITRUS_MAPPER_ABI_VERSION 0x00000001
80 struct _citrus_mapper_ops {
81 uint32_t mo_abi_version;
82 /* version 0x00000001 */
83 _citrus_mapper_init_t mo_init;
84 _citrus_mapper_uninit_t mo_uninit;
85 _citrus_mapper_convert_t mo_convert;
86 _citrus_mapper_init_state_t mo_init_state;
89 struct _citrus_mapper_traits {
90 /* version 0x00000001 */
91 size_t mt_state_size;
92 size_t mt_src_max;
93 size_t mt_dst_max;
96 struct _citrus_mapper {
97 struct _citrus_mapper_ops *cm_ops;
98 void *cm_closure;
99 _citrus_module_t cm_module;
100 struct _citrus_mapper_traits *cm_traits;
101 _CITRUS_HASH_ENTRY(_citrus_mapper) cm_entry;
102 int cm_refcount;
103 char *cm_key;
105 #endif