(no commit message)
[strongswan.git] / Source / charon / sa / states / ike_auth_requested.c
index b1033eb..316b0a2 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * @file ike_auth_requested.c
  * 
- * @brief State of an IKE_SA, which has requested an IKE_AUTH.
+ * @brief Implementation of ike_auth_requested_t.
  * 
  */
 
 
 #include <utils/allocator.h>
 
+
+typedef struct private_ike_auth_requested_t private_ike_auth_requested_t;
+
 /**
  * Private data of a ike_auth_requested_t object.
  *
  */
-typedef struct private_ike_auth_requested_s private_ike_auth_requested_t;
-struct private_ike_auth_requested_s {
+struct private_ike_auth_requested_t {
        /**
         * methods of the state_t interface
         */
        ike_auth_requested_t public;
        
+       /**
+        * Sent nonce value
+        */
+       chunk_t sent_nonce;
+       
+       /**
+        * Received nonce
+        */
+       chunk_t received_nonce;
        
        /**
         * Assigned IKE_SA
@@ -45,9 +56,8 @@ struct private_ike_auth_requested_s {
 /**
  * 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;
 }
 
@@ -62,31 +72,30 @@ static ike_sa_state_t get_state(private_ike_auth_requested_t *this)
 /**
  * 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);
 }