Open SCAP Library
Loading...
Searching...
No Matches
_seap-packet.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Authors:
20 * "Daniel Kopecek" <dkopecek@redhat.com>
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
46 uint8_t type;
47 union {
48 SEAP_msg_t msg;
49 SEAP_err_t err;
50 SEAP_cmd_t cmd;
51 } data;
52};
53typedef struct SEAP_packet SEAP_packet_t;
54
55SEAP_packet_t *SEAP_packet_new(void);
56void SEAP_packet_free(SEAP_packet_t *packet);
57
58void *SEAP_packet_settype(SEAP_packet_t *packet, uint8_t type);
59uint8_t SEAP_packet_gettype(SEAP_packet_t *packet);
60
61SEAP_msg_t *SEAP_packet_msg(SEAP_packet_t *packet);
62SEAP_cmd_t *SEAP_packet_cmd(SEAP_packet_t *packet);
63SEAP_err_t *SEAP_packet_err(SEAP_packet_t *packet);
64
65int SEAP_packet_recv(SEAP_CTX_t *ctx, int sd, SEAP_packet_t **packet);
66int SEAP_packet_recv_bytype(SEAP_CTX_t *ctx, int sd, SEAP_packet_t **packet, uint8_t type);
67int SEAP_packet_send(SEAP_CTX_t *ctx, int sd, SEAP_packet_t *packet);
68int SEAP_packet_enqueue(SEAP_CTX_t *ctx, int sd, SEAP_packet_t *packet);
69
70#endif /* _SEAP_PACKET_H */
Definition _seap-types.h:51
Definition _seap-command.h:59
Definition _seap-error.h:31
Definition _seap-message.h:44
Definition _seap-packet.h:45