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