diff options
author | Charles Longeau <chl@cvs.openbsd.org> | 2012-01-18 13:41:55 +0000 |
---|---|---|
committer | Charles Longeau <chl@cvs.openbsd.org> | 2012-01-18 13:41:55 +0000 |
commit | 8b26bf89ccbe3141f9bfc2d16068ae00b9eb9bba (patch) | |
tree | 22a1c61ff718530c0e6cdc5b538b73f253291831 /usr.sbin/smtpd/filter.h | |
parent | 995a30821cb802c22d14b470790cc8111b506a31 (diff) |
Add new filters callbacks for:
- network events (CONNECT/CLOSE)
- commands (QUIT/RSET)
ok gilles@ eric@
Diffstat (limited to 'usr.sbin/smtpd/filter.h')
-rw-r--r-- | usr.sbin/smtpd/filter.h | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/usr.sbin/smtpd/filter.h b/usr.sbin/smtpd/filter.h index 5ccd66b4194..4768a370f1d 100644 --- a/usr.sbin/smtpd/filter.h +++ b/usr.sbin/smtpd/filter.h @@ -1,4 +1,4 @@ -/* $OpenBSD: filter.h,v 1.6 2011/11/28 22:13:27 chl Exp $ */ +/* $OpenBSD: filter.h,v 1.7 2012/01/18 13:41:54 chl Exp $ */ /* * Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org> @@ -16,6 +16,9 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <sys/socket.h> + +#include <netdb.h> #define FILTER_API_VERSION 50 @@ -39,32 +42,42 @@ enum filter_status { }; enum filter_type { - FILTER_HELO = 0x01, - FILTER_EHLO = 0x02, - FILTER_MAIL = 0x04, - FILTER_RCPT = 0x08, - FILTER_DATALINE = 0x10, + FILTER_CONNECT = 0x001, + FILTER_HELO = 0x002, + FILTER_EHLO = 0x004, + FILTER_MAIL = 0x008, + FILTER_RCPT = 0x010, + FILTER_DATALINE = 0x020, + FILTER_QUIT = 0x040, + FILTER_CLOSE = 0x080, + FILTER_RSET = 0x100, }; -struct filter_helo { - char buffer[1024]; +struct filter_connect { + char hostname[MAXHOSTNAMELEN]; + struct sockaddr_storage hostaddr; }; +struct filter_helo { + char helohost[MAXHOSTNAMELEN]; +}; + struct filter_mail { - char user[MAX_LOCALPART_SIZE]; - char domain[MAX_DOMAINPART_SIZE]; + char user[MAX_LOCALPART_SIZE]; + char domain[MAX_DOMAINPART_SIZE]; }; struct filter_rcpt { - char user[MAX_LOCALPART_SIZE]; - char domain[MAX_DOMAINPART_SIZE]; + char user[MAX_LOCALPART_SIZE]; + char domain[MAX_DOMAINPART_SIZE]; }; struct filter_dataline { - char line[MAX_LINE_SIZE]; + char line[MAX_LINE_SIZE]; }; union filter_union { + struct filter_connect connect; struct filter_helo helo; struct filter_mail mail; struct filter_rcpt rcpt; @@ -84,8 +97,13 @@ struct filter_msg { void filter_init(void); void filter_loop(void); +void filter_register_connect_callback(enum filter_status (*)(u_int64_t, struct filter_connect *, void *), void *); void filter_register_helo_callback(enum filter_status (*)(u_int64_t, struct filter_helo *, void *), void *); void filter_register_ehlo_callback(enum filter_status (*)(u_int64_t, struct filter_helo *, void *), void *); void filter_register_mail_callback(enum filter_status (*)(u_int64_t, struct filter_mail *, void *), void *); void filter_register_rcpt_callback(enum filter_status (*)(u_int64_t, struct filter_rcpt *, void *), void *); void filter_register_dataline_callback(enum filter_status (*)(u_int64_t, struct filter_dataline *, void *), void *); +void filter_register_quit_callback(enum filter_status (*)(u_int64_t, void *), void *); +void filter_register_close_callback(enum filter_status (*)(u_int64_t, void *), void *); +void filter_register_rset_callback(enum filter_status (*)(u_int64_t, void *), void *); + |