Removed strayed code fragment
[strongswan.git] / src / charon / plugins / sql / sqlite.sql
1
2
3 DROP TABLE IF EXISTS identities;
4 CREATE TABLE identities (
5 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
6 type INTEGER NOT NULL,
7 data BLOB NOT NULL,
8 UNIQUE (type, data)
9 );
10
11
12 DROP TABLE IF EXISTS child_configs;
13 CREATE TABLE child_configs (
14 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
15 name TEXT NOT NULL,
16 lifetime INTEGER NOT NULL DEFAULT '1500',
17 rekeytime INTEGER NOT NULL DEFAULT '1200',
18 jitter INTEGER NOT NULL DEFAULT '60',
19 updown TEXT DEFAULT NULL,
20 hostaccess INTEGER NOT NULL DEFAULT '0',
21 mode INTEGER NOT NULL DEFAULT '1',
22 dpd_action INTEGER NOT NULL DEFAULT '0',
23 close_action INTEGER NOT NULL DEFAULT '0',
24 ipcomp INTEGER NOT NULL DEFAULT '0'
25 );
26 DROP INDEX IF EXISTS child_configs_name;
27 CREATE INDEX child_configs_name ON child_configs (
28 name
29 );
30
31
32 DROP TABLE IF EXISTS child_config_traffic_selector;
33 CREATE TABLE child_config_traffic_selector (
34 child_cfg INTEGER NOT NULL,
35 traffic_selector INTEGER NOT NULL,
36 kind INTEGER NOT NULL
37 );
38 DROP INDEX IF EXISTS child_config_traffic_selector;
39 CREATE INDEX child_config_traffic_selector_all ON child_config_traffic_selector (
40 child_cfg, traffic_selector
41 );
42
43
44 DROP TABLE IF EXISTS ike_configs;
45 CREATE TABLE ike_configs (
46 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
47 certreq INTEGER NOT NULL DEFAULT '1',
48 force_encap INTEGER NOT NULL DEFAULT '0',
49 local TEXT NOT NULL,
50 remote TEXT NOT NULL
51 );
52
53
54 DROP TABLE IF EXISTS peer_configs;
55 CREATE TABLE peer_configs (
56 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
57 name TEXT NOT NULL,
58 ike_version INTEGER NOT NULL DEFAULT '2',
59 ike_cfg INTEGER NOT NULL,
60 local_id TEXT NOT NULL,
61 remote_id TEXT NOT NULL,
62 cert_policy INTEGER NOT NULL DEFAULT '1',
63 uniqueid INTEGER NOT NULL DEFAULT '0',
64 auth_method INTEGER NOT NULL DEFAULT '1',
65 eap_type INTEGER NOT NULL DEFAULT '0',
66 eap_vendor INTEGER NOT NULL DEFAULT '0',
67 keyingtries INTEGER NOT NULL DEFAULT '3',
68 rekeytime INTEGER NOT NULL DEFAULT '7200',
69 reauthtime INTEGER NOT NULL DEFAULT '0',
70 jitter INTEGER NOT NULL DEFAULT '180',
71 overtime INTEGER NOT NULL DEFAULT '300',
72 mobike INTEGER NOT NULL DEFAULT '1',
73 dpd_delay INTEGER NOT NULL DEFAULT '120',
74 virtual TEXT DEFAULT NULL,
75 pool TEXT DEFAULT NULL,
76 mediation INTEGER NOT NULL DEFAULT '0',
77 mediated_by INTEGER NOT NULL DEFAULT '0',
78 peer_id INTEGER NOT NULL DEFAULT '0'
79 );
80 DROP INDEX IF EXISTS peer_configs_name;
81 CREATE INDEX peer_configs_name ON peer_configs (
82 name
83 );
84
85
86 DROP TABLE IF EXISTS peer_config_child_config;
87 CREATE TABLE peer_config_child_config (
88 peer_cfg INTEGER NOT NULL,
89 child_cfg INTEGER NOT NULL,
90 PRIMARY KEY (peer_cfg, child_cfg)
91 );
92
93
94 DROP TABLE IF EXISTS traffic_selectors;
95 CREATE TABLE traffic_selectors (
96 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
97 type INTEGER NOT NULL DEFAULT '7',
98 protocol INTEGER NOT NULL DEFAULT '0',
99 start_addr BLOB DEFAULT NULL,
100 end_addr BLOB DEFAULT NULL,
101 start_port INTEGER NOT NULL DEFAULT '0',
102 end_port INTEGER NOT NULL DEFAULT '65535'
103 );
104
105
106 DROP TABLE IF EXISTS certificates;
107 CREATE TABLE certificates (
108 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
109 type INTEGER NOT NULL,
110 keytype INTEGER NOT NULL,
111 data BLOB NOT NULL
112 );
113
114
115 DROP TABLE IF EXISTS certificate_identity;
116 CREATE TABLE certificate_identity (
117 certificate INTEGER NOT NULL,
118 identity INTEGER NOT NULL,
119 PRIMARY KEY (certificate, identity)
120 );
121
122
123 DROP TABLE IF EXISTS private_keys;
124 CREATE TABLE private_keys (
125 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
126 type INTEGER NOT NULL,
127 data BLOB NOT NULL
128 );
129
130
131 DROP TABLE IF EXISTS private_key_identity;
132 CREATE TABLE private_key_identity (
133 private_key INTEGER NOT NULL,
134 identity INTEGER NOT NULL,
135 PRIMARY KEY (private_key, identity)
136 );
137
138
139 DROP TABLE IF EXISTS shared_secrets;
140 CREATE TABLE shared_secrets (
141 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
142 type INTEGER NOT NULL,
143 data BLOB NOT NULL
144 );
145
146
147 DROP TABLE IF EXISTS shared_secret_identity;
148 CREATE TABLE shared_secret_identity (
149 shared_secret INTEGER NOT NULL,
150 identity INTEGER NOT NULL,
151 PRIMARY KEY (shared_secret, identity)
152 );
153
154
155 DROP TABLE IF EXISTS pools;
156 CREATE TABLE pools (
157 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
158 name TEXT NOT NULL UNIQUE,
159 start BLOB NOT NULL,
160 end BLOB NOT NULL,
161 timeout INTEGER NOT NULL
162 );
163
164 DROP TABLE IF EXISTS addresses;
165 CREATE TABLE addresses (
166 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
167 pool INTEGER NOT NULL,
168 address BLOB NOT NULL,
169 identity INTEGER NOT NULL,
170 acquired INTEGER NOT NULL,
171 released INTEGER NOT NULL
172 );
173 DROP INDEX IF EXISTS addresses_pool;
174 CREATE INDEX addresses_pool ON addresses (
175 pool
176 );
177 DROP INDEX IF EXISTS addresses_address;
178 CREATE INDEX addresses_address ON addresses (
179 address
180 );
181 DROP INDEX IF EXISTS addresses_identity;
182 CREATE INDEX addresses_identity ON addresses (
183 identity
184 );
185
186 DROP TABLE IF EXISTS leases;
187 CREATE TABLE leases (
188 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
189 address INTEGER NOT NULL,
190 identity INTEGER NOT NULL,
191 acquired INTEGER NOT NULL,
192 released INTEGER NOT NULL
193 );
194
195 DROP TABLE IF EXISTS attributes;
196 CREATE TABLE attributes (
197 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
198 type INTEGER NOT NULL,
199 value BLOB NOT NULL
200 );
201
202 DROP TABLE IF EXISTS ike_sas;
203 CREATE TABLE ike_sas (
204 local_spi BLOB NOT NULL PRIMARY KEY,
205 remote_spi BLOB NOT NULL,
206 id INTEGER NOT NULL,
207 initiator INTEGER NOT NULL,
208 local_id_type INTEGER NOT NULL,
209 local_id_data BLOB NOT NULL,
210 remote_id_type INTEGER NOT NULL,
211 remote_id_data BLOB NOT NULL,
212 host_family INTEGER NOT NULL,
213 local_host_data BLOB NOT NULL,
214 remote_host_data BLOB NOT NULL,
215 created INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
216 );
217
218 DROP TABLE IF EXISTS logs;
219 CREATE TABLE logs (
220 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
221 local_spi BLOB NOT NULL,
222 signal INTEGER NOT NULL,
223 level INTEGER NOT NULL,
224 msg TEXT NOT NULL,
225 time INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
226 );
227