Open SCAP Library
_seap-message.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_MESSAGE_H
25 #define _SEAP_MESSAGE_H
26 
27 #include <stdint.h>
28 #include "public/sexp-types.h"
29 #include "../../../common/util.h"
30 
31 #if SEAP_MSGID_BITS == 64
32 typedef uint64_t SEAP_msgid_t;
33 #else
34 typedef uint32_t SEAP_msgid_t;
35 #endif
36 
37 struct SEAP_attr {
38  char *name;
39  SEXP_t *value;
40 };
41 
42 typedef struct SEAP_attr SEAP_attr_t;
43 
44 struct SEAP_msg {
45  SEAP_msgid_t id;
46  SEAP_attr_t *attrs;
47  uint16_t attrs_cnt;
48  SEXP_t *sexp;
49 };
50 
51 typedef struct SEAP_msg SEAP_msg_t;
52 
53 SEAP_msg_t *SEAP_msg_new(void);
54 SEAP_msg_t *SEAP_msg_clone(SEAP_msg_t *msg);
55 void SEAP_msg_free(SEAP_msg_t *msg);
56 
57 SEAP_msgid_t SEAP_msg_id(SEAP_msg_t *msg);
58 
59 int SEAP_msg_set(SEAP_msg_t *msg, SEXP_t *sexp);
60 void SEAP_msg_unset(SEAP_msg_t *msg);
61 SEXP_t *SEAP_msg_get(SEAP_msg_t *msg);
62 
63 int SEAP_msgattr_set(SEAP_msg_t *msg, const char *name, SEXP_t *value);
64 bool SEAP_msgattr_exists(SEAP_msg_t *msg, const char *name);
65 
66 #endif /* _SEAP_MESSAGE_H */
Definition: _seap-message.h:37
Definition: _seap-message.h:44
Definition: sexp-types.h:82