Added a ipsec.conf "inactivity" option to configure inactivity timeout for CHILD_SAs
[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 IKE_SAs without a CHILD_SA */
109 PURGE_IKE = 0x0002,
110 };
111
112 /**
113 * CRL certificate validation policy
114 */
115 typedef enum {
116 CRL_STRICT_NO,
117 CRL_STRICT_YES,
118 CRL_STRICT_IFURI,
119 } crl_policy_t;
120
121
122 typedef struct stroke_end_t stroke_end_t;
123
124 /**
125 * definition of a peer in a stroke message
126 */
127 struct stroke_end_t {
128 char *auth;
129 char *auth2;
130 char *id;
131 char *id2;
132 char *eap_id;
133 char *cert;
134 char *cert2;
135 char *ca;
136 char *ca2;
137 char *groups;
138 char *updown;
139 char *address;
140 char *sourceip;
141 int sourceip_mask;
142 char *subnets;
143 int sendcert;
144 int hostaccess;
145 int tohost;
146 u_int8_t protocol;
147 u_int16_t port;
148 };
149
150 typedef struct stroke_msg_t stroke_msg_t;
151
152 /**
153 * @brief A stroke message sent over the unix socket.
154 */
155 struct stroke_msg_t {
156 /* length of this message with all strings */
157 u_int16_t length;
158
159 /* type of the message */
160 enum {
161 /* initiate a connection */
162 STR_INITIATE,
163 /* install SPD entries for a policy */
164 STR_ROUTE,
165 /* uninstall SPD entries for a policy */
166 STR_UNROUTE,
167 /* add a connection */
168 STR_ADD_CONN,
169 /* delete a connection */
170 STR_DEL_CONN,
171 /* terminate connection */
172 STR_TERMINATE,
173 /* terminate connection by peers srcip/virtual ip */
174 STR_TERMINATE_SRCIP,
175 /* show connection status */
176 STR_STATUS,
177 /* show verbose connection status */
178 STR_STATUS_ALL,
179 /* add a ca information record */
180 STR_ADD_CA,
181 /* delete ca information record */
182 STR_DEL_CA,
183 /* set a log type to log/not log */
184 STR_LOGLEVEL,
185 /* configure global options for stroke */
186 STR_CONFIG,
187 /* list various objects */
188 STR_LIST,
189 /* reread various objects */
190 STR_REREAD,
191 /* purge various objects */
192 STR_PURGE,
193 /* show pool leases */
194 STR_LEASES,
195 /* more to come */
196 } type;
197
198 /* verbosity of output returned from charon (-from -1=silent to 4=private)*/
199 int output_verbosity;
200
201 union {
202 /* data for STR_INITIATE, STR_ROUTE, STR_UP, STR_DOWN, ... */
203 struct {
204 char *name;
205 } initiate, route, unroute, terminate, status, del_conn, del_ca;
206
207 /* data for STR_TERMINATE_SRCIP */
208 struct {
209 char *start;
210 char *end;
211 } terminate_srcip;
212
213 /* data for STR_ADD_CONN */
214 struct {
215 char *name;
216 int ikev2;
217 /* next three are deprecated, use stroke_end_t.auth instead */
218 int auth_method;
219 u_int32_t eap_type;
220 u_int32_t eap_vendor;
221 char *eap_identity;
222 int mode;
223 int mobike;
224 int force_encap;
225 int ipcomp;
226 time_t inactivity;
227 int proxy_mode;
228 int install_policy;
229
230 crl_policy_t crl_policy;
231 int unique;
232 struct {
233 char *ike;
234 char *esp;
235 } algorithms;
236 struct {
237 int reauth;
238 time_t ipsec_lifetime;
239 time_t ike_lifetime;
240 time_t margin;
241 u_int64_t life_bytes;
242 u_int64_t margin_bytes;
243 u_int64_t life_packets;
244 u_int64_t margin_packets;
245 unsigned long tries;
246 unsigned long fuzz;
247 } rekey;
248 struct {
249 time_t delay;
250 int action;
251 } dpd;
252 struct {
253 int mediation;
254 char *mediated_by;
255 char *peerid;
256 } ikeme;
257 stroke_end_t me, other;
258 } add_conn;
259
260 /* data for STR_ADD_CA */
261 struct {
262 char *name;
263 char *cacert;
264 char *crluri;
265 char *crluri2;
266 char *ocspuri;
267 char *ocspuri2;
268 char *certuribase;
269 } add_ca;
270
271 /* data for STR_LOGLEVEL */
272 struct {
273 char *type;
274 int level;
275 } loglevel;
276
277 /* data for STR_CONFIG */
278 struct {
279 int cachecrl;
280 } config;
281
282 /* data for STR_LIST */
283 struct {
284 list_flag_t flags;
285 int utc;
286 } list;
287
288 /* data for STR_REREAD */
289 struct {
290 reread_flag_t flags;
291 } reread;
292
293 /* data for STR_PURGE */
294 struct {
295 purge_flag_t flags;
296 } purge;
297
298 /* data for STR_LEASES */
299 struct {
300 char *pool;
301 char *address;
302 } leases;
303 };
304 char buffer[STROKE_BUF_LEN];
305 };
306
307 #endif /* STROKE_MSG_H_ */