106f25ae9SGregory Neil Shapiro /* 206f25ae9SGregory Neil Shapiro * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers. 306f25ae9SGregory Neil Shapiro * All rights reserved. 406f25ae9SGregory Neil Shapiro * 506f25ae9SGregory Neil Shapiro * By using this file, you agree to the terms and conditions set 606f25ae9SGregory Neil Shapiro * forth in the LICENSE file which can be found at the top level of 706f25ae9SGregory Neil Shapiro * the sendmail distribution. 806f25ae9SGregory Neil Shapiro * 906f25ae9SGregory Neil Shapiro * 1006f25ae9SGregory Neil Shapiro * $Id: mfapi.h,v 8.13.4.11 2000/07/11 21:45:56 geir Exp $ 1106f25ae9SGregory Neil Shapiro */ 1206f25ae9SGregory Neil Shapiro 1306f25ae9SGregory Neil Shapiro /* 1406f25ae9SGregory Neil Shapiro ** MFAPI.H -- Global definitions for mail filter library and mail filters. 1506f25ae9SGregory Neil Shapiro */ 1606f25ae9SGregory Neil Shapiro 1706f25ae9SGregory Neil Shapiro #ifndef _LIBMILTER_MFAPI_H 1806f25ae9SGregory Neil Shapiro # define _LIBMILTER_MFAPI_H 1 1906f25ae9SGregory Neil Shapiro 2006f25ae9SGregory Neil Shapiro # define LIBMILTER_API extern 2106f25ae9SGregory Neil Shapiro 2206f25ae9SGregory Neil Shapiro 2306f25ae9SGregory Neil Shapiro # include <sys/types.h> 2406f25ae9SGregory Neil Shapiro 2506f25ae9SGregory Neil Shapiro #ifndef _SOCK_ADDR 2606f25ae9SGregory Neil Shapiro # include <sys/socket.h> 2706f25ae9SGregory Neil Shapiro # define _SOCK_ADDR struct sockaddr 2806f25ae9SGregory Neil Shapiro #endif /* ! _SOCK_ADDR */ 2906f25ae9SGregory Neil Shapiro 3006f25ae9SGregory Neil Shapiro /* 3106f25ae9SGregory Neil Shapiro ** libmilter functions return one of the following to indicate 3206f25ae9SGregory Neil Shapiro ** success/failure: 3306f25ae9SGregory Neil Shapiro */ 3406f25ae9SGregory Neil Shapiro 3506f25ae9SGregory Neil Shapiro #define MI_SUCCESS 0 3606f25ae9SGregory Neil Shapiro #define MI_FAILURE (-1) 3706f25ae9SGregory Neil Shapiro 3806f25ae9SGregory Neil Shapiro /* "forward" declarations */ 3906f25ae9SGregory Neil Shapiro typedef struct smfi_str SMFICTX; 4006f25ae9SGregory Neil Shapiro typedef struct smfi_str *SMFICTX_PTR; 4106f25ae9SGregory Neil Shapiro 4206f25ae9SGregory Neil Shapiro typedef struct smfiDesc smfiDesc_str; 4306f25ae9SGregory Neil Shapiro typedef struct smfiDesc *smfiDesc_ptr; 4406f25ae9SGregory Neil Shapiro 4506f25ae9SGregory Neil Shapiro #define SMFI_VERSION 2 /* version number */ 4606f25ae9SGregory Neil Shapiro 4706f25ae9SGregory Neil Shapiro /* 4806f25ae9SGregory Neil Shapiro ** What the filter might do -- values to be ORed together for 4906f25ae9SGregory Neil Shapiro ** smfiDesc.xxfi_flags. 5006f25ae9SGregory Neil Shapiro */ 5106f25ae9SGregory Neil Shapiro 5206f25ae9SGregory Neil Shapiro #define SMFIF_ADDHDRS 0x00000001L /* filter may add headers */ 5306f25ae9SGregory Neil Shapiro #define SMFIF_CHGBODY 0x00000002L /* filter may replace body */ 5406f25ae9SGregory Neil Shapiro #define SMFIF_MODBODY SMFIF_CHGBODY /* backwards compatible */ 5506f25ae9SGregory Neil Shapiro #define SMFIF_ADDRCPT 0x00000004L /* filter may add recipients */ 5606f25ae9SGregory Neil Shapiro #define SMFIF_DELRCPT 0x00000008L /* filter may delete recipients */ 5706f25ae9SGregory Neil Shapiro #define SMFIF_CHGHDRS 0x00000010L /* filter may change/delete headers */ 5806f25ae9SGregory Neil Shapiro 5906f25ae9SGregory Neil Shapiro #define SMFI_V1_ACTS 0x0000000FL /* The actions of V1 filter */ 6006f25ae9SGregory Neil Shapiro #define SMFI_V2_ACTS 0x0000001FL /* The actions of V2 filter */ 6106f25ae9SGregory Neil Shapiro #define SMFI_CURR_ACTS SMFI_V2_ACTS /* The current version */ 6206f25ae9SGregory Neil Shapiro 6306f25ae9SGregory Neil Shapiro /* 6406f25ae9SGregory Neil Shapiro ** Type which callbacks should return to indicate message status. 6506f25ae9SGregory Neil Shapiro ** This may take on one of the SMFIS_* values listed below. 6606f25ae9SGregory Neil Shapiro */ 6706f25ae9SGregory Neil Shapiro 6806f25ae9SGregory Neil Shapiro typedef int sfsistat; 6906f25ae9SGregory Neil Shapiro 7006f25ae9SGregory Neil Shapiro /* 7106f25ae9SGregory Neil Shapiro ** structure describing one milter 7206f25ae9SGregory Neil Shapiro */ 7306f25ae9SGregory Neil Shapiro 7406f25ae9SGregory Neil Shapiro #if defined(__linux__) && defined(__GNUC__) && defined(__cplusplus) && __GNUC_MINOR__ >= 8 7506f25ae9SGregory Neil Shapiro # define SM__P(X) __PMT(X) 7606f25ae9SGregory Neil Shapiro #else /* __linux__ && __GNUC__ && __cplusplus && _GNUC_MINOR__ >= 8 */ 7706f25ae9SGregory Neil Shapiro # define SM__P(X) __P(X) 7806f25ae9SGregory Neil Shapiro #endif /* __linux__ && __GNUC__ && __cplusplus && _GNUC_MINOR__ >= 8 */ 7906f25ae9SGregory Neil Shapiro 8006f25ae9SGregory Neil Shapiro /* Some platforms don't define __P -- do it for them here: */ 8106f25ae9SGregory Neil Shapiro #ifndef __P 8206f25ae9SGregory Neil Shapiro # ifdef __STDC__ 8306f25ae9SGregory Neil Shapiro # define __P(X) X 8406f25ae9SGregory Neil Shapiro # else /* __STDC__ */ 8506f25ae9SGregory Neil Shapiro # define __P(X) () 8606f25ae9SGregory Neil Shapiro # endif /* __STDC__ */ 8706f25ae9SGregory Neil Shapiro #endif /* __P */ 8806f25ae9SGregory Neil Shapiro 8906f25ae9SGregory Neil Shapiro struct smfiDesc 9006f25ae9SGregory Neil Shapiro { 9106f25ae9SGregory Neil Shapiro char *xxfi_name; /* filter name */ 9206f25ae9SGregory Neil Shapiro int xxfi_version; /* version code -- do not change */ 9306f25ae9SGregory Neil Shapiro u_long xxfi_flags; /* flags */ 9406f25ae9SGregory Neil Shapiro 9506f25ae9SGregory Neil Shapiro /* connection info filter */ 9606f25ae9SGregory Neil Shapiro sfsistat (*xxfi_connect) SM__P((SMFICTX *, char *, _SOCK_ADDR *)); 9706f25ae9SGregory Neil Shapiro 9806f25ae9SGregory Neil Shapiro /* SMTP HELO command filter */ 9906f25ae9SGregory Neil Shapiro sfsistat (*xxfi_helo) SM__P((SMFICTX *, char *)); 10006f25ae9SGregory Neil Shapiro 10106f25ae9SGregory Neil Shapiro /* envelope sender filter */ 10206f25ae9SGregory Neil Shapiro sfsistat (*xxfi_envfrom) SM__P((SMFICTX *, char **)); 10306f25ae9SGregory Neil Shapiro 10406f25ae9SGregory Neil Shapiro /* envelope recipient filter */ 10506f25ae9SGregory Neil Shapiro sfsistat (*xxfi_envrcpt) SM__P((SMFICTX *, char **)); 10606f25ae9SGregory Neil Shapiro 10706f25ae9SGregory Neil Shapiro /* header filter */ 10806f25ae9SGregory Neil Shapiro sfsistat (*xxfi_header) SM__P((SMFICTX *, char *, char *)); 10906f25ae9SGregory Neil Shapiro 11006f25ae9SGregory Neil Shapiro /* end of header */ 11106f25ae9SGregory Neil Shapiro sfsistat (*xxfi_eoh) SM__P((SMFICTX *)); 11206f25ae9SGregory Neil Shapiro 11306f25ae9SGregory Neil Shapiro /* body block */ 11406f25ae9SGregory Neil Shapiro sfsistat (*xxfi_body) SM__P((SMFICTX *, u_char *, size_t)); 11506f25ae9SGregory Neil Shapiro 11606f25ae9SGregory Neil Shapiro /* end of message */ 11706f25ae9SGregory Neil Shapiro sfsistat (*xxfi_eom) SM__P((SMFICTX *)); 11806f25ae9SGregory Neil Shapiro 11906f25ae9SGregory Neil Shapiro /* message aborted */ 12006f25ae9SGregory Neil Shapiro sfsistat (*xxfi_abort) SM__P((SMFICTX *)); 12106f25ae9SGregory Neil Shapiro 12206f25ae9SGregory Neil Shapiro /* connection cleanup */ 12306f25ae9SGregory Neil Shapiro sfsistat (*xxfi_close) SM__P((SMFICTX *)); 12406f25ae9SGregory Neil Shapiro }; 12506f25ae9SGregory Neil Shapiro 12606f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_register __P((struct smfiDesc)); 12706f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_main __P((void)); 12806f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_setdbg __P((int)); 12906f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_settimeout __P((int)); 13006f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_setconn __P((char *)); 13106f25ae9SGregory Neil Shapiro 13206f25ae9SGregory Neil Shapiro /* 13306f25ae9SGregory Neil Shapiro ** Continue processing message/connection. 13406f25ae9SGregory Neil Shapiro */ 13506f25ae9SGregory Neil Shapiro 13606f25ae9SGregory Neil Shapiro #define SMFIS_CONTINUE 0 13706f25ae9SGregory Neil Shapiro 13806f25ae9SGregory Neil Shapiro /* 13906f25ae9SGregory Neil Shapiro ** Reject the message/connection. 14006f25ae9SGregory Neil Shapiro ** No further routines will be called for this message 14106f25ae9SGregory Neil Shapiro ** (or connection, if returned from a connection-oriented routine). 14206f25ae9SGregory Neil Shapiro */ 14306f25ae9SGregory Neil Shapiro 14406f25ae9SGregory Neil Shapiro #define SMFIS_REJECT 1 14506f25ae9SGregory Neil Shapiro 14606f25ae9SGregory Neil Shapiro /* 14706f25ae9SGregory Neil Shapiro ** Accept the message, 14806f25ae9SGregory Neil Shapiro ** but silently discard the message. 14906f25ae9SGregory Neil Shapiro ** No further routines will be called for this message. 15006f25ae9SGregory Neil Shapiro ** This is only meaningful from message-oriented routines. 15106f25ae9SGregory Neil Shapiro */ 15206f25ae9SGregory Neil Shapiro 15306f25ae9SGregory Neil Shapiro #define SMFIS_DISCARD 2 15406f25ae9SGregory Neil Shapiro 15506f25ae9SGregory Neil Shapiro /* 15606f25ae9SGregory Neil Shapiro ** Accept the message/connection. 15706f25ae9SGregory Neil Shapiro ** No further routines will be called for this message 15806f25ae9SGregory Neil Shapiro ** (or connection, if returned from a connection-oriented routine; 15906f25ae9SGregory Neil Shapiro ** in this case, it causes all messages on this connection 16006f25ae9SGregory Neil Shapiro ** to be accepted without filtering). 16106f25ae9SGregory Neil Shapiro */ 16206f25ae9SGregory Neil Shapiro 16306f25ae9SGregory Neil Shapiro #define SMFIS_ACCEPT 3 16406f25ae9SGregory Neil Shapiro 16506f25ae9SGregory Neil Shapiro /* 16606f25ae9SGregory Neil Shapiro ** Return a temporary failure, i.e., 16706f25ae9SGregory Neil Shapiro ** the corresponding SMTP command will return a 4xx status code. 16806f25ae9SGregory Neil Shapiro ** In some cases this may prevent further routines from 16906f25ae9SGregory Neil Shapiro ** being called on this message or connection, 17006f25ae9SGregory Neil Shapiro ** although in other cases (e.g., when processing an envelope 17106f25ae9SGregory Neil Shapiro ** recipient) processing of the message will continue. 17206f25ae9SGregory Neil Shapiro */ 17306f25ae9SGregory Neil Shapiro 17406f25ae9SGregory Neil Shapiro #define SMFIS_TEMPFAIL 4 17506f25ae9SGregory Neil Shapiro 17606f25ae9SGregory Neil Shapiro #if 0 17706f25ae9SGregory Neil Shapiro /* 17806f25ae9SGregory Neil Shapiro ** Filter Routine Details 17906f25ae9SGregory Neil Shapiro */ 18006f25ae9SGregory Neil Shapiro 18106f25ae9SGregory Neil Shapiro /* connection info filter */ 18206f25ae9SGregory Neil Shapiro extern sfsistat xxfi_connect __P((SMFICTX *, char *, _SOCK_ADDR *)); 18306f25ae9SGregory Neil Shapiro 18406f25ae9SGregory Neil Shapiro /* 18506f25ae9SGregory Neil Shapiro ** xxfi_connect(ctx, hostname, hostaddr) Invoked on each connection 18606f25ae9SGregory Neil Shapiro ** 18706f25ae9SGregory Neil Shapiro ** char *hostname; Host domain name, as determined by a reverse lookup 18806f25ae9SGregory Neil Shapiro ** on the host address. 18906f25ae9SGregory Neil Shapiro ** _SOCK_ADDR *hostaddr; Host address, as determined by a getpeername 19006f25ae9SGregory Neil Shapiro ** call on the SMTP socket. 19106f25ae9SGregory Neil Shapiro */ 19206f25ae9SGregory Neil Shapiro 19306f25ae9SGregory Neil Shapiro /* SMTP HELO command filter */ 19406f25ae9SGregory Neil Shapiro extern sfsistat xxfi_helo __P((SMFICTX *, char *)); 19506f25ae9SGregory Neil Shapiro 19606f25ae9SGregory Neil Shapiro /* 19706f25ae9SGregory Neil Shapiro ** xxfi_helo(ctx, helohost) Invoked on SMTP HELO/EHLO command 19806f25ae9SGregory Neil Shapiro ** 19906f25ae9SGregory Neil Shapiro ** char *helohost; Value passed to HELO/EHLO command, which should be 20006f25ae9SGregory Neil Shapiro ** the domain name of the sending host (but is, in practice, 20106f25ae9SGregory Neil Shapiro ** anything the sending host wants to send). 20206f25ae9SGregory Neil Shapiro */ 20306f25ae9SGregory Neil Shapiro 20406f25ae9SGregory Neil Shapiro /* envelope sender filter */ 20506f25ae9SGregory Neil Shapiro extern sfsistat xxfi_envfrom __P((SMFICTX *, char **)); 20606f25ae9SGregory Neil Shapiro 20706f25ae9SGregory Neil Shapiro /* 20806f25ae9SGregory Neil Shapiro ** xxfi_envfrom(ctx, argv) Invoked on envelope from 20906f25ae9SGregory Neil Shapiro ** 21006f25ae9SGregory Neil Shapiro ** char **argv; Null-terminated SMTP command arguments; 21106f25ae9SGregory Neil Shapiro ** argv[0] is guaranteed to be the sender address. 21206f25ae9SGregory Neil Shapiro ** Later arguments are the ESMTP arguments. 21306f25ae9SGregory Neil Shapiro */ 21406f25ae9SGregory Neil Shapiro 21506f25ae9SGregory Neil Shapiro /* envelope recipient filter */ 21606f25ae9SGregory Neil Shapiro extern sfsistat xxfi_envrcpt __P((SMFICTX *, char **)); 21706f25ae9SGregory Neil Shapiro 21806f25ae9SGregory Neil Shapiro /* 21906f25ae9SGregory Neil Shapiro ** xxfi_envrcpt(ctx, argv) Invoked on each envelope recipient 22006f25ae9SGregory Neil Shapiro ** 22106f25ae9SGregory Neil Shapiro ** char **argv; Null-terminated SMTP command arguments; 22206f25ae9SGregory Neil Shapiro ** argv[0] is guaranteed to be the recipient address. 22306f25ae9SGregory Neil Shapiro ** Later arguments are the ESMTP arguments. 22406f25ae9SGregory Neil Shapiro */ 22506f25ae9SGregory Neil Shapiro 22606f25ae9SGregory Neil Shapiro /* header filter */ 22706f25ae9SGregory Neil Shapiro extern sfsistat xxfi_header __P((SMFICTX *, char *, char *)); 22806f25ae9SGregory Neil Shapiro 22906f25ae9SGregory Neil Shapiro /* 23006f25ae9SGregory Neil Shapiro ** xxfi_header(ctx, headerf, headerv) Invoked on each message header. The 23106f25ae9SGregory Neil Shapiro ** content of the header may have folded white space (that is, multiple 23206f25ae9SGregory Neil Shapiro ** lines with following white space) included. 23306f25ae9SGregory Neil Shapiro ** 23406f25ae9SGregory Neil Shapiro ** char *headerf; Header field name 23506f25ae9SGregory Neil Shapiro ** char *headerv; Header field value 23606f25ae9SGregory Neil Shapiro */ 23706f25ae9SGregory Neil Shapiro 23806f25ae9SGregory Neil Shapiro /* end of header */ 23906f25ae9SGregory Neil Shapiro extern sfsistat xxfi_eoh __P((SMFICTX *)); 24006f25ae9SGregory Neil Shapiro 24106f25ae9SGregory Neil Shapiro /* 24206f25ae9SGregory Neil Shapiro ** xxfi_eoh(ctx) Invoked at end of header 24306f25ae9SGregory Neil Shapiro */ 24406f25ae9SGregory Neil Shapiro 24506f25ae9SGregory Neil Shapiro /* body block */ 24606f25ae9SGregory Neil Shapiro extern sfsistat xxfi_body __P((SMFICTX *, u_char *, size_t)); 24706f25ae9SGregory Neil Shapiro 24806f25ae9SGregory Neil Shapiro /* 24906f25ae9SGregory Neil Shapiro ** xxfi_body(ctx, bodyp, bodylen) Invoked for each body chunk. There may 25006f25ae9SGregory Neil Shapiro ** be multiple body chunks passed to the filter. End-of-lines are 25106f25ae9SGregory Neil Shapiro ** represented as received from SMTP (normally Carriage-Return/Line-Feed). 25206f25ae9SGregory Neil Shapiro ** 25306f25ae9SGregory Neil Shapiro ** u_char *bodyp; Pointer to body data 25406f25ae9SGregory Neil Shapiro ** size_t bodylen; Length of body data 25506f25ae9SGregory Neil Shapiro */ 25606f25ae9SGregory Neil Shapiro 25706f25ae9SGregory Neil Shapiro /* end of message */ 25806f25ae9SGregory Neil Shapiro extern sfsistat xxfi_eom __P((SMFICTX *)); 25906f25ae9SGregory Neil Shapiro 26006f25ae9SGregory Neil Shapiro /* 26106f25ae9SGregory Neil Shapiro ** xxfi_eom(ctx) Invoked at end of message. This routine can perform 26206f25ae9SGregory Neil Shapiro ** special operations such as modifying the message header, body, or 26306f25ae9SGregory Neil Shapiro ** envelope. 26406f25ae9SGregory Neil Shapiro */ 26506f25ae9SGregory Neil Shapiro 26606f25ae9SGregory Neil Shapiro /* message aborted */ 26706f25ae9SGregory Neil Shapiro extern sfsistat xxfi_abort __P((SMFICTX *)); 26806f25ae9SGregory Neil Shapiro 26906f25ae9SGregory Neil Shapiro /* 27006f25ae9SGregory Neil Shapiro ** xxfi_abort(ctx) Invoked if message is aborted outside of the control of 27106f25ae9SGregory Neil Shapiro ** the filter, for example, if the SMTP sender issues an RSET command. If 27206f25ae9SGregory Neil Shapiro ** xxfi_abort is called, xxfi_eom will not be called and vice versa. 27306f25ae9SGregory Neil Shapiro */ 27406f25ae9SGregory Neil Shapiro 27506f25ae9SGregory Neil Shapiro /* connection cleanup */ 27606f25ae9SGregory Neil Shapiro extern sfsistat xxfi_close __P((SMFICTX *)); 27706f25ae9SGregory Neil Shapiro 27806f25ae9SGregory Neil Shapiro /* 27906f25ae9SGregory Neil Shapiro ** xxfi_close(ctx) Invoked at end of the connection. This is called on 28006f25ae9SGregory Neil Shapiro ** close even if the previous mail transaction was aborted. 28106f25ae9SGregory Neil Shapiro */ 28206f25ae9SGregory Neil Shapiro #endif /* 0 */ 28306f25ae9SGregory Neil Shapiro 28406f25ae9SGregory Neil Shapiro /* 28506f25ae9SGregory Neil Shapiro ** Additional information is passed in to the vendor filter routines using 28606f25ae9SGregory Neil Shapiro ** symbols. Symbols correspond closely to sendmail macros. The symbols 28706f25ae9SGregory Neil Shapiro ** defined depend on the context. The value of a symbol is accessed using: 28806f25ae9SGregory Neil Shapiro */ 28906f25ae9SGregory Neil Shapiro 29006f25ae9SGregory Neil Shapiro /* Return the value of a symbol. */ 29106f25ae9SGregory Neil Shapiro LIBMILTER_API char * smfi_getsymval __P((SMFICTX *, char *)); 29206f25ae9SGregory Neil Shapiro 29306f25ae9SGregory Neil Shapiro /* 29406f25ae9SGregory Neil Shapiro ** Return the value of a symbol. 29506f25ae9SGregory Neil Shapiro ** 29606f25ae9SGregory Neil Shapiro ** SMFICTX *ctx; Opaque context structure 29706f25ae9SGregory Neil Shapiro ** char *symname; The name of the symbol to access. 29806f25ae9SGregory Neil Shapiro */ 29906f25ae9SGregory Neil Shapiro 30006f25ae9SGregory Neil Shapiro /* 30106f25ae9SGregory Neil Shapiro ** Vendor filter routines that want to pass additional information back to 30206f25ae9SGregory Neil Shapiro ** the MTA for use in SMTP replies may call smfi_setreply before returning. 30306f25ae9SGregory Neil Shapiro */ 30406f25ae9SGregory Neil Shapiro 30506f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_setreply __P((SMFICTX *, char *, char *, char *)); 30606f25ae9SGregory Neil Shapiro 30706f25ae9SGregory Neil Shapiro /* 30806f25ae9SGregory Neil Shapiro ** Set the specific reply code to be used in response to the active 30906f25ae9SGregory Neil Shapiro ** command. If not specified, a generic reply code is used. 31006f25ae9SGregory Neil Shapiro ** 31106f25ae9SGregory Neil Shapiro ** SMFICTX *ctx; Opaque context structure 31206f25ae9SGregory Neil Shapiro ** char *rcode; The three-digit (RFC 821) SMTP reply code to be 31306f25ae9SGregory Neil Shapiro ** returned, e.g., ``551''. 31406f25ae9SGregory Neil Shapiro ** char *xcode; The extended (RFC 2034) reply code, e.g., ``5.7.6''. 31506f25ae9SGregory Neil Shapiro ** char *message; The text part of the SMTP reply. 31606f25ae9SGregory Neil Shapiro */ 31706f25ae9SGregory Neil Shapiro 31806f25ae9SGregory Neil Shapiro /* 31906f25ae9SGregory Neil Shapiro ** The xxfi_eom routine is called at the end of a message (essentially, 32006f25ae9SGregory Neil Shapiro ** after the final DATA dot). This routine can call some special routines 32106f25ae9SGregory Neil Shapiro ** to modify the envelope, header, or body of the message before the 32206f25ae9SGregory Neil Shapiro ** message is enqueued. These routines must not be called from any vendor 32306f25ae9SGregory Neil Shapiro ** routine other than xxfi_eom. 32406f25ae9SGregory Neil Shapiro */ 32506f25ae9SGregory Neil Shapiro 32606f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_addheader __P((SMFICTX *, char *, char *)); 32706f25ae9SGregory Neil Shapiro 32806f25ae9SGregory Neil Shapiro /* 32906f25ae9SGregory Neil Shapiro ** Add a header to the message. This header is not passed to other 33006f25ae9SGregory Neil Shapiro ** filters. It is not checked for standards compliance; the mail filter 33106f25ae9SGregory Neil Shapiro ** must ensure that no protocols are violated as a result of adding this 33206f25ae9SGregory Neil Shapiro ** header. 33306f25ae9SGregory Neil Shapiro ** 33406f25ae9SGregory Neil Shapiro ** SMFICTX *ctx; Opaque context structure 33506f25ae9SGregory Neil Shapiro ** char *headerf; Header field name 33606f25ae9SGregory Neil Shapiro ** char *headerv; Header field value 33706f25ae9SGregory Neil Shapiro */ 33806f25ae9SGregory Neil Shapiro 33906f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_chgheader __P((SMFICTX *, char *, int, char *)); 34006f25ae9SGregory Neil Shapiro 34106f25ae9SGregory Neil Shapiro /* 34206f25ae9SGregory Neil Shapiro ** Change/delete a header in the message. It is not checked for standards 34306f25ae9SGregory Neil Shapiro ** compliance; the mail filter must ensure that no protocols are violated 34406f25ae9SGregory Neil Shapiro ** as a result of adding this header. 34506f25ae9SGregory Neil Shapiro ** 34606f25ae9SGregory Neil Shapiro ** SMFICTX *ctx; Opaque context structure 34706f25ae9SGregory Neil Shapiro ** char *headerf; Header field name 34806f25ae9SGregory Neil Shapiro ** int index; The Nth occurence of header field name 34906f25ae9SGregory Neil Shapiro ** char *headerv; New header field value (empty for delete header) 35006f25ae9SGregory Neil Shapiro */ 35106f25ae9SGregory Neil Shapiro 35206f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_addrcpt __P((SMFICTX *, char *)); 35306f25ae9SGregory Neil Shapiro 35406f25ae9SGregory Neil Shapiro /* 35506f25ae9SGregory Neil Shapiro ** Add a recipient to the envelope 35606f25ae9SGregory Neil Shapiro ** 35706f25ae9SGregory Neil Shapiro ** SMFICTX *ctx; Opaque context structure 35806f25ae9SGregory Neil Shapiro ** char *rcpt; Recipient to be added 35906f25ae9SGregory Neil Shapiro */ 36006f25ae9SGregory Neil Shapiro 36106f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_delrcpt __P((SMFICTX *, char *)); 36206f25ae9SGregory Neil Shapiro 36306f25ae9SGregory Neil Shapiro /* 36406f25ae9SGregory Neil Shapiro ** Delete a recipient from the envelope 36506f25ae9SGregory Neil Shapiro ** 36606f25ae9SGregory Neil Shapiro ** SMFICTX *ctx; Opaque context structure 36706f25ae9SGregory Neil Shapiro ** char *rcpt; Envelope recipient to be deleted. This should be in 36806f25ae9SGregory Neil Shapiro ** exactly the form passed to xxfi_envrcpt or the address may 36906f25ae9SGregory Neil Shapiro ** not be deleted. 37006f25ae9SGregory Neil Shapiro */ 37106f25ae9SGregory Neil Shapiro 37206f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_replacebody __P((SMFICTX *, u_char *, int)); 37306f25ae9SGregory Neil Shapiro 37406f25ae9SGregory Neil Shapiro /* 37506f25ae9SGregory Neil Shapiro ** Replace the body of the message. This routine may be called multiple 37606f25ae9SGregory Neil Shapiro ** times if the body is longer than convenient to send in one call. End of 37706f25ae9SGregory Neil Shapiro ** line should be represented as Carriage-Return/Line Feed. 37806f25ae9SGregory Neil Shapiro ** 37906f25ae9SGregory Neil Shapiro ** char *bodyp; Pointer to block of body information to insert 38006f25ae9SGregory Neil Shapiro ** int bodylen; Length of data pointed at by bodyp 38106f25ae9SGregory Neil Shapiro */ 38206f25ae9SGregory Neil Shapiro 38306f25ae9SGregory Neil Shapiro /* 38406f25ae9SGregory Neil Shapiro ** If the message is aborted (for example, if the SMTP sender sends the 38506f25ae9SGregory Neil Shapiro ** envelope but then does a QUIT or RSET before the data is sent), 38606f25ae9SGregory Neil Shapiro ** xxfi_abort is called. This can be used to reset state. 38706f25ae9SGregory Neil Shapiro */ 38806f25ae9SGregory Neil Shapiro 38906f25ae9SGregory Neil Shapiro 39006f25ae9SGregory Neil Shapiro /* 39106f25ae9SGregory Neil Shapiro ** Connection-private data (specific to an SMTP connection) can be 39206f25ae9SGregory Neil Shapiro ** allocated using the smfi_setpriv routine; routines can access private 39306f25ae9SGregory Neil Shapiro ** data using smfi_getpriv. 39406f25ae9SGregory Neil Shapiro */ 39506f25ae9SGregory Neil Shapiro 39606f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_setpriv __P((SMFICTX *, void *)); 39706f25ae9SGregory Neil Shapiro 39806f25ae9SGregory Neil Shapiro /* 39906f25ae9SGregory Neil Shapiro ** Set the private data pointer 40006f25ae9SGregory Neil Shapiro ** 40106f25ae9SGregory Neil Shapiro ** SMFICTX *ctx; Opaque context structure 40206f25ae9SGregory Neil Shapiro ** void *privatedata; Pointer to private data area 40306f25ae9SGregory Neil Shapiro */ 40406f25ae9SGregory Neil Shapiro 40506f25ae9SGregory Neil Shapiro LIBMILTER_API void *smfi_getpriv __P((SMFICTX *)); 40606f25ae9SGregory Neil Shapiro 40706f25ae9SGregory Neil Shapiro 40806f25ae9SGregory Neil Shapiro #endif /* !_LIBMILTER_MFAPI_H */ 409