Open SCAP Library: _sexp-datatype.h Source File

Open SCAP Library

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

_sexp-datatype.h
1 /*
2 * Copyright 2009 Red Hat Inc., Durham, North Carolina.
3 * All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Authors:
20 * "Daniel Kopecek" <dkopecek@redhat.com>
21 */
22
23 #pragma once
24 #ifndef _SEXP_DATATYPE
25 #define _SEXP_DATATYPE
26
27 #include "public/sexp-datatype.h"
28 #include "generic/rbt/rbt.h"
29 #include "../../../common/util.h"
30
31 OSCAP_HIDDEN_START;
32
33 struct SEXP_datatype {
34 uint16_t dt_flg;
35 uint8_t _dt[];
36 };
37
38 #define SEXP_DTFLG_LOCALDATA 0x01 /* whether a extended pointer should be used */
39 #define SEXP_DTFLG_HAVEDTOPS 0x02 /* whether there are defined some operations */
40
41 struct SEXP_datatype_ops {
42 uint16_t dt_opcnt;
43 SEXP_datatypeOP_t *dt_op;
44 };
45
46 struct SEXP_datatypeTbl {
47 rbt_t *tree;
48 };
49
50 /*
51 * Datatype pointer
52 */
53 typedef struct rbt_str_node SEXP_datatypePtr_t;
54
55 /*
56 * Extended datatype pointer
57 */
58 struct SEXP_datatype_extptr {
59 struct rbt_str_node *n; /* datatype tree node */
60 void *l; /* local data related to an S-exp reference */
61 };
62
63 typedef struct SEXP_datatype_extptr SEXP_datatypeExtptr_t;
64
65
66 const char *SEXP_datatype_name(SEXP_datatypePtr_t *p);
67
68 void SEXP_datatype_once(void);
69 void SEXP_datatypeGlobalTbl_init(void);
70 void SEXP_datatypeGlobalTbl_free(void);
71
72 SEXP_datatypeTbl_t *SEXP_datatypeTbl_new (void);
73 int SEXP_datatypeTbl_init(SEXP_datatypeTbl_t *t);
74 void SEXP_datatypeTbl_free(SEXP_datatypeTbl_t *t);
75
76 SEXP_datatypePtr_t *SEXP_datatype_get(SEXP_datatypeTbl_t *t, const char *name);
77 SEXP_datatypePtr_t *SEXP_datatype_add(SEXP_datatypeTbl_t *t, char *name, SEXP_datatype_t *d, void *l);
78 int SEXP_datatype_del(SEXP_datatypeTbl_t *t, const char *name);
79
80 #define SEXP_OP_CONTINUE 0 /* continue with the default handler */
81 #define SEXP_OP_ABORT 1 /* abort with an error status */
82 #define SEXP_OP_RETURN 2 /* return success, don't execute default handler */
83
84 #define SEXP_DATATYPEPTR_MASK (UINTPTR_MAX << 2)
85 #define SEXP_DATATYPEPTR_ALIGN (4 > sizeof(void *) ? 4 : sizeof (void *))
86
87 OSCAP_HIDDEN_END;
88
89 #endif /* _SEXP_DATATYPE */
SEXP_datatype
Definition: _sexp-datatype.h:33
SEXP_datatypeTbl
Definition: _sexp-datatype.h:46
rbt_str_node
Definition: rbt_str.h:27
rbt
Definition: rbt_common.h:129
SEXP_datatype_extptr
Definition: _sexp-datatype.h:58
SEXP_datatype_ops
Definition: _sexp-datatype.h:41