- state ike_auth_requested
[strongswan.git] / Source / charon / queues / jobs / retransmit_request_job.c
1 /**
2 * @file retransmit_request_job.c
3 *
4 * @brief Implementation of retransmit_request_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 "retransmit_request_job.h"
24
25
26 #include <utils/allocator.h>
27
28
29 typedef struct private_retransmit_request_job_t private_retransmit_request_job_t;
30
31 /**
32 * Private data of an retransmit_request_job_t Object.
33 */
34 struct private_retransmit_request_job_t {
35 /**
36 * Public retransmit_request_job_t interface.
37 */
38 retransmit_request_job_t public;
39
40 /**
41 * Message ID of the request to resend.
42 */
43 u_int32_t message_id;
44
45 /**
46 * ID of the IKE_SA which the message belongs to.
47 */
48 ike_sa_id_t *ike_sa_id;
49 };
50
51
52 /**
53 * Implements job_t.get_type.
54 */
55 static job_type_t get_type(private_retransmit_request_job_t *this)
56 {
57 return RETRANSMIT_REQUEST;
58 }
59
60 /**
61 * Implements retransmit_request_job_t.get_ike_sa_id.
62 */
63 static ike_sa_id_t *get_ike_sa_id(private_retransmit_request_job_t *this)
64 {
65 return this->ike_sa_id;
66 }
67
68 /**
69 * Implements retransmit_request_job_t.get_message_id.
70 */
71 static u_int32_t get_message_id(private_retransmit_request_job_t *this)
72 {
73 return this->message_id;
74 }
75
76
77 /**
78 * Implements job_t.destroy.
79 */
80 static void destroy(private_retransmit_request_job_t *this)
81 {
82 this->ike_sa_id->destroy(this->ike_sa_id);
83 allocator_free(this);
84 }
85
86 /*
87 * Described in header.
88 */
89 retransmit_request_job_t *retransmit_request_job_create(u_int32_t message_id,ike_sa_id_t *ike_sa_id)
90 {
91 private_retransmit_request_job_t *this = allocator_alloc_thing(private_retransmit_request_job_t);
92
93 /* interface functions */
94 this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
95 /* same as destroy */
96 this->public.job_interface.destroy_all = (void (*) (job_t *)) destroy;
97 this->public.job_interface.destroy = (void (*) (job_t *)) destroy;
98
99 /* public functions */
100 this->public.get_ike_sa_id = (ike_sa_id_t * (*)(retransmit_request_job_t *)) get_ike_sa_id;
101 this->public.get_message_id = (u_int32_t (*)(retransmit_request_job_t *)) get_message_id;
102 this->public.destroy = (void (*)(retransmit_request_job_t *)) destroy;
103
104 /* private variables */
105 this->message_id = message_id;
106 this->ike_sa_id = ike_sa_id->clone(ike_sa_id);
107
108 return &(this->public);
109 }