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