/* libspawner, an implementation of the MTA side of Sendmail's Milter protocol. Copyright (C) 2005-07 Hilko Bengen This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public License as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include /** Commands that are passed from MTA to mail filter */ #define SMFIC_ABORT 'A' /**< Abort current filter checks */ #define SMFIC_QUIT 'Q' /**< Quit milter communication */ #define SMFIC_MACRO 'D' /**< Define macros */ #define SMFIC_OPTNEG 'O' /**< Option negotiation */ #define SMFIC_CONNECT 'C' /**< SMTP connection information */ #define SMFIC_HELO 'H' /**< HELO/EHLO name */ #define SMFIC_MAIL 'M' /**< MAIL FROM: information */ #define SMFIC_RCPT 'R' /**< RCPT TO: information */ #define SMFIC_HEADER 'L' /**< Mail header */ #define SMFIC_EOH 'N' /**< End of headers marker */ #define SMFIC_BODY 'B' /**< Body chunk */ #define SMFIC_BODYEOB 'E' /**< End of body marker */ /** Address specification for SMFIC_CONNECT */ #define SMFIA_UNKNOWN 'U' /**< Unknown */ #define SMFIA_UNIX 'L' /**< UNIX domain socket */ #define SMFIA_INET '4' /**< IPv4 */ #define SMFIA_INET6 '6' /**< IPv6 */ /** Responses that are sent from mail filter to MTA */ #define SMFIR_ADDRCPT '+' /**< Add recipient */ #define SMFIR_DELRCPT '-' /**< Remove recipient */ #define SMFIR_ACCEPT 'a' /**< Accept message completely */ #define SMFIR_REPLBODY 'b' /**< Replace body */ #define SMFIR_CONTINUE 'c' /**< Accept and keep processing */ #define SMFIR_DISCARD 'd' /**< Set discard flag for entire message */ #define SMFIR_ADDHEADER 'h' /**< Add header */ #define SMFIR_CHGHEADER 'm' /**< Change header */ #define SMFIR_PROGRESS 'p' /**< Progress */ #define SMFIR_QUARANTINE 'q' /**< Quarantine message */ #define SMFIR_REJECT 'r' /**< Reject command/recipient with a 5xx */ #define SMFIR_TEMPFAIL 't' /**< Reject command/recipient with a 4xx */ #define SMFIR_REPLYCODE 'y' /**< Send specific Nxx reply message */ /** \brief Generic Milter message packet structure. */ typedef struct smfi_msg { /** size of the packet, not including the size field */ u_int32_t size; char cmd; /**< command byte (SMFIC_*) */ char data[0]; /**< generic payload */ } __attribute__((__packed__)) smfi_msg; #define OPTNEG_VERSION(i) *(u_int32_t*)(i->data) #define OPTNEG_ACTIONS(i) *(u_int32_t*)(i->data+4) #define OPTNEG_FLAGS(i) *(u_int32_t*)(i->data+8) /* Low level functions */ int read_msg(int s, smfi_msg** msg, time_t t); int write_msg(int s, smfi_msg* msg, time_t t); /* Local Variables: c-file-style: "bsd" c-basic-offset: 8 indent-tabs-mode: nil End: */