xref: /freebsd/contrib/sendmail/include/libmilter/mfdef.h (revision e2c0e292e8a7ca00ba99bcfccc9e637f45c3e8b1)
140266059SGregory Neil Shapiro /*
25dd76dd0SGregory Neil Shapiro  * Copyright (c) 1999-2007 Proofpoint, Inc. and its suppliers.
340266059SGregory Neil Shapiro  *	All rights reserved.
440266059SGregory Neil Shapiro  *
540266059SGregory Neil Shapiro  * By using this file, you agree to the terms and conditions set
640266059SGregory Neil Shapiro  * forth in the LICENSE file which can be found at the top level of
740266059SGregory Neil Shapiro  * the sendmail distribution.
840266059SGregory Neil Shapiro  *
940266059SGregory Neil Shapiro  *
104313cc83SGregory Neil Shapiro  *	$Id: mfdef.h,v 8.40 2013-11-22 20:51:27 ca Exp $
1140266059SGregory Neil Shapiro  */
1240266059SGregory Neil Shapiro 
1340266059SGregory Neil Shapiro /*
1440266059SGregory Neil Shapiro **  mfdef.h -- Global definitions for mail filter and MTA.
1540266059SGregory Neil Shapiro */
1640266059SGregory Neil Shapiro 
1740266059SGregory Neil Shapiro #ifndef _LIBMILTER_MFDEF_H
1840266059SGregory Neil Shapiro # define _LIBMILTER_MFDEF_H	1
1940266059SGregory Neil Shapiro 
20d0cef73dSGregory Neil Shapiro #ifndef SMFI_PROT_VERSION
21d0cef73dSGregory Neil Shapiro # define SMFI_PROT_VERSION	6	/* MTA - libmilter protocol version */
22*5b0945b5SGregory Neil Shapiro #endif
23d0cef73dSGregory Neil Shapiro 
2440266059SGregory Neil Shapiro /* Shared protocol constants */
2540266059SGregory Neil Shapiro #define MILTER_LEN_BYTES	4	/* length of 32 bit integer in bytes */
2640266059SGregory Neil Shapiro #define MILTER_OPTLEN	(MILTER_LEN_BYTES * 3) /* length of options */
2740266059SGregory Neil Shapiro #define MILTER_CHUNK_SIZE	65535	/* body chunk size */
28e92d3f3fSGregory Neil Shapiro #define MILTER_MAX_DATA_SIZE	65535	/* default milter command data limit */
2940266059SGregory Neil Shapiro 
309bd497b8SGregory Neil Shapiro #if _FFR_MDS_NEGOTIATE
319bd497b8SGregory Neil Shapiro # define MILTER_MDS_64K	((64 * 1024) - 1)
329bd497b8SGregory Neil Shapiro # define MILTER_MDS_256K ((256 * 1024) - 1)
339bd497b8SGregory Neil Shapiro # define MILTER_MDS_1M	((1024 * 1024) - 1)
349bd497b8SGregory Neil Shapiro #endif /* _FFR_MDS_NEGOTIATE */
359bd497b8SGregory Neil Shapiro 
3640266059SGregory Neil Shapiro /* These apply to SMFIF_* flags */
3740266059SGregory Neil Shapiro #define SMFI_V1_ACTS	0x0000000FL	/* The actions of V1 filter */
3840266059SGregory Neil Shapiro #define SMFI_V2_ACTS	0x0000003FL	/* The actions of V2 filter */
39d0cef73dSGregory Neil Shapiro #define SMFI_CURR_ACTS	0x000001FFL	/* actions of current version */
4040266059SGregory Neil Shapiro 
4140266059SGregory Neil Shapiro /* address families */
4240266059SGregory Neil Shapiro #define SMFIA_UNKNOWN		'U'	/* unknown */
4340266059SGregory Neil Shapiro #define SMFIA_UNIX		'L'	/* unix/local */
4440266059SGregory Neil Shapiro #define SMFIA_INET		'4'	/* inet */
4540266059SGregory Neil Shapiro #define SMFIA_INET6		'6'	/* inet6 */
4640266059SGregory Neil Shapiro 
4740266059SGregory Neil Shapiro /* commands: don't use anything smaller than ' ' */
4840266059SGregory Neil Shapiro #define SMFIC_ABORT		'A'	/* Abort */
4940266059SGregory Neil Shapiro #define SMFIC_BODY		'B'	/* Body chunk */
5040266059SGregory Neil Shapiro #define SMFIC_CONNECT		'C'	/* Connection information */
5140266059SGregory Neil Shapiro #define SMFIC_MACRO		'D'	/* Define macro */
5240266059SGregory Neil Shapiro #define SMFIC_BODYEOB		'E'	/* final body chunk (End) */
5340266059SGregory Neil Shapiro #define SMFIC_HELO		'H'	/* HELO/EHLO */
54d0cef73dSGregory Neil Shapiro #define SMFIC_QUIT_NC		'K'	/* QUIT but new connection follows */
5540266059SGregory Neil Shapiro #define SMFIC_HEADER		'L'	/* Header */
5640266059SGregory Neil Shapiro #define SMFIC_MAIL		'M'	/* MAIL from */
5740266059SGregory Neil Shapiro #define SMFIC_EOH		'N'	/* EOH */
5840266059SGregory Neil Shapiro #define SMFIC_OPTNEG		'O'	/* Option negotiation */
5940266059SGregory Neil Shapiro #define SMFIC_QUIT		'Q'	/* QUIT */
6040266059SGregory Neil Shapiro #define SMFIC_RCPT		'R'	/* RCPT to */
61e92d3f3fSGregory Neil Shapiro #define SMFIC_DATA		'T'	/* DATA */
62e92d3f3fSGregory Neil Shapiro #define SMFIC_UNKNOWN		'U'	/* Any unknown command */
6340266059SGregory Neil Shapiro 
6440266059SGregory Neil Shapiro /* actions (replies) */
6540266059SGregory Neil Shapiro #define SMFIR_ADDRCPT		'+'	/* add recipient */
6640266059SGregory Neil Shapiro #define SMFIR_DELRCPT		'-'	/* remove recipient */
67d0cef73dSGregory Neil Shapiro #define SMFIR_ADDRCPT_PAR	'2'	/* add recipient (incl. ESMTP args) */
68d0cef73dSGregory Neil Shapiro #define SMFIR_SHUTDOWN		'4'	/* 421: shutdown (internal to MTA) */
6940266059SGregory Neil Shapiro #define SMFIR_ACCEPT		'a'	/* accept */
7040266059SGregory Neil Shapiro #define SMFIR_REPLBODY		'b'	/* replace body (chunk) */
7140266059SGregory Neil Shapiro #define SMFIR_CONTINUE		'c'	/* continue */
7240266059SGregory Neil Shapiro #define SMFIR_DISCARD		'd'	/* discard */
73d0cef73dSGregory Neil Shapiro #define SMFIR_CHGFROM		'e'	/* change envelope sender (from) */
744e4196cbSGregory Neil Shapiro #define SMFIR_CONN_FAIL		'f'	/* cause a connection failure */
7540266059SGregory Neil Shapiro #define SMFIR_ADDHEADER		'h'	/* add header */
76e92d3f3fSGregory Neil Shapiro #define SMFIR_INSHEADER		'i'	/* insert header */
77d0cef73dSGregory Neil Shapiro #define SMFIR_SETSYMLIST	'l'	/* set list of symbols (macros) */
78d0cef73dSGregory Neil Shapiro #define SMFIR_CHGHEADER		'm'	/* change header */
79d0cef73dSGregory Neil Shapiro #define SMFIR_PROGRESS		'p'	/* progress */
8040266059SGregory Neil Shapiro #define SMFIR_QUARANTINE	'q'	/* quarantine */
81d0cef73dSGregory Neil Shapiro #define SMFIR_REJECT		'r'	/* reject */
82d0cef73dSGregory Neil Shapiro #define SMFIR_SKIP		's'	/* skip */
83d0cef73dSGregory Neil Shapiro #define SMFIR_TEMPFAIL		't'	/* tempfail */
84d0cef73dSGregory Neil Shapiro #define SMFIR_REPLYCODE		'y'	/* reply code etc */
8540266059SGregory Neil Shapiro 
8640266059SGregory Neil Shapiro /* What the MTA can send/filter wants in protocol */
8740266059SGregory Neil Shapiro #define SMFIP_NOCONNECT 0x00000001L	/* MTA should not send connect info */
8840266059SGregory Neil Shapiro #define SMFIP_NOHELO	0x00000002L	/* MTA should not send HELO info */
8940266059SGregory Neil Shapiro #define SMFIP_NOMAIL	0x00000004L	/* MTA should not send MAIL info */
9040266059SGregory Neil Shapiro #define SMFIP_NORCPT	0x00000008L	/* MTA should not send RCPT info */
9140266059SGregory Neil Shapiro #define SMFIP_NOBODY	0x00000010L	/* MTA should not send body */
9240266059SGregory Neil Shapiro #define SMFIP_NOHDRS	0x00000020L	/* MTA should not send headers */
9340266059SGregory Neil Shapiro #define SMFIP_NOEOH	0x00000040L	/* MTA should not send EOH */
94d0cef73dSGregory Neil Shapiro #define SMFIP_NR_HDR	0x00000080L	/* No reply for headers */
95d0cef73dSGregory Neil Shapiro #define SMFIP_NOHREPL	SMFIP_NR_HDR	/* No reply for headers */
96d0cef73dSGregory Neil Shapiro #define SMFIP_NOUNKNOWN 0x00000100L /* MTA should not send unknown commands */
974e4196cbSGregory Neil Shapiro #define SMFIP_NODATA    0x00000200L	/* MTA should not send DATA */
98d0cef73dSGregory Neil Shapiro #define SMFIP_SKIP	0x00000400L	/* MTA understands SMFIS_SKIP */
99d0cef73dSGregory Neil Shapiro #define SMFIP_RCPT_REJ	0x00000800L /* MTA should also send rejected RCPTs */
100d0cef73dSGregory Neil Shapiro #define SMFIP_NR_CONN	0x00001000L	/* No reply for connect */
101d0cef73dSGregory Neil Shapiro #define SMFIP_NR_HELO	0x00002000L	/* No reply for HELO */
102d0cef73dSGregory Neil Shapiro #define SMFIP_NR_MAIL	0x00004000L	/* No reply for MAIL */
103d0cef73dSGregory Neil Shapiro #define SMFIP_NR_RCPT	0x00008000L	/* No reply for RCPT */
104d0cef73dSGregory Neil Shapiro #define SMFIP_NR_DATA	0x00010000L	/* No reply for DATA */
105d0cef73dSGregory Neil Shapiro #define SMFIP_NR_UNKN	0x00020000L	/* No reply for UNKN */
106d0cef73dSGregory Neil Shapiro #define SMFIP_NR_EOH	0x00040000L	/* No reply for eoh */
107d0cef73dSGregory Neil Shapiro #define SMFIP_NR_BODY	0x00080000L	/* No reply for body chunk */
108d0cef73dSGregory Neil Shapiro #define SMFIP_HDR_LEADSPC 0x00100000L	/* header value leading space */
1099bd497b8SGregory Neil Shapiro #define SMFIP_MDS_256K	0x10000000L	/* MILTER_MAX_DATA_SIZE=256K */
1109bd497b8SGregory Neil Shapiro #define SMFIP_MDS_1M	0x20000000L	/* MILTER_MAX_DATA_SIZE=1M */
1119bd497b8SGregory Neil Shapiro /* #define SMFIP_	0x40000000L	reserved: see SMFI_INTERNAL*/
11240266059SGregory Neil Shapiro 
11340266059SGregory Neil Shapiro #define SMFI_V1_PROT	0x0000003FL	/* The protocol of V1 filter */
11440266059SGregory Neil Shapiro #define SMFI_V2_PROT	0x0000007FL	/* The protocol of V2 filter */
1154e4196cbSGregory Neil Shapiro 
116d0cef73dSGregory Neil Shapiro /* all defined protocol bits */
117d0cef73dSGregory Neil Shapiro #define SMFI_CURR_PROT	0x001FFFFFL
11840266059SGregory Neil Shapiro 
1199bd497b8SGregory Neil Shapiro /* internal flags: only used between MTA and libmilter */
1209bd497b8SGregory Neil Shapiro #define SMFI_INTERNAL	0x70000000L
1219bd497b8SGregory Neil Shapiro 
1229bd497b8SGregory Neil Shapiro #if _FFR_MILTER_CHECK
1239bd497b8SGregory Neil Shapiro # define SMFIP_TEST	0x80000000L
124*5b0945b5SGregory Neil Shapiro #endif
1259bd497b8SGregory Neil Shapiro 
12640266059SGregory Neil Shapiro #endif /* !_LIBMILTER_MFDEF_H */
127