Merge branch 'swima-reserved'
[strongswan.git] / src / libimcv / swima / swima_events.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_events swima_events
18 * @{ @ingroup libimcv_swima
19 */
20
21 #ifndef SWIMA_EVENTS_H_
22 #define SWIMA_EVENTS_H_
23
24 #define SWIMA_MAX_ATTR_SIZE 10000000
25
26 #include "swima_event.h"
27
28 #include <library.h>
29
30 typedef struct swima_events_t swima_events_t;
31
32 /**
33 * Class managing list of Software [Identifier] Events
34 */
35 struct swima_events_t {
36
37 /**
38 * Add event to list
39 *
40 * @param event Event to be added
41 */
42 void (*add)(swima_events_t *this, swima_event_t *event);
43
44 /**
45 * Get the number of events in the event list
46 *
47 * @return Number of events
48 */
49 int (*get_count)(swima_events_t *this);
50
51 /**
52 * Set both the Last and Last Consulted Event ID
53 *
54 * @param Last [Consulted] Event ID
55 * @param Epoch of event IDs
56 */
57 void (*set_eid)(swima_events_t *this, uint32_t eid, uint32_t epoch);
58
59 /**
60 * Set Last Event ID if different from Last Consulted Event ID
61 *
62 * @param last_eid Last Event ID
63 */
64 void (*set_last_eid)(swima_events_t *this, uint32_t last_eid);
65
66 /**
67 * Get both the Last and Last Consulted Event ID
68 *
69 * @param eid_epoch Event ID Epoch
70 * @param last_eid Last Event ID
71 * @return Last Consulted Event ID
72 */
73 uint32_t (*get_eid)(swima_events_t *this, uint32_t *epoch, uint32_t *last_eid);
74
75 /**
76 * Create an event enumerator
77 *
78 * @return Enumerator returning events
79 */
80 enumerator_t* (*create_enumerator)(swima_events_t *this);
81
82 /**
83 * Get a new reference to a swima_events object
84 *
85 * @return this, with an increased refcount
86 */
87 swima_events_t* (*get_ref)(swima_events_t *this);
88
89 /**
90 * Clears the events, keeping the eid and epoch values.
91 */
92 void (*clear)(swima_events_t *this);
93
94 /**
95 * Destroys a swima_events_t object.
96 */
97 void (*destroy)(swima_events_t *this);
98
99 };
100
101 /**
102 * Creates a swima_events_t object
103 */
104 swima_events_t* swima_events_create(void);
105
106 #endif /** SWIMA_EVENTS_H_ @}*/