Added keywords for the new lifetime limits to starter.
[strongswan.git] / src / starter / confread.h
1 /* strongSwan IPsec config file parser
2 * Copyright (C) 2001-2002 Mathieu Lafon
3 * Arkoon Network Security
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #ifndef _IPSEC_CONFREAD_H_
17 #define _IPSEC_CONFREAD_H_
18
19 #ifndef _FREESWAN_H
20 #include <freeswan.h>
21 #endif
22
23 #include "parser.h"
24 #include "interfaces.h"
25
26 typedef enum {
27 STARTUP_NO,
28 STARTUP_ADD,
29 STARTUP_ROUTE,
30 STARTUP_START
31 } startup_t;
32
33 typedef enum {
34 STATE_IGNORE,
35 STATE_TO_ADD,
36 STATE_ADDED,
37 STATE_REPLACED,
38 STATE_INVALID
39 } starter_state_t;
40
41 typedef enum {
42 KEY_EXCHANGE_IKE,
43 KEY_EXCHANGE_IKEV1,
44 KEY_EXCHANGE_IKEV2
45 } keyexchange_t;
46
47 typedef enum {
48 STRICT_NO,
49 STRICT_YES,
50 STRICT_IFURI
51 } strict_t;
52
53 typedef struct starter_end starter_end_t;
54
55 struct starter_end {
56 lset_t seen;
57 char *auth;
58 char *auth2;
59 char *id;
60 char *id2;
61 char *rsakey;
62 char *cert;
63 char *cert2;
64 char *ca;
65 char *ca2;
66 char *groups;
67 char *iface;
68 ip_address addr;
69 ip_address nexthop;
70 char *subnet;
71 bool has_client;
72 bool has_client_wildcard;
73 bool has_port_wildcard;
74 bool has_natip;
75 bool has_virt;
76 bool modecfg;
77 certpolicy_t sendcert;
78 bool firewall;
79 bool hostaccess;
80 bool allow_any;
81 bool dns_failed;
82 char *updown;
83 u_int16_t port;
84 u_int8_t protocol;
85 char *srcip;
86 };
87
88 typedef struct also also_t;
89
90 struct also {
91 char *name;
92 bool included;
93 also_t *next;
94 };
95
96 typedef struct starter_conn starter_conn_t;
97
98 struct starter_conn {
99 lset_t seen;
100 char *name;
101 also_t *also;
102 kw_list_t *kw;
103 u_int visit;
104 startup_t startup;
105 starter_state_t state;
106
107 keyexchange_t keyexchange;
108 u_int32_t eap_type;
109 u_int32_t eap_vendor;
110 char *eap_identity;
111 lset_t policy;
112 time_t sa_ike_life_seconds;
113 time_t sa_ipsec_life_seconds;
114 time_t sa_rekey_margin;
115 u_int64_t sa_ipsec_life_bytes;
116 u_int64_t sa_ipsec_margin_bytes;
117 u_int64_t sa_ipsec_life_packets;
118 u_int64_t sa_ipsec_margin_packets;
119 unsigned long sa_keying_tries;
120 unsigned long sa_rekey_fuzz;
121 sa_family_t addr_family;
122 sa_family_t tunnel_addr_family;
123 bool install_policy;
124 starter_end_t left, right;
125
126 unsigned long id;
127
128 char *esp;
129 char *ike;
130 char *pfsgroup;
131
132 time_t dpd_delay;
133 time_t dpd_timeout;
134 dpd_action_t dpd_action;
135 int dpd_count;
136
137 bool me_mediation;
138 char *me_mediated_by;
139 char *me_peerid;
140
141 starter_conn_t *next;
142 };
143
144 typedef struct starter_ca starter_ca_t;
145
146 struct starter_ca {
147 lset_t seen;
148 char *name;
149 also_t *also;
150 kw_list_t *kw;
151 u_int visit;
152 startup_t startup;
153 starter_state_t state;
154
155 char *cacert;
156 char *ldaphost;
157 char *ldapbase;
158 char *crluri;
159 char *crluri2;
160 char *ocspuri;
161 char *ocspuri2;
162 char *certuribase;
163
164 bool strict;
165
166 starter_ca_t *next;
167 };
168
169 typedef struct starter_config starter_config_t;
170
171 struct starter_config {
172 struct {
173 lset_t seen;
174 char **interfaces;
175 char *dumpdir;
176 bool charonstart;
177 bool plutostart;
178
179 /* pluto/charon keywords */
180 char **plutodebug;
181 char *charondebug;
182 char *prepluto;
183 char *postpluto;
184 char *plutostderrlog;
185 bool uniqueids;
186 u_int overridemtu;
187 u_int crlcheckinterval;
188 bool cachecrls;
189 strict_t strictcrlpolicy;
190 bool nocrsend;
191 bool nat_traversal;
192 u_int keep_alive;
193 u_int force_keepalive;
194 char *virtual_private;
195 char *pkcs11module;
196 char *pkcs11initargs;
197 bool pkcs11keepstate;
198 bool pkcs11proxy;
199
200 /* KLIPS keywords */
201 char **klipsdebug;
202 bool fragicmp;
203 char *packetdefault;
204 bool hidetos;
205 } setup;
206
207 /* information about the default route */
208 defaultroute_t defaultroute;
209
210 /* number of encountered parsing errors */
211 u_int err;
212 u_int non_fatal_err;
213
214 /* do we parse also statements */
215 bool parse_also;
216
217 /* ca %default */
218 starter_ca_t ca_default;
219
220 /* connections list (without %default) */
221 starter_ca_t *ca_first, *ca_last;
222
223 /* conn %default */
224 starter_conn_t conn_default;
225
226 /* connections list (without %default) */
227 starter_conn_t *conn_first, *conn_last;
228 };
229
230 extern starter_config_t *confread_load(const char *file);
231 extern void confread_free(starter_config_t *cfg);
232
233 #endif /* _IPSEC_CONFREAD_H_ */
234