Debian Codegraph @

src/OVAL/probes/SEAP/_seap-types.h

raw symbols SCIP
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Authors:
20 * "Daniel Kopecek" <[email protected]>
21 */
22
23 #pragma once
24 #ifndef _SEAP_TYPES_H
25 #define _SEAP_TYPES_H
26
27 #include <stdint.h>
28 #include "_sexp-types.h"
29 #include "../../../common/util.h"
30 #include "generic/rbt/rbt_common.h"
31 #include "generic/bitmap.h"
32 #include "oval_types.h"
33
34 typedef uint8_t SEAP_cflags_t;
35
36 typedef struct {
37 rbt_t *tree;
38 bitmap_t *bmap;
39 } SEAP_desctable_t;
40
41 typedef struct {
42 uint8_t flags;
43 void *table;
44 size_t maxcnt;
45 #if defined(SEAP_THREAD_SAFE)
46 pthread_rwlock_t lock;
47 #endif
48 } SEAP_cmdtbl_t;
49
50 /* SEAP context */
51 struct SEAP_CTX {
52 SEXP_format_t fmt_in;
53 SEXP_format_t fmt_out;
54 SEAP_desctable_t *sd_table;
55 SEAP_cmdtbl_t *cmd_c_table;
56 SEAP_cflags_t cflags;
57
58 uint16_t recv_timeout;
59 uint16_t send_timeout;
60 oval_subtype_t subtype;
61 };
62 typedef struct SEAP_CTX SEAP_CTX_t;
63
64 typedef uint8_t SEAP_cmdclass_t;
65 typedef uint16_t SEAP_cmdcode_t;
66 typedef uint16_t SEAP_cmdid_t;
67 typedef uint8_t SEAP_cmdtype_t;
68 typedef SEXP_t * (*SEAP_cmdfn_t) (SEXP_t *, void *);
69
70 #define SEAP_CTX_INITIALIZER { NULL, 0, 0, 0, SEAP_DESCTBL_INITIALIZER, SEAP_CMDTABLE_INITIALIZER }
71
72 /* SEAP errors */
73 #define SEAP_ETYPE_INT 0 /* Internal error */
74 #define SEAP_ETYPE_USER 1 /* User-defined error */
75
76 #define SEAP_EUNFIN 1 /* Can't finish parsing */
77 #define SEAP_EPARSE 2 /* Parsing error */
78 #define SEAP_ECLOSE 3 /* Connection close */
79 #define SEAP_EINVAL 4 /* Invalid argument */
80 #define SEAP_ENOMEM 5 /* Cannot allocate memory */
81 #define SEAP_EMSEXP 6 /* Missing required S-exp/value */
82 #define SEAP_EMATTR 7 /* Missing required attribute */
83 #define SEAP_EUNEXP 8 /* Unexpected error */
84 #define SEAP_EUSER 9 /* User-defined error */
85 #define SEAP_ENOCMD 10 /* Unknown cmd */
86 #define SEAP_EQFULL 11 /* Queue full */
87 #define SEAP_EUNKNOWN 255 /* Unknown/Unexpected error */
88
89 /* SEAP I/O flags */
90 #define SEAP_IOFL_RECONN 0x00000001 /* Try to reconnect */
91 #define SEAP_IOFL_NONBLOCK 0x00000002 /* Non-blocking mode */
92
93 #endif /* _SEAP_TYPES_H */