diff options
author | Martin Willi <martin@revosec.ch> | 2011-12-13 10:22:49 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-03-20 17:31:19 +0100 |
commit | 10e18713f17f3528667c7124d17174e55a1137c9 (patch) | |
tree | 6d428ec433c44332321b45b9d7f63478ec77d4ed /src/libcharon/sa/tasks/informational.c | |
parent | 46505067c761072c1567a134814c9d7852d066b3 (diff) | |
download | strongswan-10e18713f17f3528667c7124d17174e55a1137c9.tar.bz2 strongswan-10e18713f17f3528667c7124d17174e55a1137c9.tar.xz |
Handle DELETE as responder as INFORMATIONAL subtask
Diffstat (limited to 'src/libcharon/sa/tasks/informational.c')
-rw-r--r-- | src/libcharon/sa/tasks/informational.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/libcharon/sa/tasks/informational.c b/src/libcharon/sa/tasks/informational.c index 08e5a7eb2..c1a30e4ee 100644 --- a/src/libcharon/sa/tasks/informational.c +++ b/src/libcharon/sa/tasks/informational.c @@ -16,6 +16,9 @@ #include "informational.h" #include <daemon.h> +#include <sa/tasks/ike_delete.h> +#include <sa/tasks/child_delete.h> +#include <encoding/payloads/delete_payload.h> typedef struct private_informational_t private_informational_t; @@ -38,6 +41,11 @@ struct private_informational_t { * Notify payload to send */ notify_payload_t *notify; + + /** + * Delete subtask + */ + task_t *del; }; METHOD(task_t, build_i, status_t, @@ -52,6 +60,7 @@ METHOD(task_t, process_r, status_t, private_informational_t *this, message_t *message) { enumerator_t *enumerator; + delete_payload_t *delete; notify_payload_t *notify; notify_type_t type; payload_t *payload; @@ -85,7 +94,17 @@ METHOD(task_t, process_r, status_t, } continue; case DELETE_V1: - /* TODO-IKEv1: handle delete */ + delete = (delete_payload_t*)payload; + if (delete->get_protocol_id(delete) == PROTO_IKE) + { + this->del = (task_t*)ike_delete_create(this->ike_sa, FALSE); + } + else + { + this->del = (task_t*)child_delete_create(this->ike_sa, + PROTO_NONE, 0); + } + break; default: continue; } @@ -93,12 +112,20 @@ METHOD(task_t, process_r, status_t, } enumerator->destroy(enumerator); + if (status == SUCCESS) + { + return this->del->process(this->del, message); + } return status; } METHOD(task_t, build_r, status_t, private_informational_t *this, message_t *message) { + if (this->del) + { + return this->del->build(this->del, message); + } return FAILED; } @@ -124,6 +151,7 @@ METHOD(task_t, destroy, void, private_informational_t *this) { DESTROY_IF(this->notify); + DESTROY_IF(this->del); free(this); } |