1 | /* $Id: sqlite_drv.h,v 1.8 2011/06/28 00:13:48 sbajic Exp $ */ |
---|
2 | |
---|
3 | /* |
---|
4 | DSPAM |
---|
5 | COPYRIGHT (C) 2002-2012 DSPAM PROJECT |
---|
6 | |
---|
7 | This program is free software: you can redistribute it and/or modify |
---|
8 | it under the terms of the GNU Affero General Public License as |
---|
9 | published by the Free Software Foundation, either version 3 of the |
---|
10 | License, or (at your option) any later version. |
---|
11 | |
---|
12 | This program is distributed in the hope that it will be useful, |
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | GNU Affero General Public License for more details. |
---|
16 | |
---|
17 | You should have received a copy of the GNU Affero General Public License |
---|
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
19 | |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef _SQLITE_DRV_H |
---|
23 | # define _SQLITE_DRV_H |
---|
24 | |
---|
25 | #ifdef HAVE_CONFIG_H |
---|
26 | #include <auto-config.h> |
---|
27 | #endif |
---|
28 | |
---|
29 | #include <sqlite.h> |
---|
30 | |
---|
31 | struct _sqlite_drv_storage |
---|
32 | { |
---|
33 | struct sqlite *dbh; /* database handle */ |
---|
34 | struct _ds_spam_totals control_totals; /* totals at storage init */ |
---|
35 | struct _ds_spam_totals merged_totals; /* totals for merged group */ |
---|
36 | |
---|
37 | /* control token data; used to measure deltas from getall to setall |
---|
38 | * enabling us to code a sql query based on increments/decrements |
---|
39 | * instead of query-coded data */ |
---|
40 | |
---|
41 | unsigned long long control_token; /* control token crc */ |
---|
42 | long control_sh; /* control token spam hits at getall */ |
---|
43 | long control_ih; /* control token innocent hits at getall */ |
---|
44 | |
---|
45 | sqlite_vm *iter_token; /* get_nexttoken iteration result */ |
---|
46 | sqlite_vm *iter_sig; /* get_nextsignature iteration result */ |
---|
47 | |
---|
48 | struct nt *dir_handles; |
---|
49 | int dbh_attached; |
---|
50 | }; |
---|
51 | |
---|
52 | /* Driver-specific functions */ |
---|
53 | |
---|
54 | int _sqlite_drv_get_spamtotals (DSPAM_CTX * CTX); |
---|
55 | int _sqlite_drv_set_spamtotals (DSPAM_CTX * CTX); |
---|
56 | void _sqlite_drv_query_error (const char *error, const char *query); |
---|
57 | |
---|
58 | #endif /* _SQLITE_DRV_H */ |
---|
59 | |
---|