- code cleaned up
This commit is contained in:
@@ -28,25 +28,23 @@
|
|||||||
typedef struct private_child_sa_t private_child_sa_t;
|
typedef struct private_child_sa_t private_child_sa_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data of an child_sa_t object
|
* Private data of a child_sa_t object.
|
||||||
*/
|
*/
|
||||||
struct private_child_sa_t {
|
struct private_child_sa_t {
|
||||||
/**
|
/**
|
||||||
* Public part of a child_sa object
|
* Public interface of child_sa_t.
|
||||||
*/
|
*/
|
||||||
child_sa_t public;
|
child_sa_t public;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* type of this child sa, ESP or AH
|
* Type of this child sa, ESP or AH.
|
||||||
*/
|
*/
|
||||||
protocol_id_t sa_type;
|
protocol_id_t sa_type;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* implements child_sa_t.clone.
|
* Implementation of child_sa_t.get_spi.
|
||||||
*/
|
*/
|
||||||
static u_int32_t get_spi(private_child_sa_t *this)
|
static u_int32_t get_spi(private_child_sa_t *this)
|
||||||
{
|
{
|
||||||
@@ -54,7 +52,7 @@ static u_int32_t get_spi(private_child_sa_t *this)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* implements child_sa_t.clone.
|
* Implementation of child_sa_t.destroy.
|
||||||
*/
|
*/
|
||||||
static void destroy(private_child_sa_t *this)
|
static void destroy(private_child_sa_t *this)
|
||||||
{
|
{
|
||||||
@@ -62,21 +60,18 @@ static void destroy(private_child_sa_t *this)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Described in Header-File
|
* Described in header.
|
||||||
*/
|
*/
|
||||||
child_sa_t * child_sa_create(protocol_id_t sa_type, prf_plus_t *prf_plus)
|
child_sa_t * child_sa_create(protocol_id_t sa_type, prf_plus_t *prf_plus)
|
||||||
{
|
{
|
||||||
private_child_sa_t *this = allocator_alloc_thing(private_child_sa_t);
|
private_child_sa_t *this = allocator_alloc_thing(private_child_sa_t);
|
||||||
|
|
||||||
/* Public functions */
|
/* public functions */
|
||||||
this->public.get_spi = (u_int32_t(*)(child_sa_t*))get_spi;
|
this->public.get_spi = (u_int32_t(*)(child_sa_t*))get_spi;
|
||||||
this->public.destroy = (void(*)(child_sa_t*))destroy;
|
this->public.destroy = (void(*)(child_sa_t*))destroy;
|
||||||
|
|
||||||
/* private data */
|
/* private data */
|
||||||
this->sa_type = sa_type;
|
this->sa_type = sa_type;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (&this->public);
|
return (&this->public);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,24 +31,41 @@
|
|||||||
typedef struct child_sa_t child_sa_t;
|
typedef struct child_sa_t child_sa_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief Represents a CHILD_SA between to hosts.
|
||||||
|
*
|
||||||
|
* An IKE_SA must already be established.
|
||||||
|
*
|
||||||
|
* @b Constructors:
|
||||||
|
* - child_sa_create
|
||||||
|
*
|
||||||
* @ingroup sa
|
* @ingroup sa
|
||||||
*/
|
*/
|
||||||
struct child_sa_t {
|
struct child_sa_t {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the SPI value of this CHILD_SA.
|
||||||
|
*
|
||||||
|
* AH and ESP are using 4 byte SPI values.
|
||||||
|
*
|
||||||
|
* @param this calling object
|
||||||
|
* @return 4 Byte SPI value
|
||||||
|
*/
|
||||||
u_int32_t (*get_spi) (child_sa_t *this);
|
u_int32_t (*get_spi) (child_sa_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroys a child_sa.
|
* @brief Destroys a child_sa.
|
||||||
*
|
*
|
||||||
* @param this child_sa_t object
|
* @param this calling object
|
||||||
*/
|
*/
|
||||||
void (*destroy) (child_sa_t *this);
|
void (*destroy) (child_sa_t *this);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief Constructor to create a new CHILD_SA.
|
||||||
*
|
*
|
||||||
|
* @param protocol_id protocol id (AH or ESP) of CHILD_SA
|
||||||
|
* @param prf_plus prf_plus_t object use to derive shared secrets
|
||||||
|
* @return child_sa_t object
|
||||||
* @ingroup sa
|
* @ingroup sa
|
||||||
*/
|
*/
|
||||||
child_sa_t * child_sa_create(protocol_id_t protocol_id, prf_plus_t *prf_plus);
|
child_sa_t * child_sa_create(protocol_id_t protocol_id, prf_plus_t *prf_plus);
|
||||||
|
|||||||
Reference in New Issue
Block a user