ze-filter  (ze-filter-0.8.0-develop-180218)
ze-filter.h
Go to the documentation of this file.
1 /*
2  *
3  * ze-filter - Mail Server Filter for sendmail
4  *
5  * Copyright (c) 2001-2018 - Jose-Marcio Martins da Cruz
6  *
7  * Auteur : Jose Marcio Martins da Cruz
8  * jose.marcio.mc@gmail.org
9  *
10  * Historique :
11  * Creation : janvier 2002
12  *
13  * This program is free software, but with restricted license :
14  *
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  *
20  * More details about ze-filter license can be found at ze-filter
21  * web site : http://foss.jose-marcio.org
22  */
23 
24 
25 #ifndef __ZE_FILTER_H
26 
27 #include "version.h"
28 #include "defs.h"
29 
30 #include "ze-sys.h"
31 
32 #include <ze-libjc.h>
33 
34 
35 typedef struct CONNID_T CONNID_T;
36 typedef struct spamchk_T spamchk_T;
37 
38 struct CONNID_T
39 {
40  uint32_t t[2];
41  char id[16];
42 };
43 
44 #include "ze-modules.h"
45 #include "ze-read-conf-data.h"
46 #include "ze-headers.h"
47 #include "ze-oracle-scores.h"
48 #include "ze-chkcontent.h"
49 #include "ze-oracle.h"
50 #include "ze-fileexp.h"
51 #include "ze-cf.h"
52 #include "ze-log.h"
53 #include "ze-proc-witness.h"
54 #include "ze-config.h"
55 #include "ze-stats.h"
56 #include "ze-mimelist.h"
57 #include "ze-scanmail.h"
58 #include "ze-signal.h"
59 #include <ze-callback.h>
60 #include "ze-ndc-help.h"
61 #include "ze-ndc-server.h"
62 #include "ze-lr-init.h"
63 #include "ze-main.h"
64 #include "ze-cleanspool.h"
65 #include "ze-throttle.h"
66 #include "ze-smtprate.h"
67 #include "ze-connopen.h"
68 #include "ze-livehistory.h"
69 #include "ze-entropy.h"
70 #include "ze-dns-iprbwl.h"
71 #include "ze-dns-urlbl.h"
72 #include "ze-resource.h"
73 #include "ze-load.h"
74 #include "ze-dbbl.h"
75 #include "ze-rcpt-list.h"
76 #include "ze-dbpolicy.h"
77 #include "ze-policy.h"
78 
79 #include "ze-dbrcpt.h"
80 #include "ze-rcpt.h"
81 #include "ze-grey.h"
82 #include "ze-grey-client.h"
83 #include "ze-grey-cleanup.h"
84 #include "ze-netclass.h"
85 #include "ze-mailregex.h"
86 
87 #include "zeChkLib.h"
88 #include "zePolicy.h"
89 
90 #include "macros.h"
91 
92 /* ****************************************************************************
93  * *
94  * *
95  **************************************************************************** */
96 #define DEBUG 0
97 
98 #define SZ_CHUNK 8192
99 
100 #define MAX_LINE_LEN 2048
101 
102 
103 int zeFilter();
104 
105 int count_connections(int);
106 
107 /* ****************************************************************************
108  * *
109  * *
110  **************************************************************************** */
111 
112 
113 #define CONNID_STR(connid) ((char *) (connid).id)
114 #define CONNID_INT(connid) ((uint32_t) (connid).t[0])
115 
116 
117 int active_connections(int);
118 
119 extern time_t tlongconn;
120 
121 /* ****************************************************************************
122  * *
123  * *
124  **************************************************************************** */
125 
126 #if 0
127 #define CALLBACK_FIRST 0
128 #define CALLBACK_CONNECT 0
129 #define CALLBACK_EHLO 1
130 #define CALLBACK_MAIL 2
131 #define CALLBACK_RCPT 3
132 #define CALLBACK_DATA 4
133 #define CALLBACK_HEADER 5
134 #define CALLBACK_EOH 6
135 #define CALLBACK_BODY 7
136 #define CALLBACK_EOM 8
137 #define CALLBACK_ABORT 9
138 #define CALLBACK_CLOSE 10
139 #define CALLBACK_UNKNOWN 11
140 #define CALLBACK_LAST 11
141 
142 #define CALLBACK_LABEL(i) \
143  ((i) == CALLBACK_CONNECT ? "CONNECT" : \
144  (i) == CALLBACK_EHLO ? "HELO" : \
145  (i) == CALLBACK_MAIL ? "MAIL" : \
146  (i) == CALLBACK_RCPT ? "RCPT" : \
147  (i) == CALLBACK_DATA ? "DATA" : \
148  (i) == CALLBACK_HEADER ? "HEADER" : \
149  (i) == CALLBACK_EOH ? "EOH" : \
150  (i) == CALLBACK_BODY ? "BODY" : \
151  (i) == CALLBACK_EOM ? "EOM" : \
152  (i) == CALLBACK_ABORT ? "ABORT" : \
153  (i) == CALLBACK_CLOSE ? "CLOSE" : "UNKNOWN")
154 
155 #define CALLBACK_VALUE(label) \
156  (STRCASEEQUAL((label), "CONNECT") ? CALLBACK_CONNECT : \
157  STRCASEEQUAL((label), "HELO") ? CALLBACK_EHLO : \
158  STRCASEEQUAL((label), "EHLO") ? CALLBACK_EHLO : \
159  STRCASEEQUAL((label), "MAIL") ? CALLBACK_MAIL : \
160  STRCASEEQUAL((label), "RCPT") ? CALLBACK_RCPT : \
161  STRCASEEQUAL((label), "DATA") ? CALLBACK_DATA : \
162  STRCASEEQUAL((label), "HEADER") ? CALLBACK_HEADER : \
163  STRCASEEQUAL((label), "EOH") ? CALLBACK_EOH : \
164  STRCASEEQUAL((label), "BODY") ? CALLBACK_BODY : \
165  STRCASEEQUAL((label), "EOM") ? CALLBACK_EOM : \
166  STRCASEEQUAL((label), "ABORT") ? CALLBACK_ABORT : \
167  STRCASEEQUAL((label), "CLOSE") ? CALLBACK_CLOSE : CALLBACK_UNKNOWN)
168 #endif
169 
170 #define RESOLVE_NULL -1
171 #define RESOLVE_OK 0
172 #define RESOLVE_FAIL 1
173 #define RESOLVE_FORGED 2
174 #define RESOLVE_TEMPFAIL 4
175 
176 #define RESOLVE_ALL (RESOLVE_FAIL | RESOLVE_FORGED | RESOLVE_TEMPFAIL)
177 
178 #define RESOLVE_VAL(i) ((i) == RESOLVE_OK ? "OK" : \
179  (i) == RESOLVE_FAIL ? "FAIL" : \
180  (i) == RESOLVE_FORGED ? "FORGED" : \
181  (i) == RESOLVE_TEMPFAIL ? "TEMPFAIL" : "NULL")
182 
183 
184 #define JCOMBUFSZ 1024
185 
186 #define CACHE_GETHOSTNAMEBYADDR(ip,name,size,query) \
187  do { \
188  *name = '\0'; \
189  if (cf_get_int(CF_RESOLVE_CACHE_ENABLE) == OPT_YES) \
190  resolve_cache_check("PTR", ip, name, size); \
191  if (strlen(name) == 0 && query) \
192  get_hostbyaddr(ip,name,size); \
193  } while (0);
194 
195 
196 /* ****************************************************************************
197  * *
198  * *
199  **************************************************************************** */
200 
201 /* _FFR
202 
203 _FFR_MSG_ENTROPY
204 _FFR_LOAD_CONTROL
205 _FFR_GLOBAL_OPEN_CONNECTIONS_CONTROL
206 _FFR_RECIPIENT_OPTIONS
207 _FFR_RFC2046_MSGS_ARE_XFILES
208 
209 */
210 
211 /* to be removed from C files */
212 #ifndef _FFR_CLEAN_MSG_BUF
213 # define _FFR_CLEAN_MSG_BUF 1
214 #endif
215 
216 #define _FFR_RFC2046_MSGS_ARE_XFILES 1
217 
218 #define __ZE_FILTER_H
219 #endif
time_t tlongconn
Definition: ze-filter.c:93
int count_connections(int)
Definition: ze-filter.c:300
int zeFilter()
Definition: ze-filter.c:504
int active_connections(int)
long uint32_t
Definition: ze-sys.h:489
uint32_t t[2]
Definition: ze-filter.h:40