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