Open SCAP Library

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., 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 SEAP_PACKET_H
25 #define SEAP_PACKET_H
26
27 #include <seap-message.h>
28 #include <seap-command.h>
29 #include <seap-error.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 typedef struct SEAP_packet SEAP_packet_t;
36
37 #define SEAP_PACKET_INV 0x00 /* Invalid packet */
38 #define SEAP_PACKET_MSG 0x01 /* Message packet */
39 #define SEAP_PACKET_ERR 0x02 /* Error packet */
40 #define SEAP_PACKET_CMD 0x03 /* Command packet */
41 #define SEAP_PACKET_RAW 0x04 /* Raw packet */
42
43 SEAP_packet_t *SEAP_packet_new (void);
44 void SEAP_packet_free (SEAP_packet_t *packet);
45
46 void *SEAP_packet_settype (SEAP_packet_t *packet, uint8_t type);
47 uint8_t SEAP_packet_gettype (SEAP_packet_t *packet);
48
49 SEAP_msg_t *SEAP_packet_msg (SEAP_packet_t *packet);
50 SEAP_cmd_t *SEAP_packet_cmd (SEAP_packet_t *packet);
51 SEAP_err_t *SEAP_packet_err (SEAP_packet_t *packet);
52
53 int SEAP_packet_recv (SEAP_CTX_t *ctx, int sd, SEAP_packet_t **packet);
54 int SEAP_packet_recv_bytype (SEAP_CTX_t *ctx, int sd, SEAP_packet_t **packet, uint8_t type);
55 int SEAP_packet_send (SEAP_CTX_t *ctx, int sd, SEAP_packet_t *packet);
56 int SEAP_packet_enqueue (SEAP_CTX_t *ctx, int sd, SEAP_packet_t *packet);
57
58 #ifdef __cplusplus
59 }
60 #endif
61
62 #endif /* SEAP_PACKET_H */
SEAP_CTX
Definition: _seap-types.h:37
SEAP_packet
Definition: _seap-packet.h:41
SEAP_cmd
Definition: _seap-command.h:49
SEAP_err
Definition: seap-error.h:33
SEAP_msg
Definition: _seap-message.h:39