annotate src/spamass.h @ 163:97d7da45fe2a

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