starter: Some whitespace cleanup.
[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 u_int ikeport;
70 ip_address nexthop;
71 char *subnet;
72 bool has_client;
73 bool has_client_wildcard;
74 bool has_port_wildcard;
75 bool has_natip;
76 bool has_virt;
77 bool modecfg;
78 certpolicy_t sendcert;
79 bool firewall;
80 bool hostaccess;
81 bool allow_any;
82 bool dns_failed;
83 char *updown;
84 u_int16_t port;
85 u_int8_t protocol;
86 char *sourceip;
87 int sourceip_mask;
88 };
89
90 typedef struct also also_t;
91
92 struct also {
93 char *name;
94 bool included;
95 also_t *next;
96 };
97
98 typedef struct starter_conn starter_conn_t;
99
100 struct starter_conn {
101 lset_t seen;
102 char *name;
103 also_t *also;
104 kw_list_t *kw;
105 u_int visit;
106 startup_t startup;
107 starter_state_t state;
108
109 keyexchange_t keyexchange;
110 u_int32_t eap_type;
111 u_int32_t eap_vendor;
112 char *eap_identity;
113 char *aaa_identity;
114 char *xauth_identity;
115 lset_t policy;
116 time_t sa_ike_life_seconds;
117 time_t sa_ipsec_life_seconds;
118 time_t sa_rekey_margin;
119 u_int64_t sa_ipsec_life_bytes;
120 u_int64_t sa_ipsec_margin_bytes;
121 u_int64_t sa_ipsec_life_packets;
122 u_int64_t sa_ipsec_margin_packets;
123 unsigned long sa_keying_tries;
124 unsigned long sa_rekey_fuzz;
125 u_int32_t reqid;
126 mark_t mark_in;
127 mark_t mark_out;
128 sa_family_t addr_family;
129 sa_family_t tunnel_addr_family;
130 bool install_policy;
131 starter_end_t left, right;
132
133 unsigned long id;
134
135 char *esp;
136 char *ike;
137 char *pfsgroup;
138
139 time_t dpd_delay;
140 time_t dpd_timeout;
141 dpd_action_t dpd_action;
142 int dpd_count;
143
144 time_t inactivity;
145
146 bool me_mediation;
147 char *me_mediated_by;
148 char *me_peerid;
149
150 starter_conn_t *next;
151 };
152
153 typedef struct starter_ca starter_ca_t;
154
155 struct starter_ca {
156 lset_t seen;
157 char *name;
158 also_t *also;
159 kw_list_t *kw;
160 u_int visit;
161 startup_t startup;
162 starter_state_t state;
163
164 char *cacert;
165 char *ldaphost;
166 char *ldapbase;
167 char *crluri;
168 char *crluri2;
169 char *ocspuri;
170 char *ocspuri2;
171 char *certuribase;
172
173 bool strict;
174
175 starter_ca_t *next;
176 };
177
178 typedef struct starter_config starter_config_t;
179
180 struct starter_config {
181 struct {
182 lset_t seen;
183 char **interfaces;
184 char *dumpdir;
185 bool charonstart;
186 bool plutostart;
187
188 /* pluto/charon keywords */
189 char **plutodebug;
190 char *charondebug;
191 char *prepluto;
192 char *postpluto;
193 char *plutostderrlog;
194 bool uniqueids;
195 u_int overridemtu;
196 u_int crlcheckinterval;
197 bool cachecrls;
198 strict_t strictcrlpolicy;
199 bool nocrsend;
200 bool nat_traversal;
201 u_int keep_alive;
202 u_int force_keepalive;
203 char *virtual_private;
204 char *pkcs11module;
205 char *pkcs11initargs;
206 bool pkcs11keepstate;
207 bool pkcs11proxy;
208
209 /* KLIPS keywords */
210 char **klipsdebug;
211 bool fragicmp;
212 char *packetdefault;
213 bool hidetos;
214 } setup;
215
216 /* information about the default route */
217 defaultroute_t defaultroute;
218
219 /* number of encountered parsing errors */
220 u_int err;
221 u_int non_fatal_err;
222
223 /* do we parse also statements */
224 bool parse_also;
225
226 /* ca %default */
227 starter_ca_t ca_default;
228
229 /* connections list (without %default) */
230 starter_ca_t *ca_first, *ca_last;
231
232 /* conn %default */
233 starter_conn_t conn_default;
234
235 /* connections list (without %default) */
236 starter_conn_t *conn_first, *conn_last;
237 };
238
239 extern starter_config_t *confread_load(const char *file);
240 extern void confread_free(starter_config_t *cfg);
241
242 #endif /* _IPSEC_CONFREAD_H_ */
243