/**
* Role for specific IKE_SA
*/
- ike_sa_role_t role;
+ bool is_initiator;
};
*/
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));
}
/**
*/
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));
}
/**
{
return FAILED;
}
- if ( (this->role == other->role) &&
- (this->initiator_spi.high == other->initiator_spi.high) &&
- (this->initiator_spi.low == other->initiator_spi.low) &&
- (this->responder_spi.high == other->responder_spi.high) &&
- (this->responder_spi.low == other->responder_spi.low))
+ if ((this->is_initiator == other->is_initiator) &&
+ (this->initiator_spi == other->initiator_spi) &&
+ (this->responder_spi == other->responder_spi))
{
/* private_ike_sa_id's are equal */
*are_equal = TRUE;
this->initiator_spi = other->initiator_spi;
this->responder_spi = other->responder_spi;
- this->role = other->role;
+ this->is_initiator = other->is_initiator;
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)
+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(responder, &(this->responder_spi), sizeof(responder));
- *role = this->role;
+ *is_initiator = this->is_initiator;
return SUCCESS;
}
*/
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;
}
/*
* 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);
if (this == NULL)
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.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.destroy = (status_t(*)(ike_sa_id_t*))destroy;
/* private data */
this->initiator_spi = initiator_spi;
this->responder_spi = responder_spi;
- this->role = role;
+ this->is_initiator = is_initiator;
return (&this->public);
}
* @param this ike_sa_id_t object
* @param initiator address to write initator 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
*/
- 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
*
* @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_*/