2 * @file delete_ike_sa_job.h
4 * @brief Job of type DELETE_IKE_SA
9 * Copyright (C) 2005 Jan Hutter, 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 "delete_ike_sa_job.h"
25 #include "../utils/allocator.h"
28 * Private data of an delete_ike_sa_job_t Object
31 typedef struct private_delete_ike_sa_job_s private_delete_ike_sa_job_t
;
33 struct private_delete_ike_sa_job_s
{
35 * public delete_ike_sa_job_t interface
37 delete_ike_sa_job_t
public;
40 * ID of the ike_sa to delete
42 ike_sa_id_t
*ike_sa_id
;
47 * Implements delete_ike_sa_job_t's get_type function.
48 * See #delete_ike_sa_job_t.get_type for description.
50 static job_type_t
get_type(private_delete_ike_sa_job_t
*this)
56 * Implements delete_ike_sa_job_t's get_ike_sa_id function.
57 * See #delete_ike_sa_job_t.get_ike_sa_id for description.
59 static ike_sa_id_t
* get_ike_sa_id(private_delete_ike_sa_job_t
*this)
61 return this->ike_sa_id
;
65 * Implements job_t's and delete_ike_sa_job_t's destroy function.
66 * See #job_t.destroy or #delete_ike_sa_job_t.destroy for description.
68 static status_t
destroy(job_t
*job
)
70 private_delete_ike_sa_job_t
*this = (private_delete_ike_sa_job_t
*) job
;
71 this->ike_sa_id
->destroy(this->ike_sa_id
);
79 delete_ike_sa_job_t
*delete_ike_sa_job_create(ike_sa_id_t
*ike_sa_id
)
81 private_delete_ike_sa_job_t
*this = allocator_alloc_thing(private_delete_ike_sa_job_t
);
87 /* interface functions */
88 this->public.job_interface
.get_type
= (job_type_t (*) (job_t
*)) get_type
;
90 this->public.job_interface
.destroy_all
= (status_t (*) (job_t
*)) destroy
;
91 this->public.job_interface
.destroy
= destroy
;
93 /* public functions */
94 this->public.get_ike_sa_id
= (ike_sa_id_t
* (*)(delete_ike_sa_job_t
*)) get_ike_sa_id
;
95 this->public.destroy
= (status_t (*)(delete_ike_sa_job_t
*)) destroy
;
97 /* private variables */
98 if (ike_sa_id
->clone(ike_sa_id
,&(this->ike_sa_id
)) != SUCCESS
)
100 allocator_free(this);
104 return &(this->public);