added RCSID
[strongswan.git] / src / stroke / stroke.h
1 /**
2 * @file stroke.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_H_
26 #define STROKE_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 "/var/run/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 host/user certs */
47 LIST_CERTS = 0x0001,
48 /** list all ca certs */
49 LIST_CACERTS = 0x0002,
50 /** list all ocsp signer certs */
51 LIST_OCSPCERTS = 0x0004,
52 /** list all aa certs */
53 LIST_AACERTS = 0x0008,
54 /** list all attribute certs */
55 LIST_ACERTS = 0x0010,
56 /** list all access control groups */
57 LIST_GROUPS = 0x0020,
58 /** list all ca information records */
59 LIST_CAINFOS = 0x0040,
60 /** list all crls */
61 LIST_CRLS = 0x0080,
62 /** list all ocsp cache entries */
63 LIST_OCSP = 0x0100,
64 /** all list options */
65 LIST_ALL = 0x01FF,
66 };
67
68 typedef enum reread_flag_t reread_flag_t;
69
70 /**
71 * Definition of the REREAD flags, used for
72 * the various stroke reread* commands.
73 */
74 enum reread_flag_t {
75 /** don't reread anything */
76 REREAD_NONE = 0x0000,
77 /** reread all secret keys */
78 REREAD_SECRETS = 0x0001,
79 /** reread all ca certs */
80 REREAD_CACERTS = 0x0002,
81 /** reread all ocsp signer certs */
82 REREAD_OCSPCERTS = 0x0004,
83 /** reread all aa certs */
84 REREAD_AACERTS = 0x0008,
85 /** reread all attribute certs */
86 REREAD_ACERTS = 0x0010,
87 /** reread all crls */
88 REREAD_CRLS = 0x0020,
89 /** all reread options */
90 REREAD_ALL = 0x003F,
91 };
92
93 typedef enum purge_flag_t purge_flag_t;
94
95 /**
96 * Definition of the PURGE flags, currently used for
97 * the stroke purgeocsp command.
98 */
99 enum purge_flag_t {
100 /** don't purge anything */
101 PURGE_NONE = 0x0000,
102 /** purge ocsp cache entries */
103 PURGE_OCSP = 0x0001,
104 };
105
106 typedef struct stroke_end_t stroke_end_t;
107
108 /**
109 * definition of a peer in a stroke message
110 */
111 struct stroke_end_t {
112 char *id;
113 char *cert;
114 char *ca;
115 char *groups;
116 char *updown;
117 char *address;
118 char *sourceip;
119 u_int8_t virtual_ip;
120 char *subnet;
121 int subnet_mask;
122 int sendcert;
123 int hostaccess;
124 int tohost;
125 u_int8_t protocol;
126 u_int16_t port;
127 };
128
129 typedef struct stroke_msg_t stroke_msg_t;
130
131 /**
132 * @brief A stroke message sent over the unix socket.
133 */
134 struct stroke_msg_t {
135 /* length of this message with all strings */
136 u_int16_t length;
137
138 /* type of the message */
139 enum {
140 /* initiate a connection */
141 STR_INITIATE,
142 /* install SPD entries for a policy */
143 STR_ROUTE,
144 /* uninstall SPD entries for a policy */
145 STR_UNROUTE,
146 /* add a connection */
147 STR_ADD_CONN,
148 /* delete a connection */
149 STR_DEL_CONN,
150 /* terminate connection */
151 STR_TERMINATE,
152 /* show connection status */
153 STR_STATUS,
154 /* show verbose connection status */
155 STR_STATUS_ALL,
156 /* add a ca information record */
157 STR_ADD_CA,
158 /* delete ca information record */
159 STR_DEL_CA,
160 /* set a log type to log/not log */
161 STR_LOGLEVEL,
162 /* list various objects */
163 STR_LIST,
164 /* reread various objects */
165 STR_REREAD,
166 /* purge various objects */
167 STR_PURGE
168 /* more to come */
169 } type;
170
171 /* verbosity of output returned from charon (-from -1=silent to 4=private)*/
172 int output_verbosity;
173
174 union {
175 /* data for STR_INITIATE, STR_ROUTE, STR_UP, STR_DOWN, ... */
176 struct {
177 char *name;
178 } initiate, route, unroute, terminate, status, del_conn, del_ca;
179
180 /* data for STR_ADD_CONN */
181 struct {
182 char *name;
183 int ikev2;
184 int auth_method;
185 int eap_type;
186 int mode;
187 int mobike;
188 int force_encap;
189 struct {
190 char *ike;
191 char *esp;
192 } algorithms;
193 struct {
194 int reauth;
195 time_t ipsec_lifetime;
196 time_t ike_lifetime;
197 time_t margin;
198 unsigned long tries;
199 unsigned long fuzz;
200 } rekey;
201 struct {
202 time_t delay;
203 int action;
204 } dpd;
205 struct {
206 int mediation;
207 char *mediated_by;
208 char *peerid;
209 } p2p;
210 stroke_end_t me, other;
211 } add_conn;
212
213 /* data for STR_ADD_CA */
214 struct {
215 char *name;
216 char *cacert;
217 char *crluri;
218 char *crluri2;
219 char *ocspuri;
220 char *ocspuri2;
221 } add_ca;
222
223 /* data for STR_LOGLEVEL */
224 struct {
225 char *type;
226 int level;
227 } loglevel;
228
229 /* data for STR_LIST */
230 struct {
231 list_flag_t flags;
232 int utc;
233 } list;
234
235 /* data for STR_REREAD */
236 struct {
237 reread_flag_t flags;
238 } reread;
239
240 /* data for STR_PURGE */
241 struct {
242 purge_flag_t flags;
243 } purge;
244 };
245 char buffer[STROKE_BUF_LEN];
246 };
247
248 #endif /* STROKE_H_ */