2 * @file rekey_child_sa_job.c
4 * @brief Implementation of rekey_child_sa_job_t.
9 * Copyright (C) 2006 Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 #include "rekey_child_sa_job.h"
28 typedef struct private_rekey_child_sa_job_t private_rekey_child_sa_job_t
;
31 * Private data of an rekey_child_sa_job_t object.
33 struct private_rekey_child_sa_job_t
{
35 * Public rekey_child_sa_job_t interface.
37 rekey_child_sa_job_t
public;
40 * reqid of the child to rekey
45 * protocol of the CHILD_SA (ESP/AH)
47 protocol_id_t protocol
;
50 * inbound SPI of the CHILD_SA
56 * Implementation of job_t.get_type.
58 static job_type_t
get_type(private_rekey_child_sa_job_t
*this)
60 return REKEY_CHILD_SA
;
64 * Implementation of job_t.execute.
66 static status_t
execute(private_rekey_child_sa_job_t
*this)
70 ike_sa
= charon
->ike_sa_manager
->checkout_by_id(charon
->ike_sa_manager
,
74 DBG2(DBG_JOB
, "CHILD_SA with reqid %d not found for rekeying",
78 ike_sa
->rekey_child_sa(ike_sa
, this->protocol
, this->spi
);
80 charon
->ike_sa_manager
->checkin(charon
->ike_sa_manager
, ike_sa
);
85 * Implementation of job_t.destroy.
87 static void destroy(private_rekey_child_sa_job_t
*this)
95 rekey_child_sa_job_t
*rekey_child_sa_job_create(u_int32_t reqid
,
96 protocol_id_t protocol
,
99 private_rekey_child_sa_job_t
*this = malloc_thing(private_rekey_child_sa_job_t
);
101 /* interface functions */
102 this->public.job_interface
.get_type
= (job_type_t (*) (job_t
*)) get_type
;
103 this->public.job_interface
.execute
= (status_t (*) (job_t
*)) execute
;
104 this->public.job_interface
.destroy
= (void (*)(job_t
*)) destroy
;
106 /* private variables */
108 this->protocol
= protocol
;
111 return &(this->public);