190792Sgshapiro/* 2168515Sgshapiro * Copyright (c) 1999-2007 Sendmail, Inc. and its suppliers. 390792Sgshapiro * All rights reserved. 490792Sgshapiro * 590792Sgshapiro * By using this file, you agree to the terms and conditions set 690792Sgshapiro * forth in the LICENSE file which can be found at the top level of 790792Sgshapiro * the sendmail distribution. 890792Sgshapiro * 990792Sgshapiro * 10203004Sgshapiro * $Id: mfdef.h,v 8.39 2009/11/06 00:57:08 ca Exp $ 1190792Sgshapiro */ 1290792Sgshapiro 1390792Sgshapiro/* 1490792Sgshapiro** mfdef.h -- Global definitions for mail filter and MTA. 1590792Sgshapiro*/ 1690792Sgshapiro 1790792Sgshapiro#ifndef _LIBMILTER_MFDEF_H 1890792Sgshapiro# define _LIBMILTER_MFDEF_H 1 1990792Sgshapiro 20168515Sgshapiro#ifndef SMFI_PROT_VERSION 21168515Sgshapiro# define SMFI_PROT_VERSION 6 /* MTA - libmilter protocol version */ 22168515Sgshapiro#endif /* SMFI_PROT_VERSION */ 23168515Sgshapiro 2490792Sgshapiro/* Shared protocol constants */ 25168515Sgshapiro#define MILTER_LEN_BYTES 4 /* length of 32 bit integer in bytes */ 26168515Sgshapiro#define MILTER_OPTLEN (MILTER_LEN_BYTES * 3) /* length of options */ 27168515Sgshapiro#define MILTER_CHUNK_SIZE 65535 /* body chunk size */ 28168515Sgshapiro#define MILTER_MAX_DATA_SIZE 65535 /* default milter command data limit */ 2990792Sgshapiro 30203004Sgshapiro#if _FFR_MDS_NEGOTIATE 31203004Sgshapiro# define MILTER_MDS_64K ((64 * 1024) - 1) 32203004Sgshapiro# define MILTER_MDS_256K ((256 * 1024) - 1) 33203004Sgshapiro# define MILTER_MDS_1M ((1024 * 1024) - 1) 34203004Sgshapiro#endif /* _FFR_MDS_NEGOTIATE */ 35203004Sgshapiro 3690792Sgshapiro/* These apply to SMFIF_* flags */ 3790792Sgshapiro#define SMFI_V1_ACTS 0x0000000FL /* The actions of V1 filter */ 38132943Sgshapiro#define SMFI_V2_ACTS 0x0000003FL /* The actions of V2 filter */ 39168515Sgshapiro#define SMFI_CURR_ACTS 0x000001FFL /* actions of current version */ 4090792Sgshapiro 4190792Sgshapiro/* address families */ 42168515Sgshapiro#define SMFIA_UNKNOWN 'U' /* unknown */ 43168515Sgshapiro#define SMFIA_UNIX 'L' /* unix/local */ 44168515Sgshapiro#define SMFIA_INET '4' /* inet */ 45168515Sgshapiro#define SMFIA_INET6 '6' /* inet6 */ 4690792Sgshapiro 4790792Sgshapiro/* commands: don't use anything smaller than ' ' */ 48168515Sgshapiro#define SMFIC_ABORT 'A' /* Abort */ 49168515Sgshapiro#define SMFIC_BODY 'B' /* Body chunk */ 50168515Sgshapiro#define SMFIC_CONNECT 'C' /* Connection information */ 51168515Sgshapiro#define SMFIC_MACRO 'D' /* Define macro */ 52168515Sgshapiro#define SMFIC_BODYEOB 'E' /* final body chunk (End) */ 53168515Sgshapiro#define SMFIC_HELO 'H' /* HELO/EHLO */ 54168515Sgshapiro#define SMFIC_QUIT_NC 'K' /* QUIT but new connection follows */ 55168515Sgshapiro#define SMFIC_HEADER 'L' /* Header */ 56168515Sgshapiro#define SMFIC_MAIL 'M' /* MAIL from */ 57168515Sgshapiro#define SMFIC_EOH 'N' /* EOH */ 58168515Sgshapiro#define SMFIC_OPTNEG 'O' /* Option negotiation */ 59168515Sgshapiro#define SMFIC_QUIT 'Q' /* QUIT */ 60168515Sgshapiro#define SMFIC_RCPT 'R' /* RCPT to */ 61168515Sgshapiro#define SMFIC_DATA 'T' /* DATA */ 62168515Sgshapiro#define SMFIC_UNKNOWN 'U' /* Any unknown command */ 6390792Sgshapiro 6490792Sgshapiro/* actions (replies) */ 65168515Sgshapiro#define SMFIR_ADDRCPT '+' /* add recipient */ 66168515Sgshapiro#define SMFIR_DELRCPT '-' /* remove recipient */ 67168515Sgshapiro#define SMFIR_ADDRCPT_PAR '2' /* add recipient (incl. ESMTP args) */ 68168515Sgshapiro#define SMFIR_SHUTDOWN '4' /* 421: shutdown (internal to MTA) */ 69168515Sgshapiro#define SMFIR_ACCEPT 'a' /* accept */ 70168515Sgshapiro#define SMFIR_REPLBODY 'b' /* replace body (chunk) */ 71168515Sgshapiro#define SMFIR_CONTINUE 'c' /* continue */ 72168515Sgshapiro#define SMFIR_DISCARD 'd' /* discard */ 73168515Sgshapiro#define SMFIR_CHGFROM 'e' /* change envelope sender (from) */ 74168515Sgshapiro#define SMFIR_CONN_FAIL 'f' /* cause a connection failure */ 75168515Sgshapiro#define SMFIR_ADDHEADER 'h' /* add header */ 76168515Sgshapiro#define SMFIR_INSHEADER 'i' /* insert header */ 77168515Sgshapiro#define SMFIR_SETSYMLIST 'l' /* set list of symbols (macros) */ 78168515Sgshapiro#define SMFIR_CHGHEADER 'm' /* change header */ 79168515Sgshapiro#define SMFIR_PROGRESS 'p' /* progress */ 80168515Sgshapiro#define SMFIR_QUARANTINE 'q' /* quarantine */ 81168515Sgshapiro#define SMFIR_REJECT 'r' /* reject */ 82168515Sgshapiro#define SMFIR_SKIP 's' /* skip */ 83168515Sgshapiro#define SMFIR_TEMPFAIL 't' /* tempfail */ 84168515Sgshapiro#define SMFIR_REPLYCODE 'y' /* reply code etc */ 8590792Sgshapiro 8690792Sgshapiro/* What the MTA can send/filter wants in protocol */ 87168515Sgshapiro#define SMFIP_NOCONNECT 0x00000001L /* MTA should not send connect info */ 88168515Sgshapiro#define SMFIP_NOHELO 0x00000002L /* MTA should not send HELO info */ 89168515Sgshapiro#define SMFIP_NOMAIL 0x00000004L /* MTA should not send MAIL info */ 90168515Sgshapiro#define SMFIP_NORCPT 0x00000008L /* MTA should not send RCPT info */ 91168515Sgshapiro#define SMFIP_NOBODY 0x00000010L /* MTA should not send body */ 92168515Sgshapiro#define SMFIP_NOHDRS 0x00000020L /* MTA should not send headers */ 93168515Sgshapiro#define SMFIP_NOEOH 0x00000040L /* MTA should not send EOH */ 94168515Sgshapiro#define SMFIP_NR_HDR 0x00000080L /* No reply for headers */ 95168515Sgshapiro#define SMFIP_NOHREPL SMFIP_NR_HDR /* No reply for headers */ 96168515Sgshapiro#define SMFIP_NOUNKNOWN 0x00000100L /* MTA should not send unknown commands */ 97168515Sgshapiro#define SMFIP_NODATA 0x00000200L /* MTA should not send DATA */ 98168515Sgshapiro#define SMFIP_SKIP 0x00000400L /* MTA understands SMFIS_SKIP */ 99168515Sgshapiro#define SMFIP_RCPT_REJ 0x00000800L /* MTA should also send rejected RCPTs */ 100168515Sgshapiro#define SMFIP_NR_CONN 0x00001000L /* No reply for connect */ 101168515Sgshapiro#define SMFIP_NR_HELO 0x00002000L /* No reply for HELO */ 102168515Sgshapiro#define SMFIP_NR_MAIL 0x00004000L /* No reply for MAIL */ 103168515Sgshapiro#define SMFIP_NR_RCPT 0x00008000L /* No reply for RCPT */ 104168515Sgshapiro#define SMFIP_NR_DATA 0x00010000L /* No reply for DATA */ 105168515Sgshapiro#define SMFIP_NR_UNKN 0x00020000L /* No reply for UNKN */ 106168515Sgshapiro#define SMFIP_NR_EOH 0x00040000L /* No reply for eoh */ 107168515Sgshapiro#define SMFIP_NR_BODY 0x00080000L /* No reply for body chunk */ 108168515Sgshapiro#define SMFIP_HDR_LEADSPC 0x00100000L /* header value leading space */ 109203004Sgshapiro#define SMFIP_MDS_256K 0x10000000L /* MILTER_MAX_DATA_SIZE=256K */ 110203004Sgshapiro#define SMFIP_MDS_1M 0x20000000L /* MILTER_MAX_DATA_SIZE=1M */ 111203004Sgshapiro/* #define SMFIP_ 0x40000000L reserved: see SMFI_INTERNAL*/ 11290792Sgshapiro 113168515Sgshapiro#define SMFI_V1_PROT 0x0000003FL /* The protocol of V1 filter */ 114168515Sgshapiro#define SMFI_V2_PROT 0x0000007FL /* The protocol of V2 filter */ 115157001Sgshapiro 116168515Sgshapiro/* all defined protocol bits */ 117168515Sgshapiro#define SMFI_CURR_PROT 0x001FFFFFL 11890792Sgshapiro 119203004Sgshapiro/* internal flags: only used between MTA and libmilter */ 120203004Sgshapiro#define SMFI_INTERNAL 0x70000000L 121203004Sgshapiro 122203004Sgshapiro#if _FFR_MILTER_CHECK 123203004Sgshapiro# define SMFIP_TEST 0x80000000L 124203004Sgshapiro#endif /* _FFR_MILTER_CHECK */ 125203004Sgshapiro 12690792Sgshapiro#endif /* !_LIBMILTER_MFDEF_H */ 127