fixed sleep command in ikev1/esp-ah-tunnel scenario
[strongswan.git] / src / stroke / stroke_msg.h
1 /**
2 * @file stroke_msg.h
3 *
4 * @brief Definition of stroke_msg_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2006 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 STROKE_MSG_H_
24 #define STROKE_MSG_H_
25
26 #include <sys/types.h>
27
28 #include <library.h>
29
30 /**
31 * Socket which is used to communicate between charon and stroke
32 */
33 #define STROKE_SOCKET IPSEC_PIDDIR "/charon.ctl"
34
35 #define STROKE_BUF_LEN 2048
36
37 typedef enum list_flag_t list_flag_t;
38
39 /**
40 * Definition of the LIST flags, used for
41 * the various stroke list* commands.
42 */
43 enum list_flag_t {
44 /** don't list anything */
45 LIST_NONE = 0x0000,
46 /** list all raw public keys */
47 LIST_PUBKEYS = 0x0001,
48 /** list all host/user certs */
49 LIST_CERTS = 0x0002,
50 /** list all ca certs */
51 LIST_CACERTS = 0x0004,
52 /** list all ocsp signer certs */
53 LIST_OCSPCERTS = 0x0008,
54 /** list all aa certs */
55 LIST_AACERTS = 0x0010,
56 /** list all attribute certs */
57 LIST_ACERTS = 0x0020,
58 /** list all access control groups */
59 LIST_GROUPS = 0x0040,
60 /** list all ca information records */
61 LIST_CAINFOS = 0x0080,
62 /** list all crls */
63 LIST_CRLS = 0x0100,
64 /** list all ocsp cache entries */
65 LIST_OCSP = 0x0200,
66 /** list all supported algorithms */
67 LIST_ALGS = 0x0400,
68 /** all list options */
69 LIST_ALL = 0x07FF,
70 };
71
72 typedef enum reread_flag_t reread_flag_t;
73
74 /**
75 * Definition of the REREAD flags, used for
76 * the various stroke reread* commands.
77 */
78 enum reread_flag_t {
79 /** don't reread anything */
80 REREAD_NONE = 0x0000,
81 /** reread all secret keys */
82 REREAD_SECRETS = 0x0001,
83 /** reread all ca certs */
84 REREAD_CACERTS = 0x0002,
85 /** reread all ocsp signer certs */
86 REREAD_OCSPCERTS = 0x0004,
87 /** reread all aa certs */
88 REREAD_AACERTS = 0x0008,
89 /** reread all attribute certs */
90 REREAD_ACERTS = 0x0010,
91 /** reread all crls */
92 REREAD_CRLS = 0x0020,
93 /** all reread options */
94 REREAD_ALL = 0x003F,
95 };
96
97 typedef enum purge_flag_t purge_flag_t;
98
99 /**
100 * Definition of the PURGE flags, currently used for
101 * the stroke purgeocsp command.
102 */
103 enum purge_flag_t {
104 /** don't purge anything */
105 PURGE_NONE = 0x0000,
106 /** purge ocsp cache entries */
107 PURGE_OCSP = 0x0001,
108 /** purge CRL cache entries */
109 PURGE_CRLS = 0x0002,
110 /** purge X509 cache entries */
111 PURGE_CERTS = 0x0004,
112 /** purge IKE_SAs without a CHILD_SA */
113 PURGE_IKE = 0x0008,
114 };
115
116 typedef enum export_flag_t export_flag_t;
117
118 /**
119 * Definition of the export flags
120 */
121 enum export_flag_t {
122 /** export an X509 certificate */
123 EXPORT_X509 = 0x0001,
124 };
125
126 /**
127 * CRL certificate validation policy
128 */
129 typedef enum {
130 CRL_STRICT_NO,
131 CRL_STRICT_YES,
132 CRL_STRICT_IFURI,
133 } crl_policy_t;
134
135
136 typedef struct stroke_end_t stroke_end_t;
137
138 /**
139 * definition of a peer in a stroke message
140 */
141 struct stroke_end_t {
142 char *auth;
143 char *auth2;
144 char *id;
145 char *id2;
146 char *eap_id;
147 char *cert;
148 char *cert2;
149 char *ca;
150 char *ca2;
151 char *groups;
152 char *cert_policy;
153 char *updown;
154 char *address;
155 u_int16_t ikeport;
156 char *sourceip;
157 int sourceip_mask;
158 char *subnets;
159 int sendcert;
160 int hostaccess;
161 int tohost;
162 u_int8_t protocol;
163 u_int16_t port;
164 };
165
166 typedef struct stroke_msg_t stroke_msg_t;
167
168 /**
169 * @brief A stroke message sent over the unix socket.
170 */
171 struct stroke_msg_t {
172 /* length of this message with all strings */
173 u_int16_t length;
174
175 /* type of the message */
176 enum {
177 /* initiate a connection */
178 STR_INITIATE,
179 /* install SPD entries for a policy */
180 STR_ROUTE,
181 /* uninstall SPD entries for a policy */
182 STR_UNROUTE,
183 /* add a connection */
184 STR_ADD_CONN,
185 /* delete a connection */
186 STR_DEL_CONN,
187 /* terminate connection */
188 STR_TERMINATE,
189 /* terminate connection by peers srcip/virtual ip */
190 STR_TERMINATE_SRCIP,
191 /* rekey a connection */
192 STR_REKEY,
193 /* show connection status */
194 STR_STATUS,
195 /* show verbose connection status */
196 STR_STATUS_ALL,
197 /* show verbose connection status, non-blocking variant */
198 STR_STATUS_ALL_NOBLK,
199 /* add a ca information record */
200 STR_ADD_CA,
201 /* delete ca information record */
202 STR_DEL_CA,
203 /* set a log type to log/not log */
204 STR_LOGLEVEL,
205 /* configure global options for stroke */
206 STR_CONFIG,
207 /* list various objects */
208 STR_LIST,
209 /* reread various objects */
210 STR_REREAD,
211 /* purge various objects */
212 STR_PURGE,
213 /* show pool leases */
214 STR_LEASES,
215 /* export credentials */
216 STR_EXPORT,
217 /* print memory usage details */
218 STR_MEMUSAGE,
219 /* more to come */
220 } type;
221
222 /* verbosity of output returned from charon (-from -1=silent to 4=private)*/
223 int output_verbosity;
224
225 union {
226 /* data for STR_INITIATE, STR_ROUTE, STR_UP, STR_DOWN, ... */
227 struct {
228 char *name;
229 } initiate, route, unroute, terminate, rekey, status, del_conn, del_ca;
230
231 /* data for STR_TERMINATE_SRCIP */
232 struct {
233 char *start;
234 char *end;
235 } terminate_srcip;
236
237 /* data for STR_ADD_CONN */
238 struct {
239 char *name;
240 int ikev2;
241 /* next three are deprecated, use stroke_end_t.auth instead */
242 int auth_method;
243 u_int32_t eap_type;
244 u_int32_t eap_vendor;
245 char *eap_identity;
246 char *aaa_identity;
247 int mode;
248 int mobike;
249 int force_encap;
250 int ipcomp;
251 time_t inactivity;
252 int proxy_mode;
253 int install_policy;
254 u_int32_t reqid;
255 u_int32_t tfc;
256
257 crl_policy_t crl_policy;
258 int unique;
259 struct {
260 char *ike;
261 char *esp;
262 } algorithms;
263 struct {
264 int reauth;
265 time_t ipsec_lifetime;
266 time_t ike_lifetime;
267 time_t margin;
268 u_int64_t life_bytes;
269 u_int64_t margin_bytes;
270 u_int64_t life_packets;
271 u_int64_t margin_packets;
272 unsigned long tries;
273 unsigned long fuzz;
274 } rekey;
275 struct {
276 time_t delay;
277 int action;
278 } dpd;
279 struct {
280 int mediation;
281 char *mediated_by;
282 char *peerid;
283 } ikeme;
284 struct {
285 u_int32_t value;
286 u_int32_t mask;
287 } mark_in, mark_out;
288 stroke_end_t me, other;
289 } add_conn;
290
291 /* data for STR_ADD_CA */
292 struct {
293 char *name;
294 char *cacert;
295 char *crluri;
296 char *crluri2;
297 char *ocspuri;
298 char *ocspuri2;
299 char *certuribase;
300 } add_ca;
301
302 /* data for STR_LOGLEVEL */
303 struct {
304 char *type;
305 int level;
306 } loglevel;
307
308 /* data for STR_CONFIG */
309 struct {
310 int cachecrl;
311 } config;
312
313 /* data for STR_LIST */
314 struct {
315 list_flag_t flags;
316 int utc;
317 } list;
318
319 /* data for STR_REREAD */
320 struct {
321 reread_flag_t flags;
322 } reread;
323
324 /* data for STR_PURGE */
325 struct {
326 purge_flag_t flags;
327 } purge;
328
329 /* data for STR_EXPORT */
330 struct {
331 export_flag_t flags;
332 char *selector;
333 } export;
334
335 /* data for STR_LEASES */
336 struct {
337 char *pool;
338 char *address;
339 } leases;
340 };
341 char buffer[STROKE_BUF_LEN];
342 };
343
344 #endif /* STROKE_MSG_H_ */