xref: /freebsd/contrib/sendmail/include/libmilter/mfdef.h (revision 27c43fe1f3795622c5bd4bbfc465a29a800c0799)
1 /*
2  * Copyright (c) 1999-2007 Proofpoint, Inc. and its suppliers.
3  *	All rights reserved.
4  *
5  * By using this file, you agree to the terms and conditions set
6  * forth in the LICENSE file which can be found at the top level of
7  * the sendmail distribution.
8  *
9  *
10  *	$Id: mfdef.h,v 8.40 2013/11/22 20:51:27 ca Exp $
11  */
12 
13 /*
14 **  mfdef.h -- Global definitions for mail filter and MTA.
15 */
16 
17 #ifndef _LIBMILTER_MFDEF_H
18 # define _LIBMILTER_MFDEF_H	1
19 
20 #ifndef SMFI_PROT_VERSION
21 # define SMFI_PROT_VERSION	6	/* MTA - libmilter protocol version */
22 #endif /* SMFI_PROT_VERSION */
23 
24 /* Shared protocol constants */
25 #define MILTER_LEN_BYTES	4	/* length of 32 bit integer in bytes */
26 #define MILTER_OPTLEN	(MILTER_LEN_BYTES * 3) /* length of options */
27 #define MILTER_CHUNK_SIZE	65535	/* body chunk size */
28 #define MILTER_MAX_DATA_SIZE	65535	/* default milter command data limit */
29 
30 #if _FFR_MDS_NEGOTIATE
31 # define MILTER_MDS_64K	((64 * 1024) - 1)
32 # define MILTER_MDS_256K ((256 * 1024) - 1)
33 # define MILTER_MDS_1M	((1024 * 1024) - 1)
34 #endif /* _FFR_MDS_NEGOTIATE */
35 
36 /* These apply to SMFIF_* flags */
37 #define SMFI_V1_ACTS	0x0000000FL	/* The actions of V1 filter */
38 #define SMFI_V2_ACTS	0x0000003FL	/* The actions of V2 filter */
39 #define SMFI_CURR_ACTS	0x000001FFL	/* actions of current version */
40 
41 /* address families */
42 #define SMFIA_UNKNOWN		'U'	/* unknown */
43 #define SMFIA_UNIX		'L'	/* unix/local */
44 #define SMFIA_INET		'4'	/* inet */
45 #define SMFIA_INET6		'6'	/* inet6 */
46 
47 /* commands: don't use anything smaller than ' ' */
48 #define SMFIC_ABORT		'A'	/* Abort */
49 #define SMFIC_BODY		'B'	/* Body chunk */
50 #define SMFIC_CONNECT		'C'	/* Connection information */
51 #define SMFIC_MACRO		'D'	/* Define macro */
52 #define SMFIC_BODYEOB		'E'	/* final body chunk (End) */
53 #define SMFIC_HELO		'H'	/* HELO/EHLO */
54 #define SMFIC_QUIT_NC		'K'	/* QUIT but new connection follows */
55 #define SMFIC_HEADER		'L'	/* Header */
56 #define SMFIC_MAIL		'M'	/* MAIL from */
57 #define SMFIC_EOH		'N'	/* EOH */
58 #define SMFIC_OPTNEG		'O'	/* Option negotiation */
59 #define SMFIC_QUIT		'Q'	/* QUIT */
60 #define SMFIC_RCPT		'R'	/* RCPT to */
61 #define SMFIC_DATA		'T'	/* DATA */
62 #define SMFIC_UNKNOWN		'U'	/* Any unknown command */
63 
64 /* actions (replies) */
65 #define SMFIR_ADDRCPT		'+'	/* add recipient */
66 #define SMFIR_DELRCPT		'-'	/* remove recipient */
67 #define SMFIR_ADDRCPT_PAR	'2'	/* add recipient (incl. ESMTP args) */
68 #define SMFIR_SHUTDOWN		'4'	/* 421: shutdown (internal to MTA) */
69 #define SMFIR_ACCEPT		'a'	/* accept */
70 #define SMFIR_REPLBODY		'b'	/* replace body (chunk) */
71 #define SMFIR_CONTINUE		'c'	/* continue */
72 #define SMFIR_DISCARD		'd'	/* discard */
73 #define SMFIR_CHGFROM		'e'	/* change envelope sender (from) */
74 #define SMFIR_CONN_FAIL		'f'	/* cause a connection failure */
75 #define SMFIR_ADDHEADER		'h'	/* add header */
76 #define SMFIR_INSHEADER		'i'	/* insert header */
77 #define SMFIR_SETSYMLIST	'l'	/* set list of symbols (macros) */
78 #define SMFIR_CHGHEADER		'm'	/* change header */
79 #define SMFIR_PROGRESS		'p'	/* progress */
80 #define SMFIR_QUARANTINE	'q'	/* quarantine */
81 #define SMFIR_REJECT		'r'	/* reject */
82 #define SMFIR_SKIP		's'	/* skip */
83 #define SMFIR_TEMPFAIL		't'	/* tempfail */
84 #define SMFIR_REPLYCODE		'y'	/* reply code etc */
85 
86 /* What the MTA can send/filter wants in protocol */
87 #define SMFIP_NOCONNECT 0x00000001L	/* MTA should not send connect info */
88 #define SMFIP_NOHELO	0x00000002L	/* MTA should not send HELO info */
89 #define SMFIP_NOMAIL	0x00000004L	/* MTA should not send MAIL info */
90 #define SMFIP_NORCPT	0x00000008L	/* MTA should not send RCPT info */
91 #define SMFIP_NOBODY	0x00000010L	/* MTA should not send body */
92 #define SMFIP_NOHDRS	0x00000020L	/* MTA should not send headers */
93 #define SMFIP_NOEOH	0x00000040L	/* MTA should not send EOH */
94 #define SMFIP_NR_HDR	0x00000080L	/* No reply for headers */
95 #define SMFIP_NOHREPL	SMFIP_NR_HDR	/* No reply for headers */
96 #define SMFIP_NOUNKNOWN 0x00000100L /* MTA should not send unknown commands */
97 #define SMFIP_NODATA    0x00000200L	/* MTA should not send DATA */
98 #define SMFIP_SKIP	0x00000400L	/* MTA understands SMFIS_SKIP */
99 #define SMFIP_RCPT_REJ	0x00000800L /* MTA should also send rejected RCPTs */
100 #define SMFIP_NR_CONN	0x00001000L	/* No reply for connect */
101 #define SMFIP_NR_HELO	0x00002000L	/* No reply for HELO */
102 #define SMFIP_NR_MAIL	0x00004000L	/* No reply for MAIL */
103 #define SMFIP_NR_RCPT	0x00008000L	/* No reply for RCPT */
104 #define SMFIP_NR_DATA	0x00010000L	/* No reply for DATA */
105 #define SMFIP_NR_UNKN	0x00020000L	/* No reply for UNKN */
106 #define SMFIP_NR_EOH	0x00040000L	/* No reply for eoh */
107 #define SMFIP_NR_BODY	0x00080000L	/* No reply for body chunk */
108 #define SMFIP_HDR_LEADSPC 0x00100000L	/* header value leading space */
109 #define SMFIP_MDS_256K	0x10000000L	/* MILTER_MAX_DATA_SIZE=256K */
110 #define SMFIP_MDS_1M	0x20000000L	/* MILTER_MAX_DATA_SIZE=1M */
111 /* #define SMFIP_	0x40000000L	reserved: see SMFI_INTERNAL*/
112 
113 #define SMFI_V1_PROT	0x0000003FL	/* The protocol of V1 filter */
114 #define SMFI_V2_PROT	0x0000007FL	/* The protocol of V2 filter */
115 
116 /* all defined protocol bits */
117 #define SMFI_CURR_PROT	0x001FFFFFL
118 
119 /* internal flags: only used between MTA and libmilter */
120 #define SMFI_INTERNAL	0x70000000L
121 
122 #if _FFR_MILTER_CHECK
123 # define SMFIP_TEST	0x80000000L
124 #endif /* _FFR_MILTER_CHECK */
125 
126 #endif /* !_LIBMILTER_MFDEF_H */
127