]> git.ipfire.org Git - people/ms/strongswan.git/blob - Source/charon/queues/jobs/initiate_ike_sa_job.c
- renamed get_block_size of hasher
[people/ms/strongswan.git] / Source / charon / queues / jobs / initiate_ike_sa_job.c
1 /**
2 * @file initiate_ike_sa_job.c
3 *
4 * @brief Implementation of initiate_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
24 #include <stdlib.h>
25
26 #include "initiate_ike_sa_job.h"
27
28
29
30 typedef struct private_initiate_ike_sa_job_t private_initiate_ike_sa_job_t;
31
32 /**
33 * Private data of an initiate_ike_sa_job_t Object
34 */
35 struct private_initiate_ike_sa_job_t {
36 /**
37 * public initiate_ike_sa_job_t interface
38 */
39 initiate_ike_sa_job_t public;
40
41 /**
42 * associated connection object to initiate
43 */
44 connection_t *connection;
45 };
46
47
48 /**
49 * Implements initiate_ike_sa_job_t.get_type.
50 */
51 static job_type_t get_type(private_initiate_ike_sa_job_t *this)
52 {
53 return INITIATE_IKE_SA;
54 }
55
56 /**
57 * Implements initiate_ike_sa_job_t.get_configuration_name.
58 */
59 static connection_t *get_connection(private_initiate_ike_sa_job_t *this)
60 {
61 return this->connection;
62 }
63
64 /**
65 * Implements job_t.destroy.
66 */
67 static void destroy_all(private_initiate_ike_sa_job_t *this)
68 {
69 this->connection->destroy(this->connection);
70 free(this);
71 }
72
73 /**
74 * Implements job_t.destroy.
75 */
76 static void destroy(private_initiate_ike_sa_job_t *this)
77 {
78 free(this);
79 }
80
81 /*
82 * Described in header
83 */
84 initiate_ike_sa_job_t *initiate_ike_sa_job_create(connection_t *connection)
85 {
86 private_initiate_ike_sa_job_t *this = malloc_thing(private_initiate_ike_sa_job_t);
87
88 /* interface functions */
89 this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
90 this->public.job_interface.destroy_all = (void (*) (job_t *)) destroy_all;
91 this->public.job_interface.destroy = (void (*) (job_t *)) destroy;
92
93 /* public functions */
94 this->public.get_connection = (connection_t* (*)(initiate_ike_sa_job_t *)) get_connection;
95 this->public.destroy = (void (*)(initiate_ike_sa_job_t *)) destroy;
96
97 /* private variables */
98 this->connection = connection;
99
100 return &(this->public);
101 }