fixed compiler warning
[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 );
25 DROP INDEX IF EXISTS child_configs_name;
26 CREATE INDEX child_configs_name ON child_configs (
27 name
28 );
29
30
31 DROP TABLE IF EXISTS child_config_traffic_selector;
32 CREATE TABLE child_config_traffic_selector (
33 child_cfg INTEGER NOT NULL,
34 traffic_selector INTEGER NOT NULL,
35 kind INTEGER NOT NULL
36 );
37 DROP INDEX IF EXISTS child_config_traffic_selector;
38 CREATE INDEX child_config_traffic_selector_all ON child_config_traffic_selector (
39 child_cfg, traffic_selector
40 );
41
42
43 DROP TABLE IF EXISTS ike_configs;
44 CREATE TABLE ike_configs (
45 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
46 certreq INTEGER NOT NULL DEFAULT '1',
47 force_encap INTEGER NOT NULL DEFAULT '0',
48 local TEXT NOT NULL,
49 remote TEXT NOT NULL
50 );
51
52
53 DROP TABLE IF EXISTS peer_configs;
54 CREATE TABLE peer_configs (
55 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
56 name TEXT NOT NULL,
57 ike_version INTEGER NOT NULL DEFAULT '2',
58 ike_cfg INTEGER NOT NULL,
59 local_id TEXT NOT NULL,
60 remote_id TEXT NOT NULL,
61 cert_policy INTEGER NOT NULL DEFAULT '1',
62 uniqueid INTEGER NOT NULL DEFAULT '0',
63 auth_method INTEGER NOT NULL DEFAULT '1',
64 eap_type INTEGER NOT NULL DEFAULT '0',
65 eap_vendor INTEGER NOT NULL DEFAULT '0',
66 keyingtries INTEGER NOT NULL DEFAULT '3',
67 rekeytime INTEGER NOT NULL DEFAULT '7200',
68 reauthtime INTEGER NOT NULL DEFAULT '0',
69 jitter INTEGER NOT NULL DEFAULT '180',
70 overtime INTEGER NOT NULL DEFAULT '300',
71 mobike INTEGER NOT NULL DEFAULT '1',
72 dpd_delay INTEGER NOT NULL DEFAULT '120',
73 virtual TEXT DEFAULT NULL,
74 pool TEXT DEFAULT NULL,
75 mediation INTEGER NOT NULL DEFAULT '0',
76 mediated_by INTEGER NOT NULL DEFAULT '0',
77 peer_id INTEGER NOT NULL DEFAULT '0'
78 );
79 DROP INDEX IF EXISTS peer_configs_name;
80 CREATE INDEX peer_configs_name ON peer_configs (
81 name
82 );
83
84
85 DROP TABLE IF EXISTS peer_config_child_config;
86 CREATE TABLE peer_config_child_config (
87 peer_cfg INTEGER NOT NULL,
88 child_cfg INTEGER NOT NULL,
89 PRIMARY KEY (peer_cfg, child_cfg)
90 );
91
92
93 DROP TABLE IF EXISTS traffic_selectors;
94 CREATE TABLE traffic_selectors (
95 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
96 type INTEGER NOT NULL DEFAULT '7',
97 protocol INTEGER NOT NULL DEFAULT '0',
98 start_addr BLOB DEFAULT NULL,
99 end_addr BLOB DEFAULT NULL,
100 start_port INTEGER NOT NULL DEFAULT '0',
101 end_port INTEGER NOT NULL DEFAULT '65535'
102 );
103
104
105 DROP TABLE IF EXISTS certificates;
106 CREATE TABLE certificates (
107 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
108 type INTEGER NOT NULL,
109 keytype INTEGER NOT NULL,
110 data BLOB NOT NULL
111 );
112
113
114 DROP TABLE IF EXISTS certificate_identity;
115 CREATE TABLE certificate_identity (
116 certificate INTEGER NOT NULL,
117 identity INTEGER NOT NULL,
118 PRIMARY KEY (certificate, identity)
119 );
120
121
122 DROP TABLE IF EXISTS private_keys;
123 CREATE TABLE private_keys (
124 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
125 type INTEGER NOT NULL,
126 data BLOB NOT NULL
127 );
128
129
130 DROP TABLE IF EXISTS private_key_identity;
131 CREATE TABLE private_key_identity (
132 private_key INTEGER NOT NULL,
133 identity INTEGER NOT NULL,
134 PRIMARY KEY (private_key, identity)
135 );
136
137
138 DROP TABLE IF EXISTS shared_secrets;
139 CREATE TABLE shared_secrets (
140 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
141 type INTEGER NOT NULL,
142 data BLOB NOT NULL
143 );
144
145
146 DROP TABLE IF EXISTS shared_secret_identity;
147 CREATE TABLE shared_secret_identity (
148 shared_secret INTEGER NOT NULL,
149 identity INTEGER NOT NULL,
150 PRIMARY KEY (shared_secret, identity)
151 );
152
153 DROP TABLE IF EXISTS pools;
154 CREATE TABLE pools (
155 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
156 name TEXT NOT NULL,
157 start BLOB NOT NULL,
158 end BLOB NOT NULL,
159 next BLOB NOT NULL,
160 timeout INTEGER DEFAULT NULL
161 );
162 DROP INDEX IF EXISTS pools_name;
163 CREATE INDEX pools_name ON pools (
164 name
165 );
166
167 DROP TABLE IF EXISTS leases;
168 CREATE TABLE leases (
169 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
170 pool INTEGER NOT NULL,
171 address BLOB NOT NULL,
172 identity INTEGER NOT NULL,
173 acquire INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
174 release INTEGER DEFAULT NULL
175 );
176 DROP INDEX IF EXISTS leases_pool;
177 CREATE INDEX leases_pool ON leases (
178 pool
179 );
180 DROP INDEX IF EXISTS leases_identity;
181 CREATE INDEX leases_identity ON leases (
182 identity
183 );
184 DROP INDEX IF EXISTS leases_release;
185 CREATE INDEX leases_release ON leases (
186 release
187 );
188
189 DROP TABLE IF EXISTS ike_sas;
190 CREATE TABLE ike_sas (
191 local_spi BLOB NOT NULL PRIMARY KEY,
192 remote_spi BLOB NOT NULL,
193 id INTEGER NOT NULL,
194 initiator INTEGER NOT NULL,
195 local_id_type INTEGER NOT NULL,
196 local_id_data BLOB NOT NULL,
197 remote_id_type INTEGER NOT NULL,
198 remote_id_data BLOB NOT NULL,
199 host_family INTEGER NOT NULL,
200 local_host_data BLOB NOT NULL,
201 remote_host_data BLOB NOT NULL,
202 created INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
203 );
204
205 DROP TABLE IF EXISTS logs;
206 CREATE TABLE logs (
207 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
208 local_spi BLOB NOT NULL,
209 signal INTEGER NOT NULL,
210 level INTEGER NOT NULL,
211 msg TEXT NOT NULL,
212 time INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
213 );
214