]>
Commit | Line | Data |
---|---|---|
0e39bf8a JH |
1 | /** |
2 | * @file job.h | |
3 | * | |
df3c59d0 | 4 | * @brief Interface job_t. |
0e39bf8a JH |
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 | ||
8080fccb JH |
26 | #include <types.h> |
27 | #include <definitions.h> | |
0e39bf8a | 28 | |
95c61cb9 JH |
29 | |
30 | typedef enum job_type_t job_type_t; | |
31 | ||
0e39bf8a | 32 | /** |
df3c59d0 MW |
33 | * @brief Definition of the various job types. |
34 | * | |
a6cbf648 MW |
35 | * @todo add more jobs, such as rekeying. |
36 | * | |
df3c59d0 | 37 | * @ingroup jobs |
0e39bf8a | 38 | */ |
95c61cb9 | 39 | enum job_type_t { |
0e39bf8a | 40 | /** |
e314700c | 41 | * Process an incoming IKEv2-Message. |
df917df7 JH |
42 | * |
43 | * Job is implemented in class type incoming_packet_job_t | |
0e39bf8a JH |
44 | */ |
45 | INCOMING_PACKET, | |
5534ee84 | 46 | |
0e39bf8a | 47 | /** |
e314700c | 48 | * Retransmit an IKEv2-Message. |
0e39bf8a JH |
49 | */ |
50 | RETRANSMIT_REQUEST, | |
5534ee84 | 51 | |
0e39bf8a | 52 | /** |
e314700c | 53 | * Establish an ike sa as initiator. |
df917df7 JH |
54 | * |
55 | * Job is implemented in class type initiate_ike_sa_job_t | |
0e39bf8a | 56 | */ |
9264ec57 | 57 | INITIATE_IKE_SA, |
a6cbf648 | 58 | |
9264ec57 | 59 | /** |
e314700c | 60 | * Delete an ike sa which is still not established. |
9264ec57 | 61 | * |
e314700c | 62 | * Job is implemented in class type delete_half_open_ike_sa_job_t |
9264ec57 | 63 | */ |
e314700c JH |
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 | |
0e39bf8a JH |
72 | }; |
73 | ||
df3c59d0 MW |
74 | /** |
75 | * string mappings for job_type_t | |
a6cbf648 MW |
76 | * |
77 | * @ingroup jobs | |
df3c59d0 | 78 | */ |
5dee5e68 | 79 | extern mapping_t job_type_m[]; |
0e39bf8a | 80 | |
95c61cb9 JH |
81 | |
82 | typedef struct job_t job_t; | |
83 | ||
0e39bf8a | 84 | /** |
df3c59d0 MW |
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. | |
0e39bf8a | 88 | * |
a6cbf648 MW |
89 | * @b Constructors: |
90 | * - None, use specific implementation of the interface. | |
91 | * | |
df3c59d0 | 92 | * @ingroup jobs |
0e39bf8a | 93 | */ |
df3c59d0 | 94 | struct job_t { |
df917df7 | 95 | |
0e39bf8a | 96 | /** |
df3c59d0 | 97 | * @brief get type of job. |
df917df7 JH |
98 | * |
99 | * @param this calling object | |
100 | * @return type of this job | |
0e39bf8a | 101 | */ |
df917df7 | 102 | job_type_t (*get_type) (job_t *this); |
0e39bf8a | 103 | |
f07a80d1 JH |
104 | /** |
105 | * @brief Destroys a job_t object and all assigned data! | |
106 | * | |
107 | * @param job_t calling object | |
f07a80d1 | 108 | */ |
df3c59d0 | 109 | void (*destroy_all) (job_t *job); |
f07a80d1 | 110 | |
0e39bf8a JH |
111 | /** |
112 | * @brief Destroys a job_t object | |
113 | * | |
114 | * @param job_t calling object | |
0e39bf8a | 115 | */ |
df3c59d0 | 116 | void (*destroy) (job_t *job); |
0e39bf8a JH |
117 | }; |
118 | ||
9264ec57 | 119 | |
0e39bf8a | 120 | #endif /*JOB_H_*/ |