(no commit message)
[strongswan.git] / src / charon / queues / jobs / delete_established_ike_sa_job.c
1 /**
2 * @file delete_established_ike_sa_job.c
3 *
4 * @brief Implementation of delete_established_ike_sa_job_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
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>.
16 *
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
20 * for more details.
21 */
22
23 #include "delete_established_ike_sa_job.h"
24
25
26
27 typedef struct private_delete_established_ike_sa_job_t private_delete_established_ike_sa_job_t;
28
29 /**
30 * Private data of an delete_established_ike_sa_job_t object.
31 */
32 struct private_delete_established_ike_sa_job_t {
33 /**
34 * Public delete_established_ike_sa_job_t interface.
35 */
36 delete_established_ike_sa_job_t public;
37
38 /**
39 * ID of the ike_sa to delete.
40 */
41 ike_sa_id_t *ike_sa_id;
42 };
43
44 /**
45 * Implementation of job_t.get_type.
46 */
47 static job_type_t get_type(private_delete_established_ike_sa_job_t *this)
48 {
49 return DELETE_ESTABLISHED_IKE_SA;
50 }
51
52 /**
53 * Implementation of delete_established_ike_sa_job_t.get_ike_sa_id
54 */
55 static ike_sa_id_t *get_ike_sa_id(private_delete_established_ike_sa_job_t *this)
56 {
57 return this->ike_sa_id;
58 }
59
60 /**
61 * Implementation of job_t.destroy.
62 */
63 static void destroy(private_delete_established_ike_sa_job_t *this)
64 {
65 this->ike_sa_id->destroy(this->ike_sa_id);
66 free(this);
67 }
68
69 /*
70 * Described in header
71 */
72 delete_established_ike_sa_job_t *delete_established_ike_sa_job_create(ike_sa_id_t *ike_sa_id)
73 {
74 private_delete_established_ike_sa_job_t *this = malloc_thing(private_delete_established_ike_sa_job_t);
75
76 /* interface functions */
77 this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
78 /* same as destroy */
79 this->public.job_interface.destroy_all = (void (*) (job_t *)) destroy;
80 this->public.job_interface.destroy = (void (*)(job_t*)) destroy;
81
82 /* public functions */
83 this->public.get_ike_sa_id = (ike_sa_id_t * (*)(delete_established_ike_sa_job_t *)) get_ike_sa_id;
84 this->public.destroy = (void (*)(delete_established_ike_sa_job_t *)) destroy;
85
86 /* private variables */
87 this->ike_sa_id = ike_sa_id->clone(ike_sa_id);
88
89 return &(this->public);
90 }