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