Merge branch 'swima-reserved'
[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_NONE 0
29 #define SWIMA_EVENT_ACTION_CREATION 1
30 #define SWIMA_EVENT_ACTION_DELETION 2
31 #define SWIMA_EVENT_ACTION_ALTERATION 3
32 #define SWIMA_EVENT_ACTION_LAST 3
33
34 typedef struct swima_event_t swima_event_t;
35
36 /**
37 * Class storing a Software [Identifier] event
38 */
39 struct swima_event_t {
40
41 /**
42 * Get Event ID and optionally the associated timestamp
43 *
44 * @param timestamp Timestamp associated with Event
45 * @return Event ID
46 */
47 uint32_t (*get_eid)(swima_event_t *this, chunk_t *timestamp);
48
49 /**
50 * Get Action associated with Event
51 *
52 * @return Action associated with event
53 */
54 uint8_t (*get_action)(swima_event_t *this);
55
56 /**
57 * Get Software [Identifier] record
58 *
59 * @return Software [Identifier] record
60 */
61 swima_record_t* (*get_sw_record)(swima_event_t *this);
62
63 /**
64 * Get a new reference to a swima_event object
65 *
66 * @return this, with an increased refcount
67 */
68 swima_event_t* (*get_ref)(swima_event_t *this);
69
70 /**
71 * Destroys a swima_event_t object.
72 */
73 void (*destroy)(swima_event_t *this);
74
75 };
76
77 /**
78 * Creates a swima_event_t object
79 *
80 * @param eid Event ID
81 * @param timestamp Time of Event
82 * @param action Action (CREATION, DELETION, ALTERATION)
83 * @param sw_record Software [Identifier] record
84 */
85 swima_event_t* swima_event_create(uint32_t eid, chunk_t timestamp,
86 uint8_t action, swima_record_t *sw_record);
87
88 #endif /** SWIMA_EVENT_H_ @}*/