ae2d27170ef42648cdea2f2cdf12c4e322ccd013
[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 /* more job types have to be inserted here */
53 };
54
55 extern mapping_t job_type_m[];
56
57 /**
58 * @brief Job-Interface as it is stored in the job queue
59 *
60 * A job consists of a job-type and one or more assigned values
61 */
62 typedef struct job_s job_t;
63
64 struct job_s{
65
66 /**
67 * @brief get type of job
68 *
69 * @param this calling object
70 * @return type of this job
71 */
72 job_type_t (*get_type) (job_t *this);
73
74 /**
75 * @brief Destroys a job_t object
76 *
77 * @param job_t calling object
78 * @returns SUCCESS if succeeded, FAILED otherwise
79 */
80 status_t (*destroy) (job_t *job);
81 };
82
83 #include "initiate_ike_sa_job.h"
84 #include "incoming_packet_job.h"
85
86 #endif /*JOB_H_*/