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