1 /*
2  * Copyright (c) 1999-2004 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.21 2004/07/07 21:41:31 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 /* Shared protocol constants */
27 #define	MILTER_LEN_BYTES	4	/* length of 32 bit integer in bytes */
28 #define	MILTER_OPTLEN	(MILTER_LEN_BYTES * 3) /* length of options */
29 #define	MILTER_CHUNK_SIZE	65535	/* body chunk size */
30 #define	MILTER_MAX_DATA_SIZE	65535	/* default milter command data limit */
31 
32 /* These apply to SMFIF_* flags */
33 #define	SMFI_V1_ACTS	0x0000000FL	/* The actions of V1 filter */
34 #define	SMFI_V2_ACTS	0x0000003FL	/* The actions of V2 filter */
35 #define	SMFI_CURR_ACTS	SMFI_V2_ACTS	/* The current version */
36 
37 /* address families */
38 #define	SMFIA_UNKNOWN		'U'	/* unknown */
39 #define	SMFIA_UNIX		'L'	/* unix/local */
40 #define	SMFIA_INET		'4'	/* inet */
41 #define	SMFIA_INET6		'6'	/* inet6 */
42 
43 /* commands: don't use anything smaller than ' ' */
44 #define	SMFIC_ABORT		'A'	/* Abort */
45 #define	SMFIC_BODY		'B'	/* Body chunk */
46 #define	SMFIC_CONNECT		'C'	/* Connection information */
47 #define	SMFIC_MACRO		'D'	/* Define macro */
48 #define	SMFIC_BODYEOB		'E'	/* final body chunk (End) */
49 #define	SMFIC_HELO		'H'	/* HELO/EHLO */
50 #define	SMFIC_HEADER		'L'	/* Header */
51 #define	SMFIC_MAIL		'M'	/* MAIL from */
52 #define	SMFIC_EOH		'N'	/* EOH */
53 #define	SMFIC_OPTNEG		'O'	/* Option negotiation */
54 #define	SMFIC_QUIT		'Q'	/* QUIT */
55 #define	SMFIC_RCPT		'R'	/* RCPT to */
56 #if SMFI_VERSION > 3
57 #define	SMFIC_DATA		'T'	/* DATA */
58 #endif /* SMFI_VERSION > 3 */
59 #if SMFI_VERSION > 2
60 #define	SMFIC_UNKNOWN		'U'	/* Any unknown command */
61 #endif /* SMFI_VERSION > 2 */
62 
63 /* actions (replies) */
64 #define	SMFIR_ADDRCPT		'+'	/* add recipient */
65 #define	SMFIR_DELRCPT		'-'	/* remove recipient */
66 #define	SMFIR_ACCEPT		'a'	/* accept */
67 #define	SMFIR_REPLBODY		'b'	/* replace body (chunk) */
68 #define	SMFIR_CONTINUE		'c'	/* continue */
69 #define	SMFIR_DISCARD		'd'	/* discard */
70 #define	SMFIR_CHGHEADER		'm'	/* change header */
71 #define	SMFIR_PROGRESS		'p'	/* progress */
72 #define	SMFIR_REJECT		'r'	/* reject */
73 #define	SMFIR_TEMPFAIL		't'	/* tempfail */
74 #define	SMFIR_SHUTDOWN		'4'	/* 421: shutdown (internal to MTA) */
75 #define	SMFIR_ADDHEADER		'h'	/* add header */
76 #define	SMFIR_INSHEADER		'i'	/* insert header */
77 #define	SMFIR_REPLYCODE		'y'	/* reply code etc */
78 #define	SMFIR_QUARANTINE	'q'	/* quarantine */
79 
80 /* What the MTA can send/filter wants in protocol */
81 #define	SMFIP_NOCONNECT 0x00000001L	/* MTA should not send connect info */
82 #define	SMFIP_NOHELO	0x00000002L	/* MTA should not send HELO info */
83 #define	SMFIP_NOMAIL	0x00000004L	/* MTA should not send MAIL info */
84 #define	SMFIP_NORCPT	0x00000008L	/* MTA should not send RCPT info */
85 #define	SMFIP_NOBODY	0x00000010L	/* MTA should not send body */
86 #define	SMFIP_NOHDRS	0x00000020L	/* MTA should not send headers */
87 #define	SMFIP_NOEOH	0x00000040L	/* MTA should not send EOH */
88 #if _FFR_MILTER_NOHDR_RESP
89 #define	SMFIP_NOHREPL	0x00000080L	/* No reply for headers */
90 #endif /* _FFR_MILTER_NOHDR_RESP */
91 
92 #define	SMFI_V1_PROT	0x0000003FL	/* The protocol of V1 filter */
93 #define	SMFI_V2_PROT	0x0000007FL	/* The protocol of V2 filter */
94 #if _FFR_MILTER_NOHDR_RESP
95 #define	SMFI_CURR_PROT	0x000000FFL	/* The current version */
96 #else /* _FFR_MILTER_NOHDR_RESP */
97 #define	SMFI_CURR_PROT	SMFI_V2_PROT	/* The current version */
98 #endif /* _FFR_MILTER_NOHDR_RESP */
99 
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif /* !_LIBMILTER_MFDEF_H */
106