Skip to content

Commit 9f96603

Browse files
committed
Drop seap-types.h
It was not possible to just put everything in _seap-types.h. Instead, we had to move some type definitions between the headers to prevent circular dpendencies of header files.
1 parent 92aab09 commit 9f96603

File tree

7 files changed

+51
-91
lines changed

7 files changed

+51
-91
lines changed

src/OVAL/oval_probe_impl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#ifndef OVAL_PROBE_IMPL_H
3333
#define OVAL_PROBE_IMPL_H
3434

35-
#include <seap-types.h>
3635
#include "oval_definitions_impl.h"
3736
#include "oval_agent_api_impl.h"
3837
#include "oval_parser_impl.h"

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

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,10 @@
2929
#include <pthread.h>
3030

3131
#include "_sexp-types.h"
32-
#include "public/seap-types.h"
32+
#include "_seap-types.h"
3333
#include "../../../common/util.h"
3434

3535

36-
typedef uint8_t SEAP_cmdclass_t;
37-
typedef uint16_t SEAP_cmdcode_t;
38-
typedef uint16_t SEAP_cmdid_t;
39-
typedef uint8_t SEAP_cmdtype_t;
40-
typedef SEXP_t * (*SEAP_cmdfn_t) (SEXP_t *, void *);
41-
4236
#define SEAP_CMDCLASS_INT 1
4337
#define SEAP_CMDCLASS_USR 2
4438

@@ -70,6 +64,7 @@ struct SEAP_cmd {
7064
SEAP_cmdcode_t code;
7165
SEXP_t *args;
7266
};
67+
typedef struct SEAP_cmd SEAP_cmd_t;
7368

7469
struct SEAP_synchelper {
7570
SEXP_t *args;
@@ -81,15 +76,6 @@ struct SEAP_synchelper {
8176
#define SEAP_CMDTBL_LARGE 0x01
8277
#define SEAP_CMDTBL_LARGE_TRESHOLD 32
8378

84-
typedef struct {
85-
uint8_t flags;
86-
void *table;
87-
size_t maxcnt;
88-
#if defined(SEAP_THREAD_SAFE)
89-
pthread_rwlock_t lock;
90-
#endif
91-
} SEAP_cmdtbl_t;
92-
9379
typedef struct {
9480
SEAP_cmdcode_t code;
9581
SEAP_cmdfn_t func;
@@ -115,8 +101,6 @@ int SEAP_cmdtbl_cmp (SEAP_cmdrec_t *a, SEAP_cmdrec_t *b);
115101
SEAP_cmdrec_t *SEAP_cmdrec_new (void);
116102
void SEAP_cmdrec_free (SEAP_cmdrec_t *r);
117103

118-
typedef uint8_t SEAP_cflags_t;
119-
120104
#define SEAP_CFLG_THREAD 0x01
121105
#define SEAP_CFLG_WATCH 0x02
122106

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

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,27 @@
2525
#define _SEAP_TYPES_H
2626

2727
#include <stdint.h>
28-
#include "public/seap-types.h"
2928
#include "_sexp-types.h"
30-
#include "_seap-command.h"
31-
#include "seap-descriptor.h"
3229
#include "../../../common/util.h"
30+
#include "generic/rbt/rbt_common.h"
31+
#include "generic/bitmap.h"
32+
#include "oval_types.h"
3333

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;
3449

3550
/* SEAP context */
3651
struct SEAP_CTX {
@@ -44,6 +59,35 @@ struct SEAP_CTX {
4459
uint16_t send_timeout;
4560
oval_subtype_t subtype;
4661
};
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 */
4788

89+
/* SEAP I/O flags */
90+
#define SEAP_IOFL_RECONN 0x00000001 /* Try to reconnect */
91+
#define SEAP_IOFL_NONBLOCK 0x00000002 /* Non-blocking mode */
4892

4993
#endif /* _SEAP_TYPES_H */

src/OVAL/probes/SEAP/_seap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "_seap-message.h"
2828
#include "sch_queue.h"
2929
#include "../../../common/util.h"
30+
#include "_seap-types.h"
3031

3132
#ifndef EOPNOTSUPP
3233
# define EOPNOTSUPP 1001

src/OVAL/probes/SEAP/public/seap-types.h

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/OVAL/probes/SEAP/seap-descriptor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ typedef struct {
6666
#define SEAP_DESC_FDOUT 0x00000002
6767
#define SEAP_DESC_SELF -1
6868

69-
typedef struct {
70-
rbt_t *tree;
71-
bitmap_t *bmap;
72-
} SEAP_desctable_t;
73-
7469
#define SEAP_DESCTBL_INITIALIZER { NULL, NULL }
7570

7671
#define SEAP_BUFFER_SIZE 2*4096

src/OVAL/probes/SEAP/seap-message.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "_sexp-types.h"
3030
#include "_seap-types.h"
3131
#include "_seap-message.h"
32+
#include "_sexp-manip.h"
3233
#include "debug_priv.h"
3334

3435
SEAP_msg_t *SEAP_msg_new (void)

0 commit comments

Comments
 (0)