mfapi.h revision 168515
164562Sgshapiro/* 2168515Sgshapiro * Copyright (c) 1999-2004, 2006 Sendmail, Inc. and its suppliers. 364562Sgshapiro * All rights reserved. 464562Sgshapiro * 564562Sgshapiro * By using this file, you agree to the terms and conditions set 664562Sgshapiro * forth in the LICENSE file which can be found at the top level of 764562Sgshapiro * the sendmail distribution. 864562Sgshapiro * 964562Sgshapiro * 10168515Sgshapiro * $Id: mfapi.h,v 8.77 2006/11/02 02:44:07 ca Exp $ 1164562Sgshapiro */ 1264562Sgshapiro 1364562Sgshapiro/* 1464562Sgshapiro** MFAPI.H -- Global definitions for mail filter library and mail filters. 1564562Sgshapiro*/ 1664562Sgshapiro 1764562Sgshapiro#ifndef _LIBMILTER_MFAPI_H 1864562Sgshapiro# define _LIBMILTER_MFAPI_H 1 1964562Sgshapiro 20132943Sgshapiro#ifndef SMFI_VERSION 21168515Sgshapiro# define SMFI_VERSION 0x01000000 /* libmilter version number */ 22132943Sgshapiro#endif /* ! SMFI_VERSION */ 23132943Sgshapiro 24168515Sgshapiro#define SM_LM_VRS_MAJOR(v) (((v) & 0x7f000000) >> 24) 25168515Sgshapiro#define SM_LM_VRS_MINOR(v) (((v) & 0x007fff00) >> 8) 26168515Sgshapiro#define SM_LM_VRS_PLVL(v) ((v) & 0x0000007f) 27168515Sgshapiro 2894334Sgshapiro# include <sys/types.h> 2990792Sgshapiro# include <sys/socket.h> 3090792Sgshapiro 31132943Sgshapiro#include "libmilter/mfdef.h" 32132943Sgshapiro 3364562Sgshapiro# define LIBMILTER_API extern 3464562Sgshapiro 3564562Sgshapiro 36132943Sgshapiro/* Only need to export C interface if used by C++ source code */ 37132943Sgshapiro#ifdef __cplusplus 38132943Sgshapiroextern "C" { 39132943Sgshapiro#endif /* __cplusplus */ 40132943Sgshapiro 4164562Sgshapiro#ifndef _SOCK_ADDR 4264562Sgshapiro# define _SOCK_ADDR struct sockaddr 4364562Sgshapiro#endif /* ! _SOCK_ADDR */ 4464562Sgshapiro 4564562Sgshapiro/* 4664562Sgshapiro** libmilter functions return one of the following to indicate 47168515Sgshapiro** success/failure(/continue): 4864562Sgshapiro*/ 4964562Sgshapiro 5064562Sgshapiro#define MI_SUCCESS 0 5164562Sgshapiro#define MI_FAILURE (-1) 52168515Sgshapiro#if _FFR_WORKERS_POOL 53168515Sgshapiro# define MI_CONTINUE 1 54168515Sgshapiro#endif /* _FFR_WORKERS_POOL */ 5564562Sgshapiro 5664562Sgshapiro/* "forward" declarations */ 5764562Sgshapirotypedef struct smfi_str SMFICTX; 5864562Sgshapirotypedef struct smfi_str *SMFICTX_PTR; 5964562Sgshapiro 6064562Sgshapirotypedef struct smfiDesc smfiDesc_str; 6164562Sgshapirotypedef struct smfiDesc *smfiDesc_ptr; 6264562Sgshapiro 6364562Sgshapiro/* 6464562Sgshapiro** Type which callbacks should return to indicate message status. 6564562Sgshapiro** This may take on one of the SMFIS_* values listed below. 6664562Sgshapiro*/ 6764562Sgshapiro 6864562Sgshapirotypedef int sfsistat; 6964562Sgshapiro 7064562Sgshapiro#if defined(__linux__) && defined(__GNUC__) && defined(__cplusplus) && __GNUC_MINOR__ >= 8 7164562Sgshapiro# define SM__P(X) __PMT(X) 7264562Sgshapiro#else /* __linux__ && __GNUC__ && __cplusplus && _GNUC_MINOR__ >= 8 */ 7364562Sgshapiro# define SM__P(X) __P(X) 7464562Sgshapiro#endif /* __linux__ && __GNUC__ && __cplusplus && _GNUC_MINOR__ >= 8 */ 7564562Sgshapiro 7664562Sgshapiro/* Some platforms don't define __P -- do it for them here: */ 7764562Sgshapiro#ifndef __P 7864562Sgshapiro# ifdef __STDC__ 7964562Sgshapiro# define __P(X) X 8064562Sgshapiro# else /* __STDC__ */ 8164562Sgshapiro# define __P(X) () 8264562Sgshapiro# endif /* __STDC__ */ 8364562Sgshapiro#endif /* __P */ 8464562Sgshapiro 85132943Sgshapiro#if SM_CONF_STDBOOL_H 86132943Sgshapiro# include <stdbool.h> 87132943Sgshapiro#else /* SM_CONF_STDBOOL_H */ 88132943Sgshapiro# ifndef __cplusplus 89132943Sgshapiro# ifndef bool 90132943Sgshapiro# ifndef __bool_true_false_are_defined 91132943Sgshapirotypedef int bool; 92132943Sgshapiro# define __bool_true_false_are_defined 1 93132943Sgshapiro# endif /* ! __bool_true_false_are_defined */ 94132943Sgshapiro# endif /* bool */ 95132943Sgshapiro# endif /* ! __cplusplus */ 96132943Sgshapiro#endif /* SM_CONF_STDBOOL_H */ 97132943Sgshapiro 9890792Sgshapiro/* 9990792Sgshapiro** structure describing one milter 10090792Sgshapiro*/ 10190792Sgshapiro 10264562Sgshapirostruct smfiDesc 10364562Sgshapiro{ 10464562Sgshapiro char *xxfi_name; /* filter name */ 10564562Sgshapiro int xxfi_version; /* version code -- do not change */ 10690792Sgshapiro unsigned long xxfi_flags; /* flags */ 10764562Sgshapiro 10864562Sgshapiro /* connection info filter */ 10964562Sgshapiro sfsistat (*xxfi_connect) SM__P((SMFICTX *, char *, _SOCK_ADDR *)); 11064562Sgshapiro 11164562Sgshapiro /* SMTP HELO command filter */ 11264562Sgshapiro sfsistat (*xxfi_helo) SM__P((SMFICTX *, char *)); 11364562Sgshapiro 11464562Sgshapiro /* envelope sender filter */ 11564562Sgshapiro sfsistat (*xxfi_envfrom) SM__P((SMFICTX *, char **)); 11664562Sgshapiro 11764562Sgshapiro /* envelope recipient filter */ 11864562Sgshapiro sfsistat (*xxfi_envrcpt) SM__P((SMFICTX *, char **)); 11964562Sgshapiro 12064562Sgshapiro /* header filter */ 12164562Sgshapiro sfsistat (*xxfi_header) SM__P((SMFICTX *, char *, char *)); 12264562Sgshapiro 12364562Sgshapiro /* end of header */ 12464562Sgshapiro sfsistat (*xxfi_eoh) SM__P((SMFICTX *)); 12564562Sgshapiro 12664562Sgshapiro /* body block */ 12790792Sgshapiro sfsistat (*xxfi_body) SM__P((SMFICTX *, unsigned char *, size_t)); 12864562Sgshapiro 12964562Sgshapiro /* end of message */ 13064562Sgshapiro sfsistat (*xxfi_eom) SM__P((SMFICTX *)); 13164562Sgshapiro 13264562Sgshapiro /* message aborted */ 13364562Sgshapiro sfsistat (*xxfi_abort) SM__P((SMFICTX *)); 13464562Sgshapiro 13564562Sgshapiro /* connection cleanup */ 13664562Sgshapiro sfsistat (*xxfi_close) SM__P((SMFICTX *)); 137132943Sgshapiro 138132943Sgshapiro /* any unrecognized or unimplemented command filter */ 139168515Sgshapiro sfsistat (*xxfi_unknown) SM__P((SMFICTX *, const char *)); 140132943Sgshapiro 141159609Sgshapiro /* SMTP DATA command filter */ 142132943Sgshapiro sfsistat (*xxfi_data) SM__P((SMFICTX *)); 143168515Sgshapiro 144168515Sgshapiro /* negotiation callback */ 145168515Sgshapiro sfsistat (*xxfi_negotiate) SM__P((SMFICTX *, 146168515Sgshapiro unsigned long, unsigned long, 147168515Sgshapiro unsigned long, unsigned long, 148168515Sgshapiro unsigned long *, unsigned long *, 149168515Sgshapiro unsigned long *, unsigned long *)); 150168515Sgshapiro 151168515Sgshapiro#if 0 152168515Sgshapiro /* signal handler callback, not yet implemented. */ 153168515Sgshapiro int (*xxfi_signal) SM__P((int)); 154168515Sgshapiro#endif 155168515Sgshapiro 15664562Sgshapiro}; 15764562Sgshapiro 158125820SgshapiroLIBMILTER_API int smfi_opensocket __P((bool)); 15964562SgshapiroLIBMILTER_API int smfi_register __P((struct smfiDesc)); 16064562SgshapiroLIBMILTER_API int smfi_main __P((void)); 16194334SgshapiroLIBMILTER_API int smfi_setbacklog __P((int)); 16264562SgshapiroLIBMILTER_API int smfi_setdbg __P((int)); 16364562SgshapiroLIBMILTER_API int smfi_settimeout __P((int)); 16464562SgshapiroLIBMILTER_API int smfi_setconn __P((char *)); 16566494SgshapiroLIBMILTER_API int smfi_stop __P((void)); 166132943Sgshapiro#if _FFR_MAXDATASIZE 167132943SgshapiroLIBMILTER_API size_t smfi_setmaxdatasize __P((size_t)); 168132943Sgshapiro#endif /* _FFR_MAXDATASIZE */ 169168515SgshapiroLIBMILTER_API int smfi_version __P((unsigned int *, unsigned int *, unsigned int *)); 17064562Sgshapiro 17164562Sgshapiro/* 17290792Sgshapiro** What the filter might do -- values to be ORed together for 17390792Sgshapiro** smfiDesc.xxfi_flags. 17490792Sgshapiro*/ 17590792Sgshapiro 17690792Sgshapiro#define SMFIF_NONE 0x00000000L /* no flags */ 17790792Sgshapiro#define SMFIF_ADDHDRS 0x00000001L /* filter may add headers */ 17890792Sgshapiro#define SMFIF_CHGBODY 0x00000002L /* filter may replace body */ 17990792Sgshapiro#define SMFIF_MODBODY SMFIF_CHGBODY /* backwards compatible */ 18090792Sgshapiro#define SMFIF_ADDRCPT 0x00000004L /* filter may add recipients */ 18190792Sgshapiro#define SMFIF_DELRCPT 0x00000008L /* filter may delete recipients */ 18290792Sgshapiro#define SMFIF_CHGHDRS 0x00000010L /* filter may change/delete headers */ 183132943Sgshapiro#define SMFIF_QUARANTINE 0x00000020L /* filter may quarantine envelope */ 18490792Sgshapiro 185168515Sgshapiro/* filter may change "from" (envelope sender) */ 186168515Sgshapiro#define SMFIF_CHGFROM 0x00000040L 187168515Sgshapiro#define SMFIF_ADDRCPT_PAR 0x00000080L /* add recipients incl. args */ 188168515Sgshapiro 189168515Sgshapiro/* filter can send set of symbols (macros) that it wants */ 190168515Sgshapiro#define SMFIF_SETSYMLIST 0x00000100L 191168515Sgshapiro 192168515Sgshapiro 19390792Sgshapiro/* 194168515Sgshapiro** Macro "places"; 195168515Sgshapiro** Notes: 196168515Sgshapiro** - must be coordinated with libmilter/engine.c and sendmail/milter.c 197168515Sgshapiro** - the order MUST NOT be changed as it would break compatibility between 198168515Sgshapiro** different versions. It's ok to append new entries however 199168515Sgshapiro** (hence the list is not sorted by the SMT protocol steps). 200168515Sgshapiro*/ 201168515Sgshapiro 202168515Sgshapiro#define SMFIM_FIRST 0 /* Do NOT use, internal marker only */ 203168515Sgshapiro#define SMFIM_CONNECT 0 /* connect */ 204168515Sgshapiro#define SMFIM_HELO 1 /* HELO/EHLO */ 205168515Sgshapiro#define SMFIM_ENVFROM 2 /* MAIL From */ 206168515Sgshapiro#define SMFIM_ENVRCPT 3 /* RCPT To */ 207168515Sgshapiro#define SMFIM_DATA 4 /* DATA */ 208168515Sgshapiro#define SMFIM_EOM 5 /* end of message (final dot) */ 209168515Sgshapiro#define SMFIM_EOH 6 /* end of header */ 210168515Sgshapiro#define SMFIM_LAST 6 /* Do NOT use, internal marker only */ 211168515Sgshapiro 212168515Sgshapiro/* 21364562Sgshapiro** Continue processing message/connection. 21464562Sgshapiro*/ 21564562Sgshapiro 21664562Sgshapiro#define SMFIS_CONTINUE 0 21764562Sgshapiro 21864562Sgshapiro/* 21964562Sgshapiro** Reject the message/connection. 22064562Sgshapiro** No further routines will be called for this message 22164562Sgshapiro** (or connection, if returned from a connection-oriented routine). 22264562Sgshapiro*/ 22364562Sgshapiro 22464562Sgshapiro#define SMFIS_REJECT 1 22564562Sgshapiro 22664562Sgshapiro/* 22764562Sgshapiro** Accept the message, 22864562Sgshapiro** but silently discard the message. 22964562Sgshapiro** No further routines will be called for this message. 23064562Sgshapiro** This is only meaningful from message-oriented routines. 23164562Sgshapiro*/ 23264562Sgshapiro 23364562Sgshapiro#define SMFIS_DISCARD 2 23464562Sgshapiro 23564562Sgshapiro/* 23664562Sgshapiro** Accept the message/connection. 23764562Sgshapiro** No further routines will be called for this message 23864562Sgshapiro** (or connection, if returned from a connection-oriented routine; 23964562Sgshapiro** in this case, it causes all messages on this connection 24064562Sgshapiro** to be accepted without filtering). 24164562Sgshapiro*/ 24264562Sgshapiro 24364562Sgshapiro#define SMFIS_ACCEPT 3 24464562Sgshapiro 24564562Sgshapiro/* 24664562Sgshapiro** Return a temporary failure, i.e., 24764562Sgshapiro** the corresponding SMTP command will return a 4xx status code. 24864562Sgshapiro** In some cases this may prevent further routines from 24964562Sgshapiro** being called on this message or connection, 25064562Sgshapiro** although in other cases (e.g., when processing an envelope 25164562Sgshapiro** recipient) processing of the message will continue. 25264562Sgshapiro*/ 25364562Sgshapiro 25464562Sgshapiro#define SMFIS_TEMPFAIL 4 25564562Sgshapiro 256168515Sgshapiro/* 257168515Sgshapiro** Do not send a reply to the MTA 258168515Sgshapiro*/ 259168515Sgshapiro 260168515Sgshapiro#define SMFIS_NOREPLY 7 261168515Sgshapiro 262168515Sgshapiro/* 263168515Sgshapiro** Skip over rest of same callbacks, e.g., body. 264168515Sgshapiro*/ 265168515Sgshapiro 266168515Sgshapiro#define SMFIS_SKIP 8 267168515Sgshapiro 268168515Sgshapiro/* xxfi_negotiate: use all existing protocol options/actions */ 269168515Sgshapiro#define SMFIS_ALL_OPTS 10 270168515Sgshapiro 27164562Sgshapiro#if 0 27264562Sgshapiro/* 27364562Sgshapiro** Filter Routine Details 27464562Sgshapiro*/ 27564562Sgshapiro 27664562Sgshapiro/* connection info filter */ 27764562Sgshapiroextern sfsistat xxfi_connect __P((SMFICTX *, char *, _SOCK_ADDR *)); 27864562Sgshapiro 27964562Sgshapiro/* 28064562Sgshapiro** xxfi_connect(ctx, hostname, hostaddr) Invoked on each connection 28164562Sgshapiro** 28264562Sgshapiro** char *hostname; Host domain name, as determined by a reverse lookup 28364562Sgshapiro** on the host address. 28464562Sgshapiro** _SOCK_ADDR *hostaddr; Host address, as determined by a getpeername 28564562Sgshapiro** call on the SMTP socket. 28664562Sgshapiro*/ 28764562Sgshapiro 28864562Sgshapiro/* SMTP HELO command filter */ 28964562Sgshapiroextern sfsistat xxfi_helo __P((SMFICTX *, char *)); 29064562Sgshapiro 29164562Sgshapiro/* 29264562Sgshapiro** xxfi_helo(ctx, helohost) Invoked on SMTP HELO/EHLO command 29364562Sgshapiro** 29464562Sgshapiro** char *helohost; Value passed to HELO/EHLO command, which should be 29564562Sgshapiro** the domain name of the sending host (but is, in practice, 29664562Sgshapiro** anything the sending host wants to send). 29764562Sgshapiro*/ 29864562Sgshapiro 29964562Sgshapiro/* envelope sender filter */ 30064562Sgshapiroextern sfsistat xxfi_envfrom __P((SMFICTX *, char **)); 30164562Sgshapiro 30264562Sgshapiro/* 30364562Sgshapiro** xxfi_envfrom(ctx, argv) Invoked on envelope from 30464562Sgshapiro** 30564562Sgshapiro** char **argv; Null-terminated SMTP command arguments; 30664562Sgshapiro** argv[0] is guaranteed to be the sender address. 30764562Sgshapiro** Later arguments are the ESMTP arguments. 30864562Sgshapiro*/ 30964562Sgshapiro 31064562Sgshapiro/* envelope recipient filter */ 31164562Sgshapiroextern sfsistat xxfi_envrcpt __P((SMFICTX *, char **)); 31264562Sgshapiro 31364562Sgshapiro/* 31464562Sgshapiro** xxfi_envrcpt(ctx, argv) Invoked on each envelope recipient 31564562Sgshapiro** 31664562Sgshapiro** char **argv; Null-terminated SMTP command arguments; 31764562Sgshapiro** argv[0] is guaranteed to be the recipient address. 31864562Sgshapiro** Later arguments are the ESMTP arguments. 31964562Sgshapiro*/ 32064562Sgshapiro 321132943Sgshapiro/* unknown command filter */ 322132943Sgshapiro 323168515Sgshapiroextern sfsistat *xxfi_unknown __P((SMFICTX *, const char *)); 324132943Sgshapiro 325132943Sgshapiro/* 326132943Sgshapiro** xxfi_unknown(ctx, arg) Invoked when SMTP command is not recognized or not 327132943Sgshapiro** implemented. 328168515Sgshapiro** const char *arg; Null-terminated SMTP command 329132943Sgshapiro*/ 330132943Sgshapiro 33164562Sgshapiro/* header filter */ 33264562Sgshapiroextern sfsistat xxfi_header __P((SMFICTX *, char *, char *)); 33364562Sgshapiro 33464562Sgshapiro/* 33564562Sgshapiro** xxfi_header(ctx, headerf, headerv) Invoked on each message header. The 33664562Sgshapiro** content of the header may have folded white space (that is, multiple 33764562Sgshapiro** lines with following white space) included. 33864562Sgshapiro** 33964562Sgshapiro** char *headerf; Header field name 34064562Sgshapiro** char *headerv; Header field value 34164562Sgshapiro*/ 34264562Sgshapiro 34364562Sgshapiro/* end of header */ 34464562Sgshapiroextern sfsistat xxfi_eoh __P((SMFICTX *)); 34564562Sgshapiro 34664562Sgshapiro/* 34764562Sgshapiro** xxfi_eoh(ctx) Invoked at end of header 34864562Sgshapiro*/ 34964562Sgshapiro 35064562Sgshapiro/* body block */ 35190792Sgshapiroextern sfsistat xxfi_body __P((SMFICTX *, unsigned char *, size_t)); 35264562Sgshapiro 35364562Sgshapiro/* 35464562Sgshapiro** xxfi_body(ctx, bodyp, bodylen) Invoked for each body chunk. There may 35564562Sgshapiro** be multiple body chunks passed to the filter. End-of-lines are 35664562Sgshapiro** represented as received from SMTP (normally Carriage-Return/Line-Feed). 35764562Sgshapiro** 35890792Sgshapiro** unsigned char *bodyp; Pointer to body data 35964562Sgshapiro** size_t bodylen; Length of body data 36064562Sgshapiro*/ 36164562Sgshapiro 36264562Sgshapiro/* end of message */ 36364562Sgshapiroextern sfsistat xxfi_eom __P((SMFICTX *)); 36464562Sgshapiro 36564562Sgshapiro/* 36664562Sgshapiro** xxfi_eom(ctx) Invoked at end of message. This routine can perform 36764562Sgshapiro** special operations such as modifying the message header, body, or 36864562Sgshapiro** envelope. 36964562Sgshapiro*/ 37064562Sgshapiro 37164562Sgshapiro/* message aborted */ 37264562Sgshapiroextern sfsistat xxfi_abort __P((SMFICTX *)); 37364562Sgshapiro 37464562Sgshapiro/* 37564562Sgshapiro** xxfi_abort(ctx) Invoked if message is aborted outside of the control of 37664562Sgshapiro** the filter, for example, if the SMTP sender issues an RSET command. If 37764562Sgshapiro** xxfi_abort is called, xxfi_eom will not be called and vice versa. 37864562Sgshapiro*/ 37964562Sgshapiro 38064562Sgshapiro/* connection cleanup */ 38164562Sgshapiroextern sfsistat xxfi_close __P((SMFICTX *)); 38264562Sgshapiro 38364562Sgshapiro/* 38464562Sgshapiro** xxfi_close(ctx) Invoked at end of the connection. This is called on 38564562Sgshapiro** close even if the previous mail transaction was aborted. 38664562Sgshapiro*/ 38764562Sgshapiro#endif /* 0 */ 38864562Sgshapiro 38964562Sgshapiro/* 39064562Sgshapiro** Additional information is passed in to the vendor filter routines using 39164562Sgshapiro** symbols. Symbols correspond closely to sendmail macros. The symbols 39264562Sgshapiro** defined depend on the context. The value of a symbol is accessed using: 39364562Sgshapiro*/ 39464562Sgshapiro 39564562Sgshapiro/* Return the value of a symbol. */ 39664562SgshapiroLIBMILTER_API char * smfi_getsymval __P((SMFICTX *, char *)); 39764562Sgshapiro 39864562Sgshapiro/* 39964562Sgshapiro** Return the value of a symbol. 40064562Sgshapiro** 40164562Sgshapiro** SMFICTX *ctx; Opaque context structure 40264562Sgshapiro** char *symname; The name of the symbol to access. 40364562Sgshapiro*/ 40464562Sgshapiro 40564562Sgshapiro/* 40664562Sgshapiro** Vendor filter routines that want to pass additional information back to 40764562Sgshapiro** the MTA for use in SMTP replies may call smfi_setreply before returning. 40864562Sgshapiro*/ 40964562Sgshapiro 41064562SgshapiroLIBMILTER_API int smfi_setreply __P((SMFICTX *, char *, char *, char *)); 41164562Sgshapiro 41264562Sgshapiro/* 41390792Sgshapiro** Alternatively, smfi_setmlreply can be called if a multi-line SMTP reply 41490792Sgshapiro** is needed. 41590792Sgshapiro*/ 41690792Sgshapiro 41790792SgshapiroLIBMILTER_API int smfi_setmlreply __P((SMFICTX *, const char *, const char *, ...)); 41890792Sgshapiro 41990792Sgshapiro/* 42064562Sgshapiro** Set the specific reply code to be used in response to the active 42164562Sgshapiro** command. If not specified, a generic reply code is used. 42264562Sgshapiro** 42364562Sgshapiro** SMFICTX *ctx; Opaque context structure 42464562Sgshapiro** char *rcode; The three-digit (RFC 821) SMTP reply code to be 42564562Sgshapiro** returned, e.g., ``551''. 42664562Sgshapiro** char *xcode; The extended (RFC 2034) reply code, e.g., ``5.7.6''. 42764562Sgshapiro** char *message; The text part of the SMTP reply. 42864562Sgshapiro*/ 42964562Sgshapiro 43064562Sgshapiro/* 43164562Sgshapiro** The xxfi_eom routine is called at the end of a message (essentially, 43264562Sgshapiro** after the final DATA dot). This routine can call some special routines 43364562Sgshapiro** to modify the envelope, header, or body of the message before the 43464562Sgshapiro** message is enqueued. These routines must not be called from any vendor 43564562Sgshapiro** routine other than xxfi_eom. 43664562Sgshapiro*/ 43764562Sgshapiro 43864562SgshapiroLIBMILTER_API int smfi_addheader __P((SMFICTX *, char *, char *)); 43964562Sgshapiro 44064562Sgshapiro/* 441132943Sgshapiro** Add a header to the message. It is not checked for standards 442132943Sgshapiro** compliance; the mail filter must ensure that no protocols are violated 443132943Sgshapiro** as a result of adding this header. 44464562Sgshapiro** 44564562Sgshapiro** SMFICTX *ctx; Opaque context structure 44664562Sgshapiro** char *headerf; Header field name 44764562Sgshapiro** char *headerv; Header field value 44864562Sgshapiro*/ 44964562Sgshapiro 45064562SgshapiroLIBMILTER_API int smfi_chgheader __P((SMFICTX *, char *, int, char *)); 45164562Sgshapiro 45264562Sgshapiro/* 45364562Sgshapiro** Change/delete a header in the message. It is not checked for standards 45464562Sgshapiro** compliance; the mail filter must ensure that no protocols are violated 45564562Sgshapiro** as a result of adding this header. 45664562Sgshapiro** 45764562Sgshapiro** SMFICTX *ctx; Opaque context structure 45864562Sgshapiro** char *headerf; Header field name 45964562Sgshapiro** int index; The Nth occurence of header field name 46064562Sgshapiro** char *headerv; New header field value (empty for delete header) 46164562Sgshapiro*/ 46264562Sgshapiro 463132943SgshapiroLIBMILTER_API int smfi_insheader __P((SMFICTX *, int, char *, char *)); 464132943Sgshapiro 465132943Sgshapiro/* 466132943Sgshapiro** Insert a header into the message. It is not checked for standards 467132943Sgshapiro** compliance; the mail filter must ensure that no protocols are violated 468132943Sgshapiro** as a result of adding this header. 469132943Sgshapiro** 470132943Sgshapiro** SMFICTX *ctx; Opaque context structure 471132943Sgshapiro** int idx; index into the header list where the insertion should happen 472132943Sgshapiro** char *headerh; Header field name 473132943Sgshapiro** char *headerv; Header field value 474132943Sgshapiro*/ 475132943Sgshapiro 476168515SgshapiroLIBMILTER_API int smfi_chgfrom __P((SMFICTX *, char *, char *)); 477168515Sgshapiro 478168515Sgshapiro/* 479168515Sgshapiro** Modify envelope sender address 480168515Sgshapiro** 481168515Sgshapiro** SMFICTX *ctx; Opaque context structure 482168515Sgshapiro** char *mail; New envelope sender address 483168515Sgshapiro** char *args; ESMTP arguments 484168515Sgshapiro*/ 485168515Sgshapiro 486168515Sgshapiro 48764562SgshapiroLIBMILTER_API int smfi_addrcpt __P((SMFICTX *, char *)); 48864562Sgshapiro 48964562Sgshapiro/* 49064562Sgshapiro** Add a recipient to the envelope 49164562Sgshapiro** 49264562Sgshapiro** SMFICTX *ctx; Opaque context structure 49364562Sgshapiro** char *rcpt; Recipient to be added 49464562Sgshapiro*/ 49564562Sgshapiro 496168515SgshapiroLIBMILTER_API int smfi_addrcpt_par __P((SMFICTX *, char *, char *)); 497168515Sgshapiro 498168515Sgshapiro/* 499168515Sgshapiro** Add a recipient to the envelope 500168515Sgshapiro** 501168515Sgshapiro** SMFICTX *ctx; Opaque context structure 502168515Sgshapiro** char *rcpt; Recipient to be added 503168515Sgshapiro** char *args; ESMTP arguments 504168515Sgshapiro*/ 505168515Sgshapiro 506168515Sgshapiro 50764562SgshapiroLIBMILTER_API int smfi_delrcpt __P((SMFICTX *, char *)); 50864562Sgshapiro 50964562Sgshapiro/* 51094334Sgshapiro** Send a "no-op" up to the MTA to tell it we're still alive, so long 51194334Sgshapiro** milter-side operations don't time out. 51294334Sgshapiro** 51394334Sgshapiro** SMFICTX *ctx; Opaque context structure 51494334Sgshapiro*/ 51594334Sgshapiro 51694334SgshapiroLIBMILTER_API int smfi_progress __P((SMFICTX *)); 51794334Sgshapiro 51894334Sgshapiro/* 51964562Sgshapiro** Delete a recipient from the envelope 52064562Sgshapiro** 52164562Sgshapiro** SMFICTX *ctx; Opaque context structure 52264562Sgshapiro** char *rcpt; Envelope recipient to be deleted. This should be in 52364562Sgshapiro** exactly the form passed to xxfi_envrcpt or the address may 52464562Sgshapiro** not be deleted. 52564562Sgshapiro*/ 52664562Sgshapiro 52790792SgshapiroLIBMILTER_API int smfi_replacebody __P((SMFICTX *, unsigned char *, int)); 52864562Sgshapiro 52964562Sgshapiro/* 53064562Sgshapiro** Replace the body of the message. This routine may be called multiple 53164562Sgshapiro** times if the body is longer than convenient to send in one call. End of 53264562Sgshapiro** line should be represented as Carriage-Return/Line Feed. 53364562Sgshapiro** 53464562Sgshapiro** char *bodyp; Pointer to block of body information to insert 53564562Sgshapiro** int bodylen; Length of data pointed at by bodyp 53664562Sgshapiro*/ 53764562Sgshapiro 53864562Sgshapiro/* 53964562Sgshapiro** If the message is aborted (for example, if the SMTP sender sends the 54064562Sgshapiro** envelope but then does a QUIT or RSET before the data is sent), 54164562Sgshapiro** xxfi_abort is called. This can be used to reset state. 54264562Sgshapiro*/ 54364562Sgshapiro 54490792Sgshapiro/* 54590792Sgshapiro** Quarantine an envelope 54690792Sgshapiro** 54790792Sgshapiro** SMFICTX *ctx; Opaque context structure 54890792Sgshapiro** char *reason: explanation 54990792Sgshapiro*/ 55064562Sgshapiro 55190792SgshapiroLIBMILTER_API int smfi_quarantine __P((SMFICTX *ctx, char *reason)); 55290792Sgshapiro 55364562Sgshapiro/* 55464562Sgshapiro** Connection-private data (specific to an SMTP connection) can be 55564562Sgshapiro** allocated using the smfi_setpriv routine; routines can access private 55664562Sgshapiro** data using smfi_getpriv. 55764562Sgshapiro*/ 55864562Sgshapiro 55964562SgshapiroLIBMILTER_API int smfi_setpriv __P((SMFICTX *, void *)); 56064562Sgshapiro 56164562Sgshapiro/* 56264562Sgshapiro** Set the private data pointer 56364562Sgshapiro** 56464562Sgshapiro** SMFICTX *ctx; Opaque context structure 56564562Sgshapiro** void *privatedata; Pointer to private data area 56664562Sgshapiro*/ 56764562Sgshapiro 56864562SgshapiroLIBMILTER_API void *smfi_getpriv __P((SMFICTX *)); 56964562Sgshapiro 570168515Sgshapiro/* 571168515Sgshapiro** Get the private data pointer 572168515Sgshapiro** 573168515Sgshapiro** SMFICTX *ctx; Opaque context structure 574168515Sgshapiro** void *privatedata; Pointer to private data area 575168515Sgshapiro*/ 576168515Sgshapiro 577168515SgshapiroLIBMILTER_API int smfi_setsymlist __P((SMFICTX *, int, char *)); 578168515Sgshapiro 579168515Sgshapiro/* 580168515Sgshapiro** Set list of symbols (macros) to receive 581168515Sgshapiro** 582168515Sgshapiro** SMFICTX *ctx; Opaque context structure 583168515Sgshapiro** int where; where in the SMTP dialogue should the macros be sent 584168515Sgshapiro** char *macros; list of macros (space separated) 585168515Sgshapiro*/ 586168515Sgshapiro 587168515Sgshapiro#if _FFR_THREAD_MONITOR 588168515SgshapiroLIBMILTER_API int smfi_set_max_exec_time __P((unsigned int)); 589168515Sgshapiro#endif /* _FFR_THREAD_MONITOR */ 590168515Sgshapiro 591132943Sgshapiro#ifdef __cplusplus 592132943Sgshapiro} 593132943Sgshapiro#endif /* __cplusplus */ 59464562Sgshapiro 595110560Sgshapiro#endif /* ! _LIBMILTER_MFAPI_H */ 596