- first attempt for connection loading and starting via "stroke"

- some improvements here and there
This commit is contained in:
Martin Willi
2006-03-14 13:22:48 +00:00
parent 8a49112907
commit b1953ccd05
20 changed files with 465 additions and 266 deletions
+11 -32
View File
@@ -47,15 +47,6 @@ struct private_ike_sa_established_t {
*/
logger_t *logger;
/**
* Process received DELETE payload and build DELETE payload for INFORMATIONAL response.
*
* @param this calling object
* @param request DELETE payload received in INFORMATIONAL request
* @param response The created DELETE payload is added to this message_t object
*/
status_t (*build_delete_payload) (private_ike_sa_established_t *this, delete_payload_t *request, message_t *response);
/**
* Process a notify payload
*
@@ -145,6 +136,7 @@ static status_t process_message(private_ike_sa_established_t *this, message_t *m
case DELETE:
{
delete_request = (delete_payload_t *) payload;
break;
}
default:
{
@@ -158,16 +150,21 @@ static status_t process_message(private_ike_sa_established_t *this, message_t *m
payloads->destroy(payloads);
if (delete_request)
{
status = this->build_delete_payload(this, delete_request, response);
if (status == DELETE_ME)
{
if (delete_request->get_protocol_id(delete_request) == IKE)
{
this->logger->log(this->logger, AUDIT, "DELETE request for IKE_SA received");
response->destroy(response);
return status;
return DELETE_ME;
}
else
{
this->logger->log(this->logger, AUDIT, "DELETE request for CHILD_SA received. Ignored");
response->destroy(response);
return SUCCESS;
}
}
status = this->ike_sa->send_response(this->ike_sa, response);
/* message can now be sent (must not be destroyed) */
if (status != SUCCESS)
@@ -180,23 +177,6 @@ static status_t process_message(private_ike_sa_established_t *this, message_t *m
return SUCCESS;
}
/**
* Implementation of private_ike_sa_established_t.build_sa_payload;
*/
static status_t build_delete_payload (private_ike_sa_established_t *this, delete_payload_t *request, message_t *response_message)
{
if (request->get_protocol_id(request) == IKE)
{
this->logger->log(this->logger, AUDIT, "DELETE request for IKE_SA received. Don't reply.");
/* IKE_SA has to get deleted */
return DELETE_ME;
}
this->logger->log(this->logger, AUDIT, "DELETE payload for CHILD_SAs not supported and handled.");
return SUCCESS;
}
/**
* Implementation of private_ike_sa_established_t.process_notify_payload;
*/
@@ -250,7 +230,6 @@ ike_sa_established_t *ike_sa_established_create(protected_ike_sa_t *ike_sa)
/* private functions */
this->process_notify_payload = process_notify_payload;
this->build_delete_payload = build_delete_payload;
/* private data */
this->ike_sa = ike_sa;
+1 -4
View File
@@ -159,7 +159,6 @@ status_t retry_initiate_connection (private_initiator_init_t *this, diffie_hellm
if (dh_group == MODP_UNDEFINED)
{
this->logger->log(this->logger, AUDIT, "No DH group acceptable for initialization, Aborting");
message->destroy(message);
return DELETE_ME;
}
@@ -280,7 +279,7 @@ static void build_nonce_payload(private_initiator_init_t *this, message_t *reque
*/
static status_t process_message(private_initiator_init_t *this, message_t *message)
{
this->logger->log(this->logger, ERROR, "In state INITIATOR_INIT no message is processed");
this->logger->log(this->logger, ERROR, "In state INITIATOR_INIT, no message is processed");
return FAILED;
}
@@ -302,12 +301,10 @@ static void destroy(private_initiator_init_t *this)
/* destroy diffie hellman object */
if (this->diffie_hellman != NULL)
{
this->logger->log(this->logger, CONTROL | LEVEL3, "Destroy diffie_hellman_t object");
this->diffie_hellman->destroy(this->diffie_hellman);
}
if (this->sent_nonce.ptr != NULL)
{
this->logger->log(this->logger, CONTROL | LEVEL3, "Free memory of sent nonce");
allocator_free(this->sent_nonce.ptr);
}
allocator_free(this);