1 /* $Id: dspam.h,v 1.40 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 #include <sys/types.h>
23 #ifndef _WIN32
24 #include <pwd.h>
25 #endif
26 #include "libdspam.h"
27 #include "buffer.h"
28 #include "pref.h"
29 #include "read_config.h"
30 #include "daemon.h"
31 
32 #ifdef HAVE_CONFIG_H
33 #include <auto-config.h>
34 #endif
35 
36 #include "agent_shared.h"
37 
38 #ifndef _DSPAM_H
39 #  define _DSPAM_H
40 
41 int deliver_message (AGENT_CTX *ATX, const char *message,
42     const char *mailer_args, const char *username, FILE *out, int result);
43 int process_message (AGENT_CTX *ATX, buffer *message, const char *username,
44      char **result_string);
45 int inoculate_user  (AGENT_CTX *ATX, const char *username,
46     struct _ds_spam_signature *SIG, const char *message);
47 int user_classify   (AGENT_CTX *ATX, const char *username,
48      struct _ds_spam_signature *SIG, const char *message);
49 int send_notice     (AGENT_CTX *ATX, const char *filename,
50     const char *mailer_args, const char *username);
51 int write_web_stats (AGENT_CTX *ATX, const char *username, const char *group,
52     struct _ds_spam_totals *totals);
53 int ensure_confident_result (DSPAM_CTX *CTX, AGENT_CTX *ATX, int result);
54 int quarantine_message      (AGENT_CTX *ATX, const char *message,
55     const char *username);
56 int log_events         (DSPAM_CTX *CTX, AGENT_CTX *ATX);
57 int retrain_message    (DSPAM_CTX *CTX, AGENT_CTX *ATX);
58 int tag_message        (AGENT_CTX *ATX, ds_message_t message);
59 int process_users      (AGENT_CTX *ATX, buffer *message);
60 int find_signature     (DSPAM_CTX *CTX, AGENT_CTX *ATX);
61 int add_xdspam_headers (DSPAM_CTX *CTX, AGENT_CTX *ATX);
62 int embed_signature    (DSPAM_CTX *CTX, AGENT_CTX *ATX);
63 int embed_msgtag       (DSPAM_CTX *CTX, AGENT_CTX *ATX);
64 int embed_signed       (DSPAM_CTX *CTX, AGENT_CTX *ATX);
65 int tracksource        (DSPAM_CTX *CTX);
66 #ifdef CLAMAV
67 int has_virus          (buffer *message);
68 int feed_clam          (int port, buffer *message);
69 #endif
70 int is_blacklisted     (DSPAM_CTX *CTX, AGENT_CTX *ATX);
71 int is_blocklisted     (DSPAM_CTX *CTX, AGENT_CTX *ATX);
72 int do_notifications   (DSPAM_CTX *CTX, AGENT_CTX *ATX);
73 DSPAM_CTX *ctx_init    (AGENT_CTX *ATX, const char *username);
74 buffer *read_stdin     (AGENT_CTX *ATX);
75 agent_pref_t load_aggregated_prefs (AGENT_CTX *ATX, const char *username);
76 
77 #ifdef DAEMON
78 int daemon_start       (AGENT_CTX *ATX);
79 #endif
80 
81 #define DSM_DAEMON	0xFE
82 
83 typedef struct agent_result {
84   int exitcode;
85   int classification;
86   char text[256];
87 } *agent_result_t;
88 
89 #define ERC_SUCCESS		0x00
90 #define ERC_PROCESS		-0x01
91 #define ERC_DELIVERY		-0x02
92 #define ERC_PERMANENT_DELIVERY	-0x03
93 
94 #endif /* _DSPAM_H */
95 
96