libimcv: Implemented IETF SW PA-TNC attributes
[strongswan.git] / src / libimcv / ietf / swima / ietf_swima_attr_sw_ev.h
1 /*
2 * Copyright (C) 2017 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup ietf_swima_attr_sw_ev ietf_swima_attr_sw_ev
18 * @{ @ingroup ietf_attr
19 */
20
21 #ifndef IETF_SWIMA_ATTR_SW_EV_H_
22 #define IETF_SWIMA_ATTR_SW_EV_H_
23
24 #define IETF_SWIMA_SW_EV_MIN_SIZE 20
25
26 typedef struct ietf_swima_attr_sw_ev_t ietf_swima_attr_sw_ev_t;
27 typedef enum ietf_swima_attr_sw_ev_flag_t ietf_swima_attr_sw_ev_flag_t;
28
29 enum ietf_swima_attr_sw_ev_flag_t {
30 IETF_SWIMA_ATTR_SW_EV_FLAG_NONE = 0,
31 IETF_SWIMA_ATTR_SW_EV_FLAG_S_F = (1 << 7)
32 };
33
34 #include "ietf/ietf_attr.h"
35 #include "swima/swima_events.h"
36 #include "pa_tnc/pa_tnc_attr.h"
37
38 /**
39 * Class implementing the IETF SW Identifier Inventory attribute
40 *
41 */
42 struct ietf_swima_attr_sw_ev_t {
43
44 /**
45 * Public PA-TNC attribute interface
46 */
47 pa_tnc_attr_t pa_tnc_attribute;
48
49 /**
50 * Get Software Inventory flags
51 *
52 * @return Flags
53 */
54 uint8_t (*get_flags)(ietf_swima_attr_sw_ev_t *this);
55
56 /**
57 * Get Request ID
58 *
59 * @return Request ID
60 */
61 uint32_t (*get_request_id)(ietf_swima_attr_sw_ev_t *this);
62
63 /**
64 * Get number of Software [Identifier] Events
65 *
66 * @return Software [Identifier] event count
67 */
68 uint32_t (*get_event_count)(ietf_swima_attr_sw_ev_t *this);
69
70 /**
71 * Add Software [Identifier] Events
72 *
73 * @param sw_events List of Software [Identifier] events to be added
74 */
75 void (*set_events)(ietf_swima_attr_sw_ev_t *this,
76 swima_events_t *sw_events);
77 /**
78 * Get Software [Identifier] Events
79 *
80 * @result Software [Identifier] events
81 */
82 swima_events_t* (*get_events)(ietf_swima_attr_sw_ev_t *this);
83
84 /**
85 * Remove all Software [Identifier] events
86 */
87 void (*clear_events)(ietf_swima_attr_sw_ev_t *this);
88
89 };
90
91 /**
92 * Creates an ietf_swima_attr_sw_ev_t object
93 *
94 * @param flags Sets the flags
95 * @param request_id Copy of the Request ID
96 * @param sw_id_only TRUE if the Software ID, only is transmitted
97 */
98 pa_tnc_attr_t* ietf_swima_attr_sw_ev_create(uint8_t flags, uint32_t request_id,
99 bool sw_id_only);
100
101 /**
102 * Creates an ietf_swima_attr_sw_ev_t object from received data
103 *
104 * @param length Total length of attribute value
105 * @param value Unparsed attribute value (might be a segment)
106 * @param sw_id_only TRUE if the Software ID, only is transmitted
107 */
108 pa_tnc_attr_t* ietf_swima_attr_sw_ev_create_from_data(size_t length,
109 chunk_t value, bool sw_id_only);
110
111 #endif /** IETF_SWIMA_ATTR_SW_EV_H_ @}*/