2 * Copyright (C) 2006 Martin Willi
3 * Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 #include "rekey_ike_sa_job.h"
20 typedef struct private_rekey_ike_sa_job_t private_rekey_ike_sa_job_t
;
23 * Private data of an rekey_ike_sa_job_t object.
25 struct private_rekey_ike_sa_job_t
{
27 * Public rekey_ike_sa_job_t interface.
29 rekey_ike_sa_job_t
public;
32 * ID of the IKE_SA to rekey
34 ike_sa_id_t
*ike_sa_id
;
37 * force reauthentication of the peer (full IKE_SA setup)
42 METHOD(job_t
, destroy
, void,
43 private_rekey_ike_sa_job_t
*this)
45 this->ike_sa_id
->destroy(this->ike_sa_id
);
49 METHOD(job_t
, execute
, void,
50 private_rekey_ike_sa_job_t
*this)
53 status_t status
= SUCCESS
;
55 ike_sa
= charon
->ike_sa_manager
->checkout(charon
->ike_sa_manager
,
59 DBG2(DBG_JOB
, "IKE_SA to rekey not found");
65 status
= ike_sa
->reauth(ike_sa
);
69 status
= ike_sa
->rekey(ike_sa
);
72 if (status
== DESTROY_ME
)
74 charon
->ike_sa_manager
->checkin_and_destroy(charon
->ike_sa_manager
, ike_sa
);
78 charon
->ike_sa_manager
->checkin(charon
->ike_sa_manager
, ike_sa
);
87 rekey_ike_sa_job_t
*rekey_ike_sa_job_create(ike_sa_id_t
*ike_sa_id
, bool reauth
)
89 private_rekey_ike_sa_job_t
*this;
98 .ike_sa_id
= ike_sa_id
->clone(ike_sa_id
),
102 return &(this->public);