xref: /titanic_50/usr/src/cmd/sendmail/include/libmilter/mfdef.h (revision 3244bcaa97c6de4c5692dd87485de1ef73364ab5)
1 /*
2  * Copyright (c) 1999-2006 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.36 2006/11/28 18:31:00 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #ifndef SMFI_PROT_VERSION
27 #define	SMFI_PROT_VERSION	6	/* MTA - libmilter protocol version */
28 #endif /* SMFI_PROT_VERSION */
29 
30 /* Shared protocol constants */
31 #define	MILTER_LEN_BYTES	4	/* length of 32 bit integer in bytes */
32 #define	MILTER_OPTLEN	(MILTER_LEN_BYTES * 3) /* length of options */
33 #define	MILTER_CHUNK_SIZE	65535	/* body chunk size */
34 #define	MILTER_MAX_DATA_SIZE	65535	/* default milter command data limit */
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	0x000000FFL	/* 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 
110 #define	SMFI_V1_PROT	0x0000003FL	/* The protocol of V1 filter */
111 #define	SMFI_V2_PROT	0x0000007FL	/* The protocol of V2 filter */
112 
113 /* all defined protocol bits */
114 #define	SMFI_CURR_PROT	0x001FFFFFL
115 
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif /* !_LIBMILTER_MFDEF_H */
122