xref: /titanic_41/usr/src/cmd/sendmail/include/libmilter/mfdef.h (revision 1ae0874509b6811fdde1dfd46f0d93fd09867a3f)
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
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_CONN_FAIL		'f'	/* cause a connection failure */
71 #define	SMFIR_CHGHEADER		'm'	/* change header */
72 #define	SMFIR_PROGRESS		'p'	/* progress */
73 #define	SMFIR_REJECT		'r'	/* reject */
74 #define	SMFIR_TEMPFAIL		't'	/* tempfail */
75 #define	SMFIR_SHUTDOWN		'4'	/* 421: shutdown (internal to MTA) */
76 #define	SMFIR_ADDHEADER		'h'	/* add header */
77 #define	SMFIR_INSHEADER		'i'	/* insert header */
78 #define	SMFIR_REPLYCODE		'y'	/* reply code etc */
79 #define	SMFIR_QUARANTINE	'q'	/* quarantine */
80 
81 /* What the MTA can send/filter wants in protocol */
82 #define	SMFIP_NOCONNECT 0x00000001L	/* MTA should not send connect info */
83 #define	SMFIP_NOHELO	0x00000002L	/* MTA should not send HELO info */
84 #define	SMFIP_NOMAIL	0x00000004L	/* MTA should not send MAIL info */
85 #define	SMFIP_NORCPT	0x00000008L	/* MTA should not send RCPT info */
86 #define	SMFIP_NOBODY	0x00000010L	/* MTA should not send body */
87 #define	SMFIP_NOHDRS	0x00000020L	/* MTA should not send headers */
88 #define	SMFIP_NOEOH	0x00000040L	/* MTA should not send EOH */
89 #if _FFR_MILTER_NOHDR_RESP
90 #define	SMFIP_NOHREPL	0x00000080L	/* No reply for headers */
91 #endif /* _FFR_MILTER_NOHDR_RESP */
92 #define	SMFIP_NOUNKNOWN	0x00000100L	/* MTA should not send unknown cmd */
93 #define	SMFIP_NODATA	0x00000200L	/* MTA should not send DATA */
94 
95 #define	SMFI_V1_PROT	0x0000003FL	/* The protocol of V1 filter */
96 #define	SMFI_V2_PROT	0x0000007FL	/* The protocol of V2 filter */
97 
98 /* Note: the "current" version is now determined dynamically in milter.c */
99 #if _FFR_MILTER_NOHDR_RESP
100 #define	SMFI_CURR_PROT	0x000000FFL
101 #else /* _FFR_MILTER_NOHDR_RESP */
102 #define	SMFI_CURR_PROT	SMFI_V2_PROT
103 #endif /* _FFR_MILTER_NOHDR_RESP */
104 
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif /* !_LIBMILTER_MFDEF_H */
111