libimcv: Implemented IETF SW PA-TNC attributes
[strongswan.git] / src / libimcv / swima / swima_event.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 swima_event swima_event
18 * @{ @ingroup libimcv_swima
19 */
20
21 #ifndef SWIMA_EVENT_H_
22 #define SWIMA_EVENT_H_
23
24 #include "swima_record.h"
25
26 #include <library.h>
27
28 #define SWIMA_EVENT_ACTION_CREATION 1
29 #define SWIMA_EVENT_ACTION_DELETION 2
30 #define SWIMA_EVENT_ACTION_ALTERATION 3
31 #define SWIMA_EVENT_ACTION_LAST 3
32
33 typedef struct swima_event_t swima_event_t;
34
35 /**
36 * Class storing a Software [Identifier] event
37 */
38 struct swima_event_t {
39
40 /**
41 * Get Event ID and optionally the associated timestamp
42 *
43 * @param timestamp Timestamp associated with Event
44 * @return Event ID
45 */
46 uint32_t (*get_eid)(swima_event_t *this, chunk_t *timestamp);
47
48 /**
49 * Get Action associated with Event
50 *
51 * @return Action associated with event
52 */
53 uint8_t (*get_action)(swima_event_t *this);
54
55 /**
56 * Get Software [Identifier] record
57 *
58 * @return Software [Identifier] record
59 */
60 swima_record_t* (*get_sw_record)(swima_event_t *this);
61
62 /**
63 * Get a new reference to a swima_event object
64 *
65 * @return this, with an increased refcount
66 */
67 swima_event_t* (*get_ref)(swima_event_t *this);
68
69 /**
70 * Destroys a swima_event_t object.
71 */
72 void (*destroy)(swima_event_t *this);
73
74 };
75
76 /**
77 * Creates a swima_event_t object
78 *
79 * @param eid Event ID
80 * @param timestamp Time of Event
81 * @param action Action (CREATION, DELETION, ALTERATION)
82 * @param sw_record Software [Identifier] record
83 */
84 swima_event_t* swima_event_create(uint32_t eid, chunk_t timestamp,
85 uint8_t action, swima_record_t *sw_record);
86
87 #endif /** SWIMA_EVENT_H_ @}*/