- docs updated
[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 * @todo add more jobs, such as rekeying.
36 *
37 * @ingroup jobs
38 */
39 enum job_type_t {
40 /**
41 * Process an incoming IKEv2-Message.
42 *
43 * Job is implemented in class type incoming_packet_job_t
44 */
45 INCOMING_PACKET,
46
47 /**
48 * Retransmit an IKEv2-Message.
49 */
50 RETRANSMIT_REQUEST,
51
52 /**
53 * Establish an ike sa as initiator.
54 *
55 * Job is implemented in class type initiate_ike_sa_job_t
56 */
57 INITIATE_IKE_SA,
58
59 /**
60 * Delete an ike sa which is still not established.
61 *
62 * Job is implemented in class type delete_half_open_ike_sa_job_t
63 */
64 DELETE_HALF_OPEN_IKE_SA,
65
66 /**
67 * Delete an ike sa which is established.
68 *
69 * Job is implemented in class type delete_established_ike_sa_job_t
70 */
71 DELETE_ESTABLISHED_IKE_SA
72 };
73
74 /**
75 * string mappings for job_type_t
76 *
77 * @ingroup jobs
78 */
79 extern mapping_t job_type_m[];
80
81
82 typedef struct job_t job_t;
83
84 /**
85 * @brief Job-Interface as it is stored in the job queue.
86 *
87 * A job consists of a job-type and one or more assigned values.
88 *
89 * @b Constructors:
90 * - None, use specific implementation of the interface.
91 *
92 * @ingroup jobs
93 */
94 struct job_t {
95
96 /**
97 * @brief get type of job.
98 *
99 * @param this calling object
100 * @return type of this job
101 */
102 job_type_t (*get_type) (job_t *this);
103
104 /**
105 * @brief Destroys a job_t object and all assigned data!
106 *
107 * @param job_t calling object
108 */
109 void (*destroy_all) (job_t *job);
110
111 /**
112 * @brief Destroys a job_t object
113 *
114 * @param job_t calling object
115 */
116 void (*destroy) (job_t *job);
117 };
118
119
120 #endif /*JOB_H_*/