Debian Codegraph @

src/OVAL/probes/SEAP/_seap-packet.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_PACKET_H
25 #define _SEAP_PACKET_H
26
27 #include <stdint.h>
28 #include "_seap-message.h"
29 #include "_seap-command.h"
30 #include "_seap-error.h"
31 #include "../../../common/util.h"
32
33
34 #define SEAP_SYM_PREFIX "seap."
35 #define SEAP_SYM_MSG SEAP_SYM_PREFIX"msg"
36 #define SEAP_SYM_CMD SEAP_SYM_PREFIX"cmd"
37 #define SEAP_SYM_ERR SEAP_SYM_PREFIX"err"
38
39 #define SEAP_PACKET_INV 0x00 /* Invalid packet */
40 #define SEAP_PACKET_MSG 0x01 /* Message packet */
41 #define SEAP_PACKET_ERR 0x02 /* Error packet */
42 #define SEAP_PACKET_CMD 0x03 /* Command packet */
43 #define SEAP_PACKET_RAW 0x04 /* Raw packet */
44
45 struct SEAP_packet {
46 uint8_t type;
47 union {
48 SEAP_msg_t msg;
49 SEAP_err_t err;
50 SEAP_cmd_t cmd;
51 } data;
52 };
53 typedef struct SEAP_packet SEAP_packet_t;
54
55 SEAP_packet_t *SEAP_packet_new(void);
56 void SEAP_packet_free(SEAP_packet_t *packet);
57
58 void *SEAP_packet_settype(SEAP_packet_t *packet, uint8_t type);
59 uint8_t SEAP_packet_gettype(SEAP_packet_t *packet);
60
61 SEAP_msg_t *SEAP_packet_msg(SEAP_packet_t *packet);
62 SEAP_cmd_t *SEAP_packet_cmd(SEAP_packet_t *packet);
63 SEAP_err_t *SEAP_packet_err(SEAP_packet_t *packet);
64
65 int SEAP_packet_recv(SEAP_CTX_t *ctx, int sd, SEAP_packet_t **packet);
66 int SEAP_packet_recv_bytype(SEAP_CTX_t *ctx, int sd, SEAP_packet_t **packet, uint8_t type);
67 int SEAP_packet_send(SEAP_CTX_t *ctx, int sd, SEAP_packet_t *packet);
68 int SEAP_packet_enqueue(SEAP_CTX_t *ctx, int sd, SEAP_packet_t *packet);
69
70 #endif /* _SEAP_PACKET_H */