annotate src/spamass.h @ 171:8deb51871b3d

fix pre/post scripts in rpm spec file
author carl
date Thu, 30 Aug 2007 14:40:03 -0700
parents 6bac960af6b4
children a4d313c2460b
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
167
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
24 extern char *spamc;
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
25 extern char *spamc_empty;
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
26 using namespace std;
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
27
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
28 class mlfiPriv;
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
29
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
30 class SpamAssassin {
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
31 public:
167
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
32 SpamAssassin(mlfiPriv *priv_, int ip, char *helo_, char *from, char *qid);
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
33 ~SpamAssassin();
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
34
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
35 void mlfi_envrcpt(SMFICTX *ctx, char *envrcpt);
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
36 void mlfi_header(char* headerf, char* headerv);
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
37 void mlfi_eoh();
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
38 void mlfi_body(u_char *bodyp, size_t bodylen);
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
39 int mlfi_eom();
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
40
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
41 private:
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
42 void Connect();
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
43 void output(const char*buffer, size_t size);
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
44 void output(const char*buffer);
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
45 void output(string buffer);
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
46 void close_output();
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
47 void input();
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
48 int read_pipe();
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
49 void empty_and_close_pipe();
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
50 void closeall(int fd);
168
6bac960af6b4 add generic reverse dns filtering regex
carl
parents: 167
diff changeset
51 char *getorwarnmacro(SMFICTX *ctx, char *macro, char *def, char *scope);
163
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;
167
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
61 int ip4; // ip4 address of smtp client
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
62
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
63 // strings owned by main dnsbl
167
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
64 char *helo; // client helo value
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
65 char *envfrom; // envelope from value for this message
167
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
66 char *queueid; // the sendmail queue id for this message
163
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