Mercurial > dnsbl
annotate src/spamass.h @ 259:be939802c64e
add recipient rate limits by email from address or domain
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Sat, 21 Jul 2012 08:34:04 -0700 |
parents | 82886d4dd71f |
children | 78eedbbce636 |
rev | line source |
---|---|
163 | 1 /* |
2 | |
3 Copyright (c) 2007 Carl Byington - 510 Software Group, released under | |
4 the GPL version 3 or any later version at your choice available at | |
5 http://www.gnu.org/licenses/gpl-3.0.txt | |
6 | |
7 Based on spamass-milter by Georg C. F. Greve <greve@gnu.org> | |
8 | |
9 */ | |
10 | |
177 | 11 #ifndef _SPAMASS_H |
12 #define _SPAMASS_H | |
163 | 13 |
14 extern "C" { | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
15 #include <libmilter/mfapi.h> |
163 | 16 } |
17 | |
18 #ifdef HAVE_CDEFS_H | |
19 #include <sys/cdefs.h> | |
20 #endif | |
21 | |
22 #include <list> | |
23 | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
24 extern const char *spamc; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
25 extern const char *spamc_empty; |
163 | 26 using namespace std; |
27 | |
28 class mlfiPriv; | |
29 | |
30 class SpamAssassin { | |
31 public: | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
32 SpamAssassin(mlfiPriv *priv_, int ip, const char *helo_, const char *from, const char *qid); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
33 ~SpamAssassin(); |
163 | 34 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
35 void mlfi_envrcpt(SMFICTX *ctx, const char *envrcpt); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
36 void mlfi_header(const char* headerf, const char* headerv); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
37 void mlfi_eoh(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
38 void mlfi_body(const u_char *bodyp, size_t bodylen); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
39 int mlfi_eom(); |
163 | 40 |
41 private: | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
42 void Connect(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
43 void output(const char *buffer, size_t size); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
44 void output(const char *buffer); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
45 void output(string buffer); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
46 void close_output(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
47 void input(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
48 int read_pipe(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
49 void empty_and_close_pipe(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
50 void closeall(int fd); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
51 const char *getorwarnmacro(SMFICTX *ctx, const char *macro, const char *def, const char *scope); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
52 void warnmacro(const char *macro, const char *scope); |
163 | 53 |
54 public: | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
55 bool error; // spamc died or cannot work |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
56 bool running; // running implies (connected and pid) |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
57 bool first_recipient; // have we not seen any recipients? |
163 | 58 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
59 // connection back to main dnsbl priv structure for logging |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
60 mlfiPriv *priv; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
61 int ip4; // ip4 address of smtp client |
163 | 62 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
63 // strings owned by main dnsbl |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
64 const char *helo; // client helo value |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
65 const char *envfrom; // envelope from value for this message |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
66 const char *queueid; // the sendmail queue id for this message |
163 | 67 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
68 // Process handling variables |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
69 pid_t pid; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
70 int pipe_io[2][2]; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
71 string spamc_output; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
72 string spamc_input; |
163 | 73 }; |
74 | |
75 #endif |