1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/*
* Copyright (C) 2012 Martin Willi
* Copyright (C) 2012 revosec AG
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
* @defgroup stroke_counter stroke_counter
* @{ @ingroup stroke
*/
#ifndef STROKE_COUNTER_H_
#define STROKE_COUNTER_H_
#include <bus/listeners/listener.h>
typedef struct stroke_counter_t stroke_counter_t;
typedef enum stroke_counter_type_t stroke_counter_type_t;
enum stroke_counter_type_t {
/** initiated IKE_SA rekeyings */
COUNTER_INIT_IKE_SA_REKEY,
/** responded IKE_SA rekeyings */
COUNTER_RESP_IKE_SA_REKEY,
/** completed CHILD_SA rekeyings */
COUNTER_CHILD_SA_REKEY,
/** messages with invalid types, length, or a value out of range */
COUNTER_IN_INVALID,
/** messages with an invalid IKE SPI */
COUNTER_IN_INVALID_IKE_SPI,
/** received IKE_SA_INIT requests */
COUNTER_IN_IKE_SA_INIT_REQ,
/** received IKE_SA_INIT responses */
COUNTER_IN_IKE_SA_INIT_RSP,
/** sent IKE_SA_INIT requests */
COUNTER_OUT_IKE_SA_INIT_REQ,
/** sent IKE_SA_INIT responses */
COUNTER_OUT_IKE_SA_INIT_RES,
/** received IKE_AUTH requests */
COUNTER_IN_IKE_AUTH_REQ,
/** received IKE_AUTH responses */
COUNTER_IN_IKE_AUTH_RSP,
/** sent IKE_AUTH requests */
COUNTER_OUT_IKE_AUTH_REQ,
/** sent IKE_AUTH responses */
COUNTER_OUT_IKE_AUTH_RSP,
/** received CREATE_CHILD_SA requests */
COUNTER_IN_CREATE_CHILD_SA_REQ,
/** received CREATE_CHILD_SA responses */
COUNTER_IN_CREATE_CHILD_SA_RSP,
/** sent CREATE_CHILD_SA requests */
COUNTER_OUT_CREATE_CHILD_SA_REQ,
/** sent CREATE_CHILD_SA responses */
COUNTER_OUT_CREATE_CHILD_SA_RSP,
/** received INFORMATIONAL requests */
COUNTER_IN_INFORMATIONAL_REQ,
/** received INFORMATIONAL responses */
COUNTER_IN_INFORMATIONAL_RSP,
/** sent INFORMATIONAL requests */
COUNTER_OUT_INFORMATIONAL_REQ,
/** sent INFORMATIONAL responses */
COUNTER_OUT_INFORMATIONAL_RSP,
/** number of counter types */
COUNTER_MAX
};
/**
* Collection of counter values for different IKE events.
*/
struct stroke_counter_t {
/**
* Implements listener_t.
*/
listener_t listener;
/**
* Print counter values to an output stream.
*
* @param out output stream to write to
*/
void (*print)(stroke_counter_t *this, FILE *out);
/**
* Destroy a stroke_counter_t.
*/
void (*destroy)(stroke_counter_t *this);
};
/**
* Create a stroke_counter instance.
*/
stroke_counter_t *stroke_counter_create();
#endif /** STROKE_COUNTER_H_ @}*/
|