- added new job type delete_ike_sa_job_t
[strongswan.git] / Source / charon / jobs / job.h
1 /**
2 * @file job.h
3 *
4 * @brief Job-Interface representing a job e.g. in job_queue
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 * Type of Jobs in Job-Queue
31 */
32 typedef enum job_type_e job_type_t;
33
34 enum job_type_e {
35 /**
36 * Process an incoming IKEv2-Message
37 *
38 * Job is implemented in class type incoming_packet_job_t
39 */
40 INCOMING_PACKET,
41 /**
42 * Retransmit an IKEv2-Message
43 */
44 RETRANSMIT_REQUEST,
45 /**
46 * Establish an ike sa as initiator
47 *
48 * Job is implemented in class type initiate_ike_sa_job_t
49 */
50 INITIATE_IKE_SA,
51 /**
52 * Delete an ike sa
53 *
54 * Job is implemented in class type delete_ike_sa_job_t
55 */
56 DELETE_IKE_SA
57
58
59 /* more job types have to be inserted here */
60 };
61
62 extern mapping_t job_type_m[];
63
64 /**
65 * @brief Job-Interface as it is stored in the job queue
66 *
67 * A job consists of a job-type and one or more assigned values
68 */
69 typedef struct job_s job_t;
70
71 struct job_s{
72
73 /**
74 * @brief get type of job
75 *
76 * @param this calling object
77 * @return type of this job
78 */
79 job_type_t (*get_type) (job_t *this);
80
81 /**
82 * @brief Destroys a job_t object and all assigned data!
83 *
84 * @param job_t calling object
85 * @returns SUCCESS if succeeded, FAILED otherwise
86 */
87 status_t (*destroy_all) (job_t *job);
88
89 /**
90 * @brief Destroys a job_t object
91 *
92 * @param job_t calling object
93 * @returns SUCCESS if succeeded, FAILED otherwise
94 */
95 status_t (*destroy) (job_t *job);
96 };
97
98 #include "initiate_ike_sa_job.h"
99 #include "delete_ike_sa_job.h"
100 #include "incoming_packet_job.h"
101
102
103
104 #endif /*JOB_H_*/