Define stroke counter types to implement
This commit is contained in:
@@ -15,6 +15,33 @@
|
|||||||
|
|
||||||
#include "stroke_counter.h"
|
#include "stroke_counter.h"
|
||||||
|
|
||||||
|
#include <threading/spinlock.h>
|
||||||
|
|
||||||
|
ENUM(stroke_counter_type_names,
|
||||||
|
COUNTER_INIT_IKE_SA_REKEY, COUNTER_OUT_INFORMATIONAL_RSP,
|
||||||
|
"ikeInitRekey",
|
||||||
|
"ikeRspRekey",
|
||||||
|
"ikeChildSaRekey",
|
||||||
|
"ikeInInvalid",
|
||||||
|
"ikeInInvalidSpi",
|
||||||
|
"ikeInInitReq",
|
||||||
|
"ikeInInitRsp",
|
||||||
|
"ikeOutInitReq",
|
||||||
|
"ikeOutInitRsp",
|
||||||
|
"ikeInAuthReq",
|
||||||
|
"ikeInAuthRsp",
|
||||||
|
"ikeOutAuthReq",
|
||||||
|
"ikeOutAuthRsp",
|
||||||
|
"ikeInCrChildReq",
|
||||||
|
"ikeInCrChildRsp",
|
||||||
|
"ikeOutCrChildReq",
|
||||||
|
"ikeOutCrChildRsp",
|
||||||
|
"ikeInInfoReq",
|
||||||
|
"ikeInInfoRsp",
|
||||||
|
"ikeOutInfoReq",
|
||||||
|
"ikeOutInfoRsp",
|
||||||
|
);
|
||||||
|
|
||||||
typedef struct private_stroke_counter_t private_stroke_counter_t;
|
typedef struct private_stroke_counter_t private_stroke_counter_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,11 +54,21 @@ struct private_stroke_counter_t {
|
|||||||
*/
|
*/
|
||||||
stroke_counter_t public;
|
stroke_counter_t public;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counter values
|
||||||
|
*/
|
||||||
|
u_int64_t counter[COUNTER_MAX];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lock for counter values
|
||||||
|
*/
|
||||||
|
spinlock_t *lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
METHOD(stroke_counter_t, destroy, void,
|
METHOD(stroke_counter_t, destroy, void,
|
||||||
private_stroke_counter_t *this)
|
private_stroke_counter_t *this)
|
||||||
{
|
{
|
||||||
|
this->lock->destroy(this->lock);
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,6 +83,7 @@ stroke_counter_t *stroke_counter_create()
|
|||||||
.public = {
|
.public = {
|
||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
|
.lock = spinlock_create(),
|
||||||
);
|
);
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
|
|||||||
@@ -24,6 +24,54 @@
|
|||||||
#include <bus/listeners/listener.h>
|
#include <bus/listeners/listener.h>
|
||||||
|
|
||||||
typedef struct stroke_counter_t stroke_counter_t;
|
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.
|
* Collection of counter values for different IKE events.
|
||||||
|
|||||||
Reference in New Issue
Block a user