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