summaryrefslogtreecommitdiffstats
path: root/src/smtp.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-05-11 18:58:18 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-05-11 18:58:18 +0400
commit4ffd493f95faaf11fb4fc1a6ccbd7afe09271490 (patch)
tree7a892f57f09fb6a153fc17ab578e742820f29535 /src/smtp.h
parent6c632b961dcae8930b655bff8565f015dd9aa143 (diff)
downloadrspamd-4ffd493f95faaf11fb4fc1a6ccbd7afe09271490.tar.gz
rspamd-4ffd493f95faaf11fb4fc1a6ccbd7afe09271490.zip
* Initial addition of smtp proxy module
Diffstat (limited to 'src/smtp.h')
-rw-r--r--src/smtp.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/smtp.h b/src/smtp.h
new file mode 100644
index 000000000..d03bb1631
--- /dev/null
+++ b/src/smtp.h
@@ -0,0 +1,60 @@
+#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;
+ uint32_t 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
+};
+
+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;
+ int sock;
+ struct smtp_upstream *upstream;
+ int upstream_sock;
+ gboolean resolved;
+};
+
+#endif