nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

milterproto.h (3377B)


      1 /* src/mxfmilter/include/milterproto.h
      2  * Milter protocol definitions.
      3  * This file was created with reference to publicly available documentation
      4  at http://www.pell.portland.or.us/~orc/Code/postoffice/milter-protocol.html .
      5  *
      6  * Copyright 2021 Ellenor Bjornsdottir ellenor@umbrellix.net
      7  * All Rights Reserved.
      8  * Unlike the rest of the MXF distribution,
      9  * Permission to use, redistribute, evaluate, or modify this work is granted
     10  provided the above copyright notice, this permission notice, and the
     11  following warranty notice are retained.
     12  *
     13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     14  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     15  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     16  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
     17  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     18  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     19  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     20  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     21  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     22  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     23  THE POSSIBILITY OF SUCH DAMAGE.
     24  *
     25  * As a special exception, the warranty notice above may be reproduced in
     26  regular sentence case to ease readability.
     27  */
     28 
     29 #ifndef _WITH_MXFMILTER_MILTERPROTO_H
     30 #define _WITH_MXFMILTER_MILTERPROTO_H
     31 
     32 /* Yes, I'm really writing my own Milter protocol library. Why?
     33    None are license compatible with the USL, under which MXF is
     34    released. The final product of this project will be a
     35    "miltersleeve" for mxf-local, mxf-remote and mxf-qmtpc,
     36    written in C and released under the USL, using this library. */
     37 
     38 // From-MTA
     39 
     40 #define MTA_ABORT		'A'
     41 #define MTA_BODYCHUNK	'B'
     42 #define MTA_CLIENT		'C'
     43 #define MTA_SMMACROS	'D' // {CMHR}nameNULvalueNULnameNULvalueNUL
     44 #define MTA_ENDBODY		'E'
     45 #define MTA_HELO		'H'
     46 #define MTA_HEADER		'L' // nameNULvalueNUL
     47 #define MTA_ENDHDR		'N'
     48 #define MTA_MAILFROM	'M' // senderNULesmtparg...NUL
     49 #define MTA_RCPTTO		'R' // recipientNULesmtparg...NUL
     50 #define MTA_OPTNEG		'O' // uint32s: version, actions, protocol
     51 #define MTA_QUIT		'Q'
     52 
     53 // From Filter
     54 
     55 #define FILTER_ADDRCPT	'+' // rcptNUL
     56 #define FILTER_DELRCPT	'-' // rcptNUL
     57 #define FILTER_ACCEPT	'a'
     58 #define FILTER_TACCEPT	'c'
     59 #define FILTER_REPBODY	'b' // body
     60 #define FILTER_DISCARD	'd'
     61 #define FILTER_ADDHDR	'h' // nameNULvalueNUL
     62 #define FILTER_CHGHDR	'm' // unti32 idx, nameNULvalueNUL
     63 #define FILTER_PROGRESS	'p' // still making progress
     64 #define FILTER_40INE	'q' // reasonNUL
     65 #define FILTER_FAILD	'r' // D-type failure
     66 #define FILTER_FAILZ	't' // Z-type failure
     67 #define FILTER_FREPLY	'y' // smtpcode[3] textNUL
     68 #define FILTER_OPTNEG	MTA_OPTNEG
     69 
     70 // Actions
     71 
     72 #define ACTION_	0x01
     73 #define ACTION_	0x02
     74 #define ACTION_	0x04
     75 #define ACTION_	0x08
     76 #define ACTION_	0x10
     77 #define ACTION_	0x20
     78 
     79 // Skips
     80 
     81 #define SKIP_CONNECT	0x01
     82 #define SKIP_HELO		0x02
     83 #define SKIP_MAILFROM	0x04
     84 #define SKIP_RCPTTO		0x08
     85 #define SKIP_BODY		0x10
     86 #define SKIP_HEADER		0x20
     87 #define SKIP_ENDHDR		0x40
     88 
     89 // Structure
     90 
     91 typedef struct {
     92 	uint32_t	length; // subtract 1 for the length of the str pointed to in data
     93 	char		cmd;
     94 	void		*data; // treat as chars in practice
     95 } miltercommand;
     96 
     97 #endif