]> git.ipfire.org Git - thirdparty/strongswan.git/blame - src/stroke/stroke_msg.h
ike: Float to port 4500 if either port is 500
[thirdparty/strongswan.git] / src / stroke / stroke_msg.h
CommitLineData
3dbbbf3e 1/*
d8fe354a 2 * Copyright (C) 2015 Tobias Brunner
3dbbbf3e
MW
3 * Copyright (C) 2006 Martin Willi
4 * Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
552cc11b
MW
17#ifndef STROKE_MSG_H_
18#define STROKE_MSG_H_
3dbbbf3e 19
aed58dcc
MW
20#include <sys/types.h>
21
cc396286
TB
22#include <library.h>
23
fcfeb322
MW
24/**
25 * Socket which is used to communicate between charon and stroke
26 */
552cc11b 27#define STROKE_SOCKET IPSEC_PIDDIR "/charon.ctl"
3dbbbf3e 28
d8fe354a
TB
29/**
30 * Number of bytes by which the buffer is increased as needed
31 */
32#define STROKE_BUF_LEN_INC 1024
fcfeb322 33
aed58dcc
MW
34typedef enum list_flag_t list_flag_t;
35
53472332 36/**
aed58dcc
MW
37 * Definition of the LIST flags, used for
38 * the various stroke list* commands.
39 */
40enum list_flag_t {
41 /** don't list anything */
34d7935e 42 LIST_NONE = 0x0000,
d1cbe551
AS
43 /** list all raw public keys */
44 LIST_PUBKEYS = 0x0001,
aed58dcc 45 /** list all host/user certs */
d1cbe551 46 LIST_CERTS = 0x0002,
aed58dcc 47 /** list all ca certs */
d1cbe551 48 LIST_CACERTS = 0x0004,
34d7935e 49 /** list all ocsp signer certs */
d1cbe551 50 LIST_OCSPCERTS = 0x0008,
f9e0dc3e 51 /** list all aa certs */
d1cbe551 52 LIST_AACERTS = 0x0010,
f9e0dc3e 53 /** list all attribute certs */
d1cbe551 54 LIST_ACERTS = 0x0020,
f9e0dc3e 55 /** list all access control groups */
d1cbe551 56 LIST_GROUPS = 0x0040,
34d7935e 57 /** list all ca information records */
d1cbe551 58 LIST_CAINFOS = 0x0080,
aed58dcc 59 /** list all crls */
d1cbe551 60 LIST_CRLS = 0x0100,
34d7935e 61 /** list all ocsp cache entries */
d1cbe551 62 LIST_OCSP = 0x0200,
94822086 63 /** list all supported algorithms */
d1cbe551 64 LIST_ALGS = 0x0400,
2d2ffa58
MW
65 /** list plugin information */
66 LIST_PLUGINS = 0x0800,
aed58dcc 67 /** all list options */
d022322b 68 LIST_ALL = 0x0FFF,
aed58dcc
MW
69};
70
71typedef enum reread_flag_t reread_flag_t;
53472332 72
76dafed7 73/**
aed58dcc
MW
74 * Definition of the REREAD flags, used for
75 * the various stroke reread* commands.
76 */
77enum reread_flag_t {
78 /** don't reread anything */
34d7935e 79 REREAD_NONE = 0x0000,
84db8333
AS
80 /** reread all secret keys */
81 REREAD_SECRETS = 0x0001,
aed58dcc 82 /** reread all ca certs */
84db8333 83 REREAD_CACERTS = 0x0002,
34d7935e 84 /** reread all ocsp signer certs */
84db8333 85 REREAD_OCSPCERTS = 0x0004,
f9e0dc3e 86 /** reread all aa certs */
84db8333 87 REREAD_AACERTS = 0x0008,
f9e0dc3e 88 /** reread all attribute certs */
84db8333 89 REREAD_ACERTS = 0x0010,
aed58dcc 90 /** reread all crls */
84db8333 91 REREAD_CRLS = 0x0020,
aed58dcc 92 /** all reread options */
84db8333 93 REREAD_ALL = 0x003F,
34d7935e
AS
94};
95
96typedef enum purge_flag_t purge_flag_t;
97
98/**
99 * Definition of the PURGE flags, currently used for
100 * the stroke purgeocsp command.
101 */
102enum purge_flag_t {
103 /** don't purge anything */
104 PURGE_NONE = 0x0000,
105 /** purge ocsp cache entries */
106 PURGE_OCSP = 0x0001,
6aa144dd 107 /** purge CRL cache entries */
fc2e43eb 108 PURGE_CRLS = 0x0002,
6aa144dd 109 /** purge X509 cache entries */
fc2e43eb
MW
110 PURGE_CERTS = 0x0004,
111 /** purge IKE_SAs without a CHILD_SA */
112 PURGE_IKE = 0x0008,
aed58dcc 113};
76dafed7 114
3d711a68
MW
115typedef enum export_flag_t export_flag_t;
116
117/**
118 * Definition of the export flags
119 */
120enum export_flag_t {
121 /** export an X509 certificate */
122 EXPORT_X509 = 0x0001,
de2debf8
MW
123 /** export an X509 end entity certificate for a connection */
124 EXPORT_CONN_CERT = 0x0002,
125 /** export the complete trust chain of a connection */
126 EXPORT_CONN_CHAIN = 0x0004,
3d711a68
MW
127};
128
552cc11b
MW
129/**
130 * CRL certificate validation policy
131 */
132typedef enum {
133 CRL_STRICT_NO,
134 CRL_STRICT_YES,
135 CRL_STRICT_IFURI,
136} crl_policy_t;
137
138
b7f9ca58
AS
139typedef struct stroke_end_t stroke_end_t;
140
aed58dcc
MW
141/**
142 * definition of a peer in a stroke message
143 */
b7f9ca58 144struct stroke_end_t {
a44bb934
MW
145 char *auth;
146 char *auth2;
b7f9ca58 147 char *id;
a44bb934
MW
148 char *id2;
149 char *eap_id;
5f1931ad 150 char *rsakey;
b7f9ca58 151 char *cert;
a44bb934 152 char *cert2;
b7f9ca58 153 char *ca;
a44bb934 154 char *ca2;
3eb96300 155 char *groups;
46df61df 156 char *groups2;
6367de28 157 char *cert_policy;
e5382ce7 158 char *updown;
b7f9ca58 159 char *address;
b12c53ce 160 uint16_t ikeport;
c60c7694 161 char *sourceip;
17319aa2 162 char *dns;
34443902 163 char *subnets;
aed58dcc 164 int sendcert;
db7ef624 165 int hostaccess;
0c8aba67 166 int tohost;
1d315bdd 167 int allow_any;
b12c53ce
AS
168 uint8_t protocol;
169 uint16_t from_port;
170 uint16_t to_port;
b7f9ca58
AS
171};
172
fcfeb322
MW
173typedef struct stroke_msg_t stroke_msg_t;
174
3dbbbf3e
MW
175/**
176 * @brief A stroke message sent over the unix socket.
3dbbbf3e 177 */
3dbbbf3e
MW
178struct stroke_msg_t {
179 /* length of this message with all strings */
b12c53ce 180 uint16_t length;
86a7937b 181
3dbbbf3e
MW
182 /* type of the message */
183 enum {
184 /* initiate a connection */
185 STR_INITIATE,
45f76a7d
MW
186 /* install SPD entries for a policy */
187 STR_ROUTE,
188 /* uninstall SPD entries for a policy */
189 STR_UNROUTE,
3dbbbf3e
MW
190 /* add a connection */
191 STR_ADD_CONN,
192 /* delete a connection */
193 STR_DEL_CONN,
194 /* terminate connection */
195 STR_TERMINATE,
13106499
MW
196 /* terminate connection by peers srcip/virtual ip */
197 STR_TERMINATE_SRCIP,
851d6048
MW
198 /* rekey a connection */
199 STR_REKEY,
3dbbbf3e
MW
200 /* show connection status */
201 STR_STATUS,
e168ee17
MW
202 /* show verbose connection status */
203 STR_STATUS_ALL,
a694b481
MW
204 /* show verbose connection status, non-blocking variant */
205 STR_STATUS_ALL_NOBLK,
34d7935e
AS
206 /* add a ca information record */
207 STR_ADD_CA,
208 /* delete ca information record */
209 STR_DEL_CA,
3dbbbf3e 210 /* set a log type to log/not log */
3dbbbf3e 211 STR_LOGLEVEL,
b360e393
MW
212 /* configure global options for stroke */
213 STR_CONFIG,
76dafed7
AS
214 /* list various objects */
215 STR_LIST,
216 /* reread various objects */
34d7935e
AS
217 STR_REREAD,
218 /* purge various objects */
6b83549d
MW
219 STR_PURGE,
220 /* show pool leases */
221 STR_LEASES,
3d711a68
MW
222 /* export credentials */
223 STR_EXPORT,
dfe9bad9
MW
224 /* print memory usage details */
225 STR_MEMUSAGE,
9f1b303a
TB
226 /* set username and password for a connection */
227 STR_USER_CREDS,
cf729248 228 /* print/reset counters */
d022322b 229 STR_COUNTERS,
3dbbbf3e
MW
230 /* more to come */
231 } type;
7daf5226 232
5c4cc9a4
MW
233 /* verbosity of output returned from charon (-from -1=silent to 4=private)*/
234 int output_verbosity;
86a7937b 235
3dbbbf3e 236 union {
45f76a7d 237 /* data for STR_INITIATE, STR_ROUTE, STR_UP, STR_DOWN, ... */
3dbbbf3e
MW
238 struct {
239 char *name;
851d6048 240 } initiate, route, unroute, terminate, rekey, status, del_conn, del_ca;
7daf5226 241
13106499
MW
242 /* data for STR_TERMINATE_SRCIP */
243 struct {
244 char *start;
245 char *end;
246 } terminate_srcip;
ecadab2b 247
3dbbbf3e
MW
248 /* data for STR_ADD_CONN */
249 struct {
250 char *name;
d94c9236 251 int version;
82290106 252 char *eap_identity;
64d7b073 253 char *aaa_identity;
21a4fc83 254 char *xauth_identity;
7652be89 255 int mode;
9164e49a 256 int mobike;
e129168b 257 int aggressive;
2bae838d 258 int pushmode;
9dae1bed 259 int force_encap;
97973f86 260 int fragmentation;
d4aad554 261 int ipcomp;
8015c91c 262 time_t inactivity;
c117f24e 263 int proxy_mode;
d487b4b7 264 int install_policy;
f34ebc84 265 int close_action;
b12c53ce
AS
266 uint32_t reqid;
267 uint32_t tfc;
268 uint8_t ikedscp;
d487b4b7 269
552cc11b 270 crl_policy_t crl_policy;
0644ebd3 271 int unique;
c095388f
MW
272 struct {
273 char *ike;
274 char *esp;
a07b97e8 275 char *ah;
c095388f 276 } algorithms;
a2a3fb3e 277 struct {
6fe03b0a 278 int reauth;
a2a3fb3e
MW
279 time_t ipsec_lifetime;
280 time_t ike_lifetime;
281 time_t margin;
b12c53ce
AS
282 uint64_t life_bytes;
283 uint64_t margin_bytes;
284 uint64_t life_packets;
285 uint64_t margin_packets;
a2a3fb3e
MW
286 unsigned long tries;
287 unsigned long fuzz;
288 } rekey;
a655f5c0
MW
289 struct {
290 time_t delay;
80c5b17d 291 time_t timeout;
1239c6f4 292 int action;
a655f5c0 293 } dpd;
d5cc1758
TB
294 struct {
295 int mediation;
296 char *mediated_by;
297 char *peerid;
dc04b7c7 298 } ikeme;
ee26c537 299 struct {
b12c53ce
AS
300 uint32_t value;
301 uint32_t mask;
26c4d010 302 } mark_in, mark_out;
b7f9ca58 303 stroke_end_t me, other;
b12c53ce 304 uint32_t replay_window;
4270c8fc 305 bool sha256_96;
3dbbbf3e 306 } add_conn;
ecadab2b 307
34d7935e
AS
308 /* data for STR_ADD_CA */
309 struct {
310 char *name;
311 char *cacert;
312 char *crluri;
313 char *crluri2;
314 char *ocspuri;
f13570a0 315 char *ocspuri2;
6439267a 316 char *certuribase;
34d7935e
AS
317 } add_ca;
318
53472332 319 /* data for STR_LOGLEVEL */
3dbbbf3e 320 struct {
0ae1deb8 321 char *type;
7ba69503 322 int level;
3dbbbf3e 323 } loglevel;
7daf5226 324
b360e393
MW
325 /* data for STR_CONFIG */
326 struct {
327 int cachecrl;
328 } config;
53472332
AS
329
330 /* data for STR_LIST */
331 struct {
aed58dcc 332 list_flag_t flags;
db7ef624 333 int utc;
53472332 334 } list;
76dafed7
AS
335
336 /* data for STR_REREAD */
337 struct {
aed58dcc 338 reread_flag_t flags;
76dafed7
AS
339 } reread;
340
34d7935e
AS
341 /* data for STR_PURGE */
342 struct {
343 purge_flag_t flags;
344 } purge;
6b83549d 345
3d711a68
MW
346 /* data for STR_EXPORT */
347 struct {
348 export_flag_t flags;
349 char *selector;
350 } export;
351
6b83549d
MW
352 /* data for STR_LEASES */
353 struct {
354 char *pool;
355 char *address;
356 } leases;
9f1b303a
TB
357
358 /* data for STR_USER_CREDS */
359 struct {
360 char *name;
361 char *username;
362 char *password;
363 } user_creds;
d022322b
MW
364
365 /* data for STR_COUNTERS */
366 struct {
cf729248
MW
367 /* reset or print counters? */
368 int reset;
d022322b
MW
369 char *name;
370 } counters;
3dbbbf3e 371 };
d8fe354a 372 /* length of the string buffer */
b12c53ce 373 uint16_t buflen;
d8fe354a
TB
374 /* string buffer */
375 char buffer[];
3dbbbf3e
MW
376};
377
552cc11b 378#endif /* STROKE_MSG_H_ */