/**
* @file ike_auth_requested.c
*
- * @brief State of an IKE_SA, which has requested an IKE_AUTH.
+ * @brief Implementation of ike_auth_requested_t.
*
*/
*/
ike_auth_requested_t public;
+ /**
+ * Sent nonce value
+ */
+ chunk_t sent_nonce;
+
+ /**
+ * Received nonce
+ */
+ chunk_t received_nonce;
/**
* Assigned IKE_SA
/**
* Implements state_t.get_state
*/
-static status_t process_message(private_ike_auth_requested_t *this, message_t *message, state_t **new_state)
+static status_t process_message(private_ike_auth_requested_t *this, message_t *message)
{
- *new_state = (state_t *) this;
return SUCCESS;
}
/**
* Implements state_t.get_state
*/
-static status_t destroy(private_ike_auth_requested_t *this)
+static void destroy(private_ike_auth_requested_t *this)
{
+ allocator_free(this->sent_nonce.ptr);
+ allocator_free(this->received_nonce.ptr);
allocator_free(this);
- return SUCCESS;
}
/*
* Described in header.
*/
-ike_auth_requested_t *ike_auth_requested_create(protected_ike_sa_t *ike_sa)
+ike_auth_requested_t *ike_auth_requested_create(protected_ike_sa_t *ike_sa, chunk_t sent_nonce, chunk_t received_nonce)
{
private_ike_auth_requested_t *this = allocator_alloc_thing(private_ike_auth_requested_t);
-
- if (this == NULL)
- {
- return NULL;
- }
/* interface functions */
- this->public.state_interface.process_message = (status_t (*) (state_t *,message_t *,state_t **)) process_message;
+ this->public.state_interface.process_message = (status_t (*) (state_t *,message_t *)) process_message;
this->public.state_interface.get_state = (ike_sa_state_t (*) (state_t *)) get_state;
- this->public.state_interface.destroy = (status_t (*) (state_t *)) destroy;
+ this->public.state_interface.destroy = (void (*) (state_t *)) destroy;
/* private data */
this->ike_sa = ike_sa;
+ this->sent_nonce = sent_nonce;
+ this->received_nonce = received_nonce;
+
return &(this->public);
}