source: npl/mailserver/dspam/dspam-3.10.2/src/libdspam.h @ c5c522c

gcc484ntopperl-5.22
Last change on this file since c5c522c was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 3.3 KB
Line 
1/* $Id: libdspam.h,v 1.27 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#ifdef __cplusplus
23extern "C" {
24#endif
25
26#ifdef HAVE_CONFIG_H
27#include <auto-config.h>
28#endif
29
30#ifndef _LIBDSPAM_H
31#  define _LIBDSPAM_H
32
33#include "diction.h"
34#include "nodetree.h"
35#include "error.h"
36#include "storage_driver.h"
37#include "decode.h"
38#include "libdspam_objects.h"
39#include "heap.h"
40#include "tokenizer.h"
41
42#define LIBDSPAM_VERSION_MAJOR  3
43#define LIBDSPAM_VERSION_MINOR  6
44#define LIBDSPAM_VERSION_PATCH  0
45
46#define BNR_SIZE 3
47
48/* Public API */
49
50int libdspam_init(const char *);
51int libdspam_shutdown(void);
52
53DSPAM_CTX * dspam_init  (const char *username, const char *group,
54            const char *home, int operating_mode, u_int32_t flags);
55
56DSPAM_CTX * dspam_create (const char *username, const char *group,
57            const char *home, int operating_mode, u_int32_t flags);
58
59int dspam_attach  (DSPAM_CTX *CTX, void *dbh);
60int dspam_detach  (DSPAM_CTX *CTX);
61int dspam_process (DSPAM_CTX * CTX, const char *message);
62
63int dspam_getsource       (DSPAM_CTX * CTX, char *buf, size_t size);
64int dspam_addattribute    (DSPAM_CTX * CTX, const char *key, const char *value);
65int dspam_clearattributes (DSPAM_CTX * CTX);
66
67void dspam_destroy        (DSPAM_CTX * CTX);
68
69
70/* Private functions */
71
72int _ds_calc_stat (DSPAM_CTX * CTX, ds_term_t term, struct _ds_spam_stat *s,
73     int type, struct _ds_spam_stat *bnr_tot);
74int _ds_calc_result (DSPAM_CTX * CTX, ds_heap_t sort, ds_diction_t diction);
75int _ds_increment_tokens(DSPAM_CTX *CTX, ds_diction_t diction);
76int  _ds_operate               (DSPAM_CTX * CTX, char *headers, char *body);
77int  _ds_process_signature     (DSPAM_CTX * CTX);
78int  _ds_factor                (struct nt *set, char *token_name, float value);
79int _ds_instantiate_bnr        (DSPAM_CTX *CTX, ds_diction_t patterns,
80    struct nt *order, char identifier);
81ds_diction_t _ds_apply_bnr (DSPAM_CTX *CTX, ds_diction_t diction);
82void _ds_factor_destroy        (struct nt *factors);
83
84
85/* Standard Return Codes */
86
87#ifndef EINVAL
88#       define EINVAL                   -0x01
89  /* Invalid call or parms - already initialized or shutdown */
90#endif
91#define EUNKNOWN                -0x02   /* Unknown/unexpected error */
92#define EFILE                   -0x03   /* File error */
93#define ELOCK                   -0x04   /* Lock error */
94#define EFAILURE                -0x05   /* Failed to perform operation */
95
96#define FALSE_POSITIVE(A) \
97  (A->classification == DSR_ISINNOCENT && A->source == DSS_ERROR)
98#define SPAM_MISS(A) \
99  (A->classification == DSR_ISSPAM && A->source == DSS_ERROR)
100#define SIGNATURE_NULL(A)       (A->signature == NULL)
101
102#endif /* _LIBDSPAM_H */
103
104#ifdef __cplusplus
105}
106#endif
Note: See TracBrowser for help on using the repository browser.