17c478bd9Sstevel@tonic-gate /* 24aac33d3Sjbeck * Copyright (c) 1999-2007 Sendmail, Inc. and its suppliers. 37c478bd9Sstevel@tonic-gate * All rights reserved. 47c478bd9Sstevel@tonic-gate * 57c478bd9Sstevel@tonic-gate * By using this file, you agree to the terms and conditions set 67c478bd9Sstevel@tonic-gate * forth in the LICENSE file which can be found at the top level of 77c478bd9Sstevel@tonic-gate * the sendmail distribution. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * 10*e9af4bc0SJohn Beck * $Id: mfdef.h,v 8.39 2009/11/06 00:57:08 ca Exp $ 117c478bd9Sstevel@tonic-gate */ 127c478bd9Sstevel@tonic-gate 137c478bd9Sstevel@tonic-gate /* 147c478bd9Sstevel@tonic-gate * mfdef.h -- Global definitions for mail filter and MTA. 157c478bd9Sstevel@tonic-gate */ 167c478bd9Sstevel@tonic-gate 177c478bd9Sstevel@tonic-gate #ifndef _LIBMILTER_MFDEF_H 187c478bd9Sstevel@tonic-gate #define _LIBMILTER_MFDEF_H 197c478bd9Sstevel@tonic-gate 207c478bd9Sstevel@tonic-gate #ifdef __cplusplus 217c478bd9Sstevel@tonic-gate extern "C" { 227c478bd9Sstevel@tonic-gate #endif 237c478bd9Sstevel@tonic-gate 24058561cbSjbeck #ifndef SMFI_PROT_VERSION 25058561cbSjbeck #define SMFI_PROT_VERSION 6 /* MTA - libmilter protocol version */ 26058561cbSjbeck #endif /* SMFI_PROT_VERSION */ 27058561cbSjbeck 287c478bd9Sstevel@tonic-gate /* Shared protocol constants */ 297c478bd9Sstevel@tonic-gate #define MILTER_LEN_BYTES 4 /* length of 32 bit integer in bytes */ 307c478bd9Sstevel@tonic-gate #define MILTER_OPTLEN (MILTER_LEN_BYTES * 3) /* length of options */ 317c478bd9Sstevel@tonic-gate #define MILTER_CHUNK_SIZE 65535 /* body chunk size */ 327c478bd9Sstevel@tonic-gate #define MILTER_MAX_DATA_SIZE 65535 /* default milter command data limit */ 337c478bd9Sstevel@tonic-gate 34*e9af4bc0SJohn Beck #if _FFR_MDS_NEGOTIATE 35*e9af4bc0SJohn Beck #define MILTER_MDS_64K ((64 * 1024) - 1) 36*e9af4bc0SJohn Beck #define MILTER_MDS_256K ((256 * 1024) - 1) 37*e9af4bc0SJohn Beck #define MILTER_MDS_1M ((1024 * 1024) - 1) 38*e9af4bc0SJohn Beck #endif /* _FFR_MDS_NEGOTIATE */ 39*e9af4bc0SJohn Beck 407c478bd9Sstevel@tonic-gate /* These apply to SMFIF_* flags */ 417c478bd9Sstevel@tonic-gate #define SMFI_V1_ACTS 0x0000000FL /* The actions of V1 filter */ 427c478bd9Sstevel@tonic-gate #define SMFI_V2_ACTS 0x0000003FL /* The actions of V2 filter */ 434aac33d3Sjbeck #define SMFI_CURR_ACTS 0x000001FFL /* actions of current version */ 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* address families */ 467c478bd9Sstevel@tonic-gate #define SMFIA_UNKNOWN 'U' /* unknown */ 477c478bd9Sstevel@tonic-gate #define SMFIA_UNIX 'L' /* unix/local */ 487c478bd9Sstevel@tonic-gate #define SMFIA_INET '4' /* inet */ 497c478bd9Sstevel@tonic-gate #define SMFIA_INET6 '6' /* inet6 */ 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate /* commands: don't use anything smaller than ' ' */ 527c478bd9Sstevel@tonic-gate #define SMFIC_ABORT 'A' /* Abort */ 537c478bd9Sstevel@tonic-gate #define SMFIC_BODY 'B' /* Body chunk */ 547c478bd9Sstevel@tonic-gate #define SMFIC_CONNECT 'C' /* Connection information */ 557c478bd9Sstevel@tonic-gate #define SMFIC_MACRO 'D' /* Define macro */ 567c478bd9Sstevel@tonic-gate #define SMFIC_BODYEOB 'E' /* final body chunk (End) */ 577c478bd9Sstevel@tonic-gate #define SMFIC_HELO 'H' /* HELO/EHLO */ 58058561cbSjbeck #define SMFIC_QUIT_NC 'K' /* QUIT but new connection follows */ 597c478bd9Sstevel@tonic-gate #define SMFIC_HEADER 'L' /* Header */ 607c478bd9Sstevel@tonic-gate #define SMFIC_MAIL 'M' /* MAIL from */ 617c478bd9Sstevel@tonic-gate #define SMFIC_EOH 'N' /* EOH */ 627c478bd9Sstevel@tonic-gate #define SMFIC_OPTNEG 'O' /* Option negotiation */ 637c478bd9Sstevel@tonic-gate #define SMFIC_QUIT 'Q' /* QUIT */ 647c478bd9Sstevel@tonic-gate #define SMFIC_RCPT 'R' /* RCPT to */ 657c478bd9Sstevel@tonic-gate #define SMFIC_DATA 'T' /* DATA */ 667c478bd9Sstevel@tonic-gate #define SMFIC_UNKNOWN 'U' /* Any unknown command */ 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* actions (replies) */ 697c478bd9Sstevel@tonic-gate #define SMFIR_ADDRCPT '+' /* add recipient */ 707c478bd9Sstevel@tonic-gate #define SMFIR_DELRCPT '-' /* remove recipient */ 71058561cbSjbeck #define SMFIR_ADDRCPT_PAR '2' /* add recipient (incl. ESMTP args) */ 72058561cbSjbeck #define SMFIR_SHUTDOWN '4' /* 421: shutdown (internal to MTA) */ 737c478bd9Sstevel@tonic-gate #define SMFIR_ACCEPT 'a' /* accept */ 747c478bd9Sstevel@tonic-gate #define SMFIR_REPLBODY 'b' /* replace body (chunk) */ 757c478bd9Sstevel@tonic-gate #define SMFIR_CONTINUE 'c' /* continue */ 767c478bd9Sstevel@tonic-gate #define SMFIR_DISCARD 'd' /* discard */ 77058561cbSjbeck #define SMFIR_CHGFROM 'e' /* change envelope sender (from) */ 7849218d4fSjbeck #define SMFIR_CONN_FAIL 'f' /* cause a connection failure */ 797c478bd9Sstevel@tonic-gate #define SMFIR_ADDHEADER 'h' /* add header */ 807c478bd9Sstevel@tonic-gate #define SMFIR_INSHEADER 'i' /* insert header */ 81058561cbSjbeck #define SMFIR_SETSYMLIST 'l' /* set list of symbols (macros) */ 82058561cbSjbeck #define SMFIR_CHGHEADER 'm' /* change header */ 83058561cbSjbeck #define SMFIR_PROGRESS 'p' /* progress */ 847c478bd9Sstevel@tonic-gate #define SMFIR_QUARANTINE 'q' /* quarantine */ 85058561cbSjbeck #define SMFIR_REJECT 'r' /* reject */ 86058561cbSjbeck #define SMFIR_SKIP 's' /* skip */ 87058561cbSjbeck #define SMFIR_TEMPFAIL 't' /* tempfail */ 88058561cbSjbeck #define SMFIR_REPLYCODE 'y' /* reply code etc */ 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate /* What the MTA can send/filter wants in protocol */ 917c478bd9Sstevel@tonic-gate #define SMFIP_NOCONNECT 0x00000001L /* MTA should not send connect info */ 927c478bd9Sstevel@tonic-gate #define SMFIP_NOHELO 0x00000002L /* MTA should not send HELO info */ 937c478bd9Sstevel@tonic-gate #define SMFIP_NOMAIL 0x00000004L /* MTA should not send MAIL info */ 947c478bd9Sstevel@tonic-gate #define SMFIP_NORCPT 0x00000008L /* MTA should not send RCPT info */ 957c478bd9Sstevel@tonic-gate #define SMFIP_NOBODY 0x00000010L /* MTA should not send body */ 967c478bd9Sstevel@tonic-gate #define SMFIP_NOHDRS 0x00000020L /* MTA should not send headers */ 977c478bd9Sstevel@tonic-gate #define SMFIP_NOEOH 0x00000040L /* MTA should not send EOH */ 98058561cbSjbeck #define SMFIP_NR_HDR 0x00000080L /* No reply for headers */ 99058561cbSjbeck #define SMFIP_NOHREPL SMFIP_NR_HDR /* No reply for headers */ 100058561cbSjbeck #define SMFIP_NOUNKNOWN 0x00000100L /* MTA should not send unknown commands */ 10149218d4fSjbeck #define SMFIP_NODATA 0x00000200L /* MTA should not send DATA */ 102058561cbSjbeck #define SMFIP_SKIP 0x00000400L /* MTA understands SMFIS_SKIP */ 103058561cbSjbeck #define SMFIP_RCPT_REJ 0x00000800L /* MTA should also send rejected RCPTs */ 104058561cbSjbeck #define SMFIP_NR_CONN 0x00001000L /* No reply for connect */ 105058561cbSjbeck #define SMFIP_NR_HELO 0x00002000L /* No reply for HELO */ 106058561cbSjbeck #define SMFIP_NR_MAIL 0x00004000L /* No reply for MAIL */ 107058561cbSjbeck #define SMFIP_NR_RCPT 0x00008000L /* No reply for RCPT */ 108058561cbSjbeck #define SMFIP_NR_DATA 0x00010000L /* No reply for DATA */ 109058561cbSjbeck #define SMFIP_NR_UNKN 0x00020000L /* No reply for UNKN */ 110058561cbSjbeck #define SMFIP_NR_EOH 0x00040000L /* No reply for eoh */ 111058561cbSjbeck #define SMFIP_NR_BODY 0x00080000L /* No reply for body chunk */ 112058561cbSjbeck #define SMFIP_HDR_LEADSPC 0x00100000L /* header value leading space */ 113*e9af4bc0SJohn Beck #define SMFIP_MDS_256K 0x10000000L /* MILTER_MAX_DATA_SIZE=256K */ 114*e9af4bc0SJohn Beck #define SMFIP_MDS_1M 0x20000000L /* MILTER_MAX_DATA_SIZE=1M */ 115*e9af4bc0SJohn Beck /* #define SMFIP_ 0x40000000L reserved: see SMFI_INTERNAL */ 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate #define SMFI_V1_PROT 0x0000003FL /* The protocol of V1 filter */ 1187c478bd9Sstevel@tonic-gate #define SMFI_V2_PROT 0x0000007FL /* The protocol of V2 filter */ 11949218d4fSjbeck 120058561cbSjbeck /* all defined protocol bits */ 121058561cbSjbeck #define SMFI_CURR_PROT 0x001FFFFFL 1227c478bd9Sstevel@tonic-gate 123*e9af4bc0SJohn Beck /* internal flags: only used between MTA and libmilter */ 124*e9af4bc0SJohn Beck #define SMFI_INTERNAL 0x70000000L 125*e9af4bc0SJohn Beck 126*e9af4bc0SJohn Beck #if _FFR_MILTER_CHECK 127*e9af4bc0SJohn Beck #define SMFIP_TEST 0x80000000L 128*e9af4bc0SJohn Beck #endif /* _FFR_MILTER_CHECK */ 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1317c478bd9Sstevel@tonic-gate } 1327c478bd9Sstevel@tonic-gate #endif 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate #endif /* !_LIBMILTER_MFDEF_H */ 135