""
This commit is contained in:
+25
-7
@@ -117,6 +117,14 @@ struct private_ike_sa_s {
|
|||||||
|
|
||||||
linked_list_t *sent_messages;
|
linked_list_t *sent_messages;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
host_t *host;
|
||||||
|
} me;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
host_t *host;
|
||||||
|
} other;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a logger for this IKE_SA
|
* a logger for this IKE_SA
|
||||||
*/
|
*/
|
||||||
@@ -135,7 +143,7 @@ static status_t process_message (private_ike_sa_t *this, message_t *message)
|
|||||||
/**
|
/**
|
||||||
* @brief implements function process_configuration of private_ike_sa_t
|
* @brief implements function process_configuration of private_ike_sa_t
|
||||||
*/
|
*/
|
||||||
static status_t initialize_connection(private_ike_sa_t *this, configuration_t *configuration)
|
static status_t initialize_connection(private_ike_sa_t *this, char *name)
|
||||||
{
|
{
|
||||||
message_t *message;
|
message_t *message;
|
||||||
payload_t *payload;
|
payload_t *payload;
|
||||||
@@ -429,7 +437,7 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
|
|||||||
|
|
||||||
/* Public functions */
|
/* Public functions */
|
||||||
this->public.process_message = (status_t(*)(ike_sa_t*, message_t*)) process_message;
|
this->public.process_message = (status_t(*)(ike_sa_t*, message_t*)) process_message;
|
||||||
this->public.initialize_connection = (status_t(*)(ike_sa_t*, configuration_t*)) initialize_connection;
|
this->public.initialize_connection = (status_t(*)(ike_sa_t*, char*)) initialize_connection;
|
||||||
this->public.get_id = (ike_sa_id_t*(*)(ike_sa_t*)) get_id;
|
this->public.get_id = (ike_sa_id_t*(*)(ike_sa_t*)) get_id;
|
||||||
this->public.destroy = (status_t(*)(ike_sa_t*))destroy;
|
this->public.destroy = (status_t(*)(ike_sa_t*))destroy;
|
||||||
|
|
||||||
@@ -445,7 +453,6 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
|
|||||||
allocator_free(this);
|
allocator_free(this);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->child_sas = linked_list_create();
|
this->child_sas = linked_list_create();
|
||||||
if (this->child_sas == NULL)
|
if (this->child_sas == NULL)
|
||||||
{
|
{
|
||||||
@@ -453,7 +460,6 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
|
|||||||
allocator_free(this);
|
allocator_free(this);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->randomizer = randomizer_create();
|
this->randomizer = randomizer_create();
|
||||||
if (this->randomizer == NULL)
|
if (this->randomizer == NULL)
|
||||||
{
|
{
|
||||||
@@ -461,15 +467,27 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
|
|||||||
this->ike_sa_id->destroy(this->ike_sa_id);
|
this->ike_sa_id->destroy(this->ike_sa_id);
|
||||||
allocator_free(this);
|
allocator_free(this);
|
||||||
}
|
}
|
||||||
|
this->sent_messages = linked_list_create();
|
||||||
this->logger = global_logger_manager->create_logger(global_logger_manager, IKE_SA, NULL);
|
if (this->sent_messages == NULL)
|
||||||
if (this->logger == NULL)
|
|
||||||
{
|
{
|
||||||
this->randomizer->destroy(this->randomizer);
|
this->randomizer->destroy(this->randomizer);
|
||||||
this->child_sas->destroy(this->child_sas);
|
this->child_sas->destroy(this->child_sas);
|
||||||
this->ike_sa_id->destroy(this->ike_sa_id);
|
this->ike_sa_id->destroy(this->ike_sa_id);
|
||||||
allocator_free(this);
|
allocator_free(this);
|
||||||
}
|
}
|
||||||
|
this->logger = global_logger_manager->create_logger(global_logger_manager, IKE_SA, NULL);
|
||||||
|
if (this->logger == NULL)
|
||||||
|
{
|
||||||
|
this->randomizer->destroy(this->randomizer);
|
||||||
|
this->child_sas->destroy(this->child_sas);
|
||||||
|
this->ike_sa_id->destroy(this->ike_sa_id);
|
||||||
|
this->sent_messages->destroy(this->sent_messages);
|
||||||
|
allocator_free(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->me.host = NULL;
|
||||||
|
this->other.host = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* at creation time, IKE_SA isn't in a specific state */
|
/* at creation time, IKE_SA isn't in a specific state */
|
||||||
this->current_state = NO_STATE;
|
this->current_state = NO_STATE;
|
||||||
|
|||||||
+2
-11
@@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include "configuration.h"
|
|
||||||
#include "ike_sa_id.h"
|
#include "ike_sa_id.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,16 +45,8 @@ struct ike_sa_s {
|
|||||||
*/
|
*/
|
||||||
status_t (*process_message) (ike_sa_t *this,message_t *message);
|
status_t (*process_message) (ike_sa_t *this,message_t *message);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Processes a specific configuration
|
status_t (*initialize_connection) (ike_sa_t *this, char *name);
|
||||||
*
|
|
||||||
* This function is called when a new IKE_SA is created
|
|
||||||
*
|
|
||||||
* @param this ike_sa_t-message_t object object
|
|
||||||
* @param[in] message message_t object to process
|
|
||||||
* @return SUCCESSFUL if succeeded, FAILED otherwise
|
|
||||||
*/
|
|
||||||
status_t (*initialize_connection) (ike_sa_t *this,configuration_t *configuration);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the id of the SA
|
* @brief Get the id of the SA
|
||||||
|
|||||||
Reference in New Issue
Block a user