2 * Copyright (C) 2008 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
18 #include "update_sa_job.h"
20 #include <sa/ike_sa.h>
24 typedef struct private_update_sa_job_t private_update_sa_job_t
;
27 * Private data of an update_sa_job_t Object
29 struct private_update_sa_job_t
{
31 * public update_sa_job_t interface
33 update_sa_job_t
public;
36 * reqid of the CHILD_SA
41 * New SA address and port
46 METHOD(job_t
, destroy
, void,
47 private_update_sa_job_t
*this)
49 this->new->destroy(this->new);
53 METHOD(job_t
, execute
, void,
54 private_update_sa_job_t
*this)
58 ike_sa
= charon
->ike_sa_manager
->checkout_by_id(charon
->ike_sa_manager
,
62 DBG1(DBG_JOB
, "CHILD_SA with reqid %d not found for update", this->reqid
);
66 /* we update only if other host is NATed, but not our */
67 if (ike_sa
->has_condition(ike_sa
, COND_NAT_THERE
) &&
68 !ike_sa
->has_condition(ike_sa
, COND_NAT_HERE
))
70 ike_sa
->update_hosts(ike_sa
, NULL
, this->new, FALSE
);
72 charon
->ike_sa_manager
->checkin(charon
->ike_sa_manager
, ike_sa
);
77 METHOD(job_t
, get_priority
, job_priority_t
,
78 private_update_sa_job_t
*this)
80 return JOB_PRIO_MEDIUM
;
86 update_sa_job_t
*update_sa_job_create(u_int32_t reqid
, host_t
*new)
88 private_update_sa_job_t
*this;
94 .get_priority
= _get_priority
,
102 return &this->public;