mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-09 00:00:53 -04:00
- role refactored to is_initiator-boolean
- spi_t is a u_int64_t now
This commit is contained in:
parent
e4a5b14f58
commit
471ade02fc
@ -55,7 +55,7 @@ struct private_ike_sa_id_s {
|
|||||||
/**
|
/**
|
||||||
* Role for specific IKE_SA
|
* Role for specific IKE_SA
|
||||||
*/
|
*/
|
||||||
ike_sa_role_t role;
|
bool is_initiator;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ static status_t set_initiator_spi(private_ike_sa_id_t *this, spi_t initiator_spi
|
|||||||
*/
|
*/
|
||||||
static bool initiator_spi_is_set (private_ike_sa_id_t *this)
|
static bool initiator_spi_is_set (private_ike_sa_id_t *this)
|
||||||
{
|
{
|
||||||
return (!((this->initiator_spi.high == 0) && (this->initiator_spi.low == 0)));
|
return (!(this->initiator_spi == 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,7 +88,7 @@ static bool initiator_spi_is_set (private_ike_sa_id_t *this)
|
|||||||
*/
|
*/
|
||||||
static bool responder_spi_is_set (private_ike_sa_id_t *this)
|
static bool responder_spi_is_set (private_ike_sa_id_t *this)
|
||||||
{
|
{
|
||||||
return (!((this->responder_spi.high == 0) && (this->responder_spi.low == 0)));
|
return (!(this->responder_spi == 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,11 +100,9 @@ static status_t equals (private_ike_sa_id_t *this,private_ike_sa_id_t *other, bo
|
|||||||
{
|
{
|
||||||
return FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
if ( (this->role == other->role) &&
|
if ((this->is_initiator == other->is_initiator) &&
|
||||||
(this->initiator_spi.high == other->initiator_spi.high) &&
|
(this->initiator_spi == other->initiator_spi) &&
|
||||||
(this->initiator_spi.low == other->initiator_spi.low) &&
|
(this->responder_spi == other->responder_spi))
|
||||||
(this->responder_spi.high == other->responder_spi.high) &&
|
|
||||||
(this->responder_spi.low == other->responder_spi.low))
|
|
||||||
{
|
{
|
||||||
/* private_ike_sa_id's are equal */
|
/* private_ike_sa_id's are equal */
|
||||||
*are_equal = TRUE;
|
*are_equal = TRUE;
|
||||||
@ -130,7 +128,7 @@ status_t replace_values (private_ike_sa_id_t *this, private_ike_sa_id_t *other)
|
|||||||
|
|
||||||
this->initiator_spi = other->initiator_spi;
|
this->initiator_spi = other->initiator_spi;
|
||||||
this->responder_spi = other->responder_spi;
|
this->responder_spi = other->responder_spi;
|
||||||
this->role = other->role;
|
this->is_initiator = other->is_initiator;
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
@ -138,11 +136,11 @@ status_t replace_values (private_ike_sa_id_t *this, private_ike_sa_id_t *other)
|
|||||||
/**
|
/**
|
||||||
* @brief implements function ike_sa_id_t.get_values
|
* @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)
|
static status_t get_values(private_ike_sa_id_t *this, spi_t *initiator, spi_t *responder, bool *is_initiator)
|
||||||
{
|
{
|
||||||
memcpy(initiator, &(this->initiator_spi), sizeof(initiator));
|
memcpy(initiator, &(this->initiator_spi), sizeof(initiator));
|
||||||
memcpy(responder, &(this->responder_spi), sizeof(responder));
|
memcpy(responder, &(this->responder_spi), sizeof(responder));
|
||||||
*role = this->role;
|
*is_initiator = this->is_initiator;
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
@ -153,7 +151,7 @@ static status_t get_values(private_ike_sa_id_t *this, spi_t *initiator, spi_t *r
|
|||||||
*/
|
*/
|
||||||
static status_t clone (private_ike_sa_id_t *this, ike_sa_id_t **clone_of_this)
|
static status_t clone (private_ike_sa_id_t *this, ike_sa_id_t **clone_of_this)
|
||||||
{
|
{
|
||||||
*clone_of_this = ike_sa_id_create(this->initiator_spi, this->responder_spi, this->role);
|
*clone_of_this = ike_sa_id_create(this->initiator_spi, this->responder_spi, this->is_initiator);
|
||||||
|
|
||||||
return (*clone_of_this == NULL) ? OUT_OF_RES : SUCCESS;
|
return (*clone_of_this == NULL) ? OUT_OF_RES : SUCCESS;
|
||||||
}
|
}
|
||||||
@ -170,7 +168,7 @@ static status_t destroy (private_ike_sa_id_t *this)
|
|||||||
/*
|
/*
|
||||||
* Described in Header-File
|
* Described in Header-File
|
||||||
*/
|
*/
|
||||||
ike_sa_id_t * ike_sa_id_create(spi_t initiator_spi, spi_t responder_spi, ike_sa_role_t role)
|
ike_sa_id_t * ike_sa_id_create(spi_t initiator_spi, spi_t responder_spi, bool is_initiator)
|
||||||
{
|
{
|
||||||
private_ike_sa_id_t *this = allocator_alloc_thing(private_ike_sa_id_t);
|
private_ike_sa_id_t *this = allocator_alloc_thing(private_ike_sa_id_t);
|
||||||
if (this == NULL)
|
if (this == NULL)
|
||||||
@ -185,14 +183,14 @@ ike_sa_id_t * ike_sa_id_create(spi_t initiator_spi, spi_t responder_spi, ike_sa_
|
|||||||
this->public.initiator_spi_is_set = (bool(*)(ike_sa_id_t*)) initiator_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.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.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.get_values = (status_t(*)(ike_sa_id_t*,spi_t*,spi_t*,bool*)) get_values;
|
||||||
this->public.clone = (status_t(*)(ike_sa_id_t*,ike_sa_id_t**)) clone;
|
this->public.clone = (status_t(*)(ike_sa_id_t*,ike_sa_id_t**)) clone;
|
||||||
this->public.destroy = (status_t(*)(ike_sa_id_t*))destroy;
|
this->public.destroy = (status_t(*)(ike_sa_id_t*))destroy;
|
||||||
|
|
||||||
/* private data */
|
/* private data */
|
||||||
this->initiator_spi = initiator_spi;
|
this->initiator_spi = initiator_spi;
|
||||||
this->responder_spi = responder_spi;
|
this->responder_spi = responder_spi;
|
||||||
this->role = role;
|
this->is_initiator = is_initiator;
|
||||||
|
|
||||||
return (&this->public);
|
return (&this->public);
|
||||||
}
|
}
|
||||||
|
@ -100,10 +100,10 @@ struct ike_sa_id_s {
|
|||||||
* @param this ike_sa_id_t object
|
* @param this ike_sa_id_t object
|
||||||
* @param initiator address to write initator spi
|
* @param initiator address to write initator spi
|
||||||
* @param responder address to write responder spi
|
* @param responder address to write responder spi
|
||||||
* @param role address to write role
|
* @param is_initiator address to write role
|
||||||
* @return SUCCESSFUL if succeeded, FAILED otherwise
|
* @return SUCCESSFUL if succeeded, FAILED otherwise
|
||||||
*/
|
*/
|
||||||
status_t (*get_values) (ike_sa_id_t *this, spi_t *initiator, spi_t *responder, ike_sa_role_t *role);
|
status_t (*get_values) (ike_sa_id_t *this, spi_t *initiator, spi_t *responder, bool *is_initiator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Clones a given ike_sa_id_t object
|
* @brief Clones a given ike_sa_id_t object
|
||||||
@ -128,6 +128,6 @@ struct ike_sa_id_s {
|
|||||||
*
|
*
|
||||||
* @warning The initiator SPI and role is not changeable after initiating a ike_sa_id object
|
* @warning The initiator SPI and role is not changeable after initiating a ike_sa_id object
|
||||||
*/
|
*/
|
||||||
ike_sa_id_t * ike_sa_id_create(spi_t initiator_spi, spi_t responder_spi,ike_sa_role_t role);
|
ike_sa_id_t * ike_sa_id_create(spi_t initiator_spi, spi_t responder_spi, bool is_initiaor);
|
||||||
|
|
||||||
#endif /*IKE_SA_ID_H_*/
|
#endif /*IKE_SA_ID_H_*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user