89e9c5b60b44380c1db4341241dc6a4c2139e9f9
[strongswan.git] / Source / charon / queues / jobs / job.h
1 /**
2 * @file job.h
3 *
4 * @brief Interface 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 #ifndef JOB_H_
24 #define JOB_H_
25
26 #include <types.h>
27 #include <definitions.h>
28
29
30 typedef enum job_type_t job_type_t;
31
32 /**
33 * @brief Definition of the various job types.
34 *
35 * @ingroup jobs
36 */
37 enum job_type_t {
38 /**
39 * Process an incoming IKEv2-Message.
40 *
41 * Job is implemented in class type incoming_packet_job_t
42 */
43 INCOMING_PACKET,
44
45 /**
46 * Retransmit an IKEv2-Message.
47 */
48 RETRANSMIT_REQUEST,
49
50 /**
51 * Establish an ike sa as initiator.
52 *
53 * Job is implemented in class type initiate_ike_sa_job_t
54 */
55
56 INITIATE_IKE_SA,
57 /**
58 * Delete an ike sa which is still not established.
59 *
60 * Job is implemented in class type delete_half_open_ike_sa_job_t
61 */
62 DELETE_HALF_OPEN_IKE_SA,
63
64 /**
65 * Delete an ike sa which is established.
66 *
67 * Job is implemented in class type delete_established_ike_sa_job_t
68 */
69 DELETE_ESTABLISHED_IKE_SA
70
71
72 /* more job types have to be inserted here */
73 };
74
75 /**
76 * string mappings for job_type_t
77 */
78 extern mapping_t job_type_m[];
79
80
81 typedef struct job_t job_t;
82
83 /**
84 * @brief Job-Interface as it is stored in the job queue.
85 *
86 * A job consists of a job-type and one or more assigned values.
87 *
88 * @ingroup jobs
89 */
90 struct job_t {
91
92 /**
93 * @brief get type of job.
94 *
95 * @param this calling object
96 * @return type of this job
97 */
98 job_type_t (*get_type) (job_t *this);
99
100 /**
101 * @brief Destroys a job_t object and all assigned data!
102 *
103 * @param job_t calling object
104 */
105 void (*destroy_all) (job_t *job);
106
107 /**
108 * @brief Destroys a job_t object
109 *
110 * @param job_t calling object
111 */
112 void (*destroy) (job_t *job);
113 };
114
115
116 #endif /*JOB_H_*/