diff options
author | Martin Willi <martin@strongswan.org> | 2005-11-17 11:25:45 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2005-11-17 11:25:45 +0000 |
commit | 4edbe5554c9ad93c7e574b1f9d2a4b9d296c8383 (patch) | |
tree | 87c217234cbb29b09e43bdd11f19c75339287ef7 /Source/charon/thread_pool.c | |
parent | 9a200d13efda60cdb1a92d87208d2eac2ea57883 (diff) | |
download | strongswan-4edbe5554c9ad93c7e574b1f9d2a4b9d296c8383.tar.bz2 strongswan-4edbe5554c9ad93c7e574b1f9d2a4b9d296c8383.tar.xz |
- handles now INITIATE_IKE_SA jobs
Diffstat (limited to 'Source/charon/thread_pool.c')
-rw-r--r-- | Source/charon/thread_pool.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/charon/thread_pool.c b/Source/charon/thread_pool.c index 645162487..add381501 100644 --- a/Source/charon/thread_pool.c +++ b/Source/charon/thread_pool.c @@ -165,6 +165,46 @@ static void job_processing(private_thread_pool_t *this) } case INITIATE_IKE_SA: { + /* + * Initiatie an IKE_SA: + * - is defined by a name of a configuration + * - create an empty IKE_SA via manager + * - call initiate_connection on this sa + */ + initiate_ike_sa_job_t *initiate_job; + ike_sa_id_t *ike_sa_id; + ike_sa_t *ike_sa; + status_t status; + + initiate_job = (initiate_ike_sa_job_t *)job; + this->logger->log(this->logger, CONTROL, "thread %u: Initiating an IKE_SA for config \"%s\"", + pthread_self(), initiate_job->get_configuration_name(initiate_job)); + + ike_sa_id = ike_sa_id_create(0, 0, TRUE); + if (ike_sa_id == NULL) + { + this->logger->log(this->logger, ERROR, "thread %u: %s by creating ike_sa_id_t, job rejected.", + pthread_self(), mapping_find(status_m, status)); + break; + } + + status = global_ike_sa_manager->checkout(global_ike_sa_manager, ike_sa_id, &ike_sa); + ike_sa_id->destroy(ike_sa_id); + if (status != SUCCESS) + { + this->logger->log(this->logger, ERROR, "thread %u: %s by checking out new IKE_SA, job rejected.", + pthread_self(), mapping_find(status_m, status)); + break; + } + + status = ike_sa->initialize_connection(ike_sa, initiate_job->get_configuration_name(initiate_job)); + if (status != SUCCESS) + { + this->logger->log(this->logger, ERROR, "thread %u: %s by initialize_conection, job and rejected, IKE_SA deleted.", + pthread_self(), mapping_find(status_m, status)); + global_ike_sa_manager->checkin_and_delete(global_ike_sa_manager, ike_sa); + break; + } break; } case RETRANSMIT_REQUEST: |