- untested implementation of ike_sa_manager
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <freeswan.h>
|
||||
#include <pluto/constants.h>
|
||||
#include <pluto/defs.h>
|
||||
@@ -65,14 +66,16 @@ struct private_ike_sa_id_s {
|
||||
*/
|
||||
static status_t set_responder_spi (private_ike_sa_id_t *this, spi_t responder_spi)
|
||||
{
|
||||
if (this == NULL)
|
||||
{
|
||||
return FAILED;
|
||||
}
|
||||
this->responder_spi = responder_spi;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static status_t set_initiator_spi(private_ike_sa_id_t *this, spi_t initiator_spi)
|
||||
{
|
||||
this->initiator_spi = initiator_spi;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief implements function initiator_spi_is_set of ike_sa_id_t
|
||||
*/
|
||||
@@ -133,6 +136,19 @@ status_t replace_values (private_ike_sa_id_t *this, private_ike_sa_id_t *other)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief implements function ike_sa_id_t.get_values
|
||||
*/
|
||||
static status_t get_values(private_ike_sa_id_t *this, spi_t *initiator, spi_t *responder, ike_sa_role_t *role)
|
||||
{
|
||||
memcpy(initiator, &(this->initiator_spi), sizeof(initiator));
|
||||
memcpy(responder, &(this->responder_spi), sizeof(responder));
|
||||
*role = this->role;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief implements function clone of ike_sa_id_t
|
||||
*/
|
||||
@@ -174,10 +190,12 @@ ike_sa_id_t * ike_sa_id_create(spi_t initiator_spi, spi_t responder_spi, ike_sa_
|
||||
|
||||
/* Public functions */
|
||||
this->public.set_responder_spi = (status_t(*)(ike_sa_id_t*,spi_t)) set_responder_spi;
|
||||
this->public.set_initiator_spi = (status_t(*)(ike_sa_id_t*,spi_t)) set_initiator_spi;
|
||||
this->public.responder_spi_is_set = (bool(*)(ike_sa_id_t*)) responder_spi_is_set;
|
||||
this->public.initiator_spi_is_set = (bool(*)(ike_sa_id_t*)) initiator_spi_is_set;
|
||||
this->public.equals = (status_t(*)(ike_sa_id_t*,ike_sa_id_t*,bool*)) equals;
|
||||
this->public.replace_values = (status_t(*)(ike_sa_id_t*,ike_sa_id_t*)) replace_values;
|
||||
this->public.get_values = (status_t(*)(ike_sa_id_t*,spi_t*,spi_t*,ike_sa_role_t*)) get_values;
|
||||
this->public.clone = (status_t(*)(ike_sa_id_t*,ike_sa_id_t**)) clone;
|
||||
this->public.destroy = (status_t(*)(ike_sa_id_t*))destroy;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user