blob: 6d9d7555f0bfec78e46fcd596e8ea3f3e8888355 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#ifndef RSPAMD_SMTP_H
#define RSPAMD_SMTP_H
#include "config.h"
#include "main.h"
#include "upstream.h"
struct smtp_upstream {
struct upstream up;
const char *name;
struct in_addr addr;
uint16_t port;
gboolean is_unix;
};
#define MAX_UPSTREAM 128
struct smtp_worker_ctx {
struct smtp_upstream upstreams[MAX_UPSTREAM];
size_t upstream_num;
memory_pool_t *pool;
char *smtp_banner;
uint32_t smtp_delay;
struct timeval smtp_timeout;
gboolean use_xclient;
gboolean helo_required;
const char *smtp_capabilities;
};
enum rspamd_smtp_state {
SMTP_STATE_RESOLVE_REVERSE,
SMTP_STATE_RESOLVE_NORMAL,
SMTP_STATE_DELAY,
SMTP_STATE_GREETING,
SMTP_STATE_HELO,
SMTP_STATE_FROM,
SMTP_STATE_RCPT,
SMTP_STATE_DATA,
SMTP_STATE_EOD,
SMTP_STATE_END,
SMTP_STATE_ERROR,
SMTP_STATE_WRITE_ERROR
};
struct smtp_session {
struct smtp_worker_ctx *ctx;
memory_pool_t *pool;
enum rspamd_smtp_state state;
struct worker_task *task;
struct in_addr client_addr;
char *hostname;
char *error;
int sock;
struct rspamd_async_session *s;
rspamd_io_dispatcher_t *dispatcher;
struct smtp_upstream *upstream;
int upstream_sock;
gboolean resolved;
};
void start_smtp_worker (struct rspamd_worker *worker);
#endif
|