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