xref: /freebsd/contrib/sendmail/include/libmilter/mfapi.h (revision 605302a5c9939b7eeda0a31f38901d9a8348e8cb)
106f25ae9SGregory Neil Shapiro /*
2605302a5SGregory Neil Shapiro  * Copyright (c) 1999-2002 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  *
10605302a5SGregory Neil Shapiro  *	$Id: mfapi.h,v 8.41 2002/03/22 21:36:12 gshapiro 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 
20605302a5SGregory Neil Shapiro # include <sys/types.h>
2140266059SGregory Neil Shapiro # include <sys/socket.h>
2240266059SGregory Neil Shapiro # include "libmilter/mfdef.h"
2306f25ae9SGregory Neil Shapiro 
2440266059SGregory Neil Shapiro # define LIBMILTER_API		extern
2506f25ae9SGregory Neil Shapiro 
2606f25ae9SGregory Neil Shapiro 
2706f25ae9SGregory Neil Shapiro #ifndef _SOCK_ADDR
2806f25ae9SGregory Neil Shapiro # define _SOCK_ADDR	struct sockaddr
2906f25ae9SGregory Neil Shapiro #endif /* ! _SOCK_ADDR */
3006f25ae9SGregory Neil Shapiro 
3106f25ae9SGregory Neil Shapiro /*
3206f25ae9SGregory Neil Shapiro **  libmilter functions return one of the following to indicate
3306f25ae9SGregory Neil Shapiro **  success/failure:
3406f25ae9SGregory Neil Shapiro */
3506f25ae9SGregory Neil Shapiro 
3606f25ae9SGregory Neil Shapiro #define MI_SUCCESS	0
3706f25ae9SGregory Neil Shapiro #define MI_FAILURE	(-1)
3806f25ae9SGregory Neil Shapiro 
3906f25ae9SGregory Neil Shapiro /* "forward" declarations */
4006f25ae9SGregory Neil Shapiro typedef struct smfi_str SMFICTX;
4106f25ae9SGregory Neil Shapiro typedef struct smfi_str *SMFICTX_PTR;
4206f25ae9SGregory Neil Shapiro 
4306f25ae9SGregory Neil Shapiro typedef struct smfiDesc smfiDesc_str;
4406f25ae9SGregory Neil Shapiro typedef struct smfiDesc	*smfiDesc_ptr;
4506f25ae9SGregory Neil Shapiro 
4606f25ae9SGregory Neil Shapiro /*
4706f25ae9SGregory Neil Shapiro **  Type which callbacks should return to indicate message status.
4806f25ae9SGregory Neil Shapiro **  This may take on one of the SMFIS_* values listed below.
4906f25ae9SGregory Neil Shapiro */
5006f25ae9SGregory Neil Shapiro 
5106f25ae9SGregory Neil Shapiro typedef int	sfsistat;
5206f25ae9SGregory Neil Shapiro 
5306f25ae9SGregory Neil Shapiro #if defined(__linux__) && defined(__GNUC__) && defined(__cplusplus) && __GNUC_MINOR__ >= 8
5406f25ae9SGregory Neil Shapiro # define SM__P(X)	__PMT(X)
5506f25ae9SGregory Neil Shapiro #else /* __linux__ && __GNUC__ && __cplusplus && _GNUC_MINOR__ >= 8 */
5606f25ae9SGregory Neil Shapiro # define SM__P(X)	__P(X)
5706f25ae9SGregory Neil Shapiro #endif /* __linux__ && __GNUC__ && __cplusplus && _GNUC_MINOR__ >= 8 */
5806f25ae9SGregory Neil Shapiro 
5906f25ae9SGregory Neil Shapiro /* Some platforms don't define __P -- do it for them here: */
6006f25ae9SGregory Neil Shapiro #ifndef __P
6106f25ae9SGregory Neil Shapiro # ifdef __STDC__
6206f25ae9SGregory Neil Shapiro #  define __P(X) X
6306f25ae9SGregory Neil Shapiro # else /* __STDC__ */
6406f25ae9SGregory Neil Shapiro #  define __P(X) ()
6506f25ae9SGregory Neil Shapiro # endif /* __STDC__ */
6606f25ae9SGregory Neil Shapiro #endif /* __P */
6706f25ae9SGregory Neil Shapiro 
6840266059SGregory Neil Shapiro /*
6940266059SGregory Neil Shapiro **  structure describing one milter
7040266059SGregory Neil Shapiro */
7140266059SGregory Neil Shapiro 
7206f25ae9SGregory Neil Shapiro struct smfiDesc
7306f25ae9SGregory Neil Shapiro {
7406f25ae9SGregory Neil Shapiro 	char		*xxfi_name;	/* filter name */
7506f25ae9SGregory Neil Shapiro 	int		xxfi_version;	/* version code -- do not change */
7640266059SGregory Neil Shapiro 	unsigned long	xxfi_flags;	/* flags */
7706f25ae9SGregory Neil Shapiro 
7806f25ae9SGregory Neil Shapiro 	/* connection info filter */
7906f25ae9SGregory Neil Shapiro 	sfsistat	(*xxfi_connect) SM__P((SMFICTX *, char *, _SOCK_ADDR *));
8006f25ae9SGregory Neil Shapiro 
8106f25ae9SGregory Neil Shapiro 	/* SMTP HELO command filter */
8206f25ae9SGregory Neil Shapiro 	sfsistat	(*xxfi_helo) SM__P((SMFICTX *, char *));
8306f25ae9SGregory Neil Shapiro 
8406f25ae9SGregory Neil Shapiro 	/* envelope sender filter */
8506f25ae9SGregory Neil Shapiro 	sfsistat	(*xxfi_envfrom) SM__P((SMFICTX *, char **));
8606f25ae9SGregory Neil Shapiro 
8706f25ae9SGregory Neil Shapiro 	/* envelope recipient filter */
8806f25ae9SGregory Neil Shapiro 	sfsistat	(*xxfi_envrcpt) SM__P((SMFICTX *, char **));
8906f25ae9SGregory Neil Shapiro 
9006f25ae9SGregory Neil Shapiro 	/* header filter */
9106f25ae9SGregory Neil Shapiro 	sfsistat	(*xxfi_header) SM__P((SMFICTX *, char *, char *));
9206f25ae9SGregory Neil Shapiro 
9306f25ae9SGregory Neil Shapiro 	/* end of header */
9406f25ae9SGregory Neil Shapiro 	sfsistat	(*xxfi_eoh) SM__P((SMFICTX *));
9506f25ae9SGregory Neil Shapiro 
9606f25ae9SGregory Neil Shapiro 	/* body block */
9740266059SGregory Neil Shapiro 	sfsistat	(*xxfi_body) SM__P((SMFICTX *, unsigned char *, size_t));
9806f25ae9SGregory Neil Shapiro 
9906f25ae9SGregory Neil Shapiro 	/* end of message */
10006f25ae9SGregory Neil Shapiro 	sfsistat	(*xxfi_eom) SM__P((SMFICTX *));
10106f25ae9SGregory Neil Shapiro 
10206f25ae9SGregory Neil Shapiro 	/* message aborted */
10306f25ae9SGregory Neil Shapiro 	sfsistat	(*xxfi_abort) SM__P((SMFICTX *));
10406f25ae9SGregory Neil Shapiro 
10506f25ae9SGregory Neil Shapiro 	/* connection cleanup */
10606f25ae9SGregory Neil Shapiro 	sfsistat	(*xxfi_close) SM__P((SMFICTX *));
10706f25ae9SGregory Neil Shapiro };
10806f25ae9SGregory Neil Shapiro 
10906f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_register __P((struct smfiDesc));
11006f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_main __P((void));
111605302a5SGregory Neil Shapiro LIBMILTER_API int smfi_setbacklog __P((int));
11206f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_setdbg __P((int));
11306f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_settimeout __P((int));
11406f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_setconn __P((char *));
11542e5d165SGregory Neil Shapiro LIBMILTER_API int smfi_stop __P((void));
11606f25ae9SGregory Neil Shapiro 
11740266059SGregory Neil Shapiro #define SMFI_VERSION	2		/* version number */
11840266059SGregory Neil Shapiro 
11940266059SGregory Neil Shapiro /*
12040266059SGregory Neil Shapiro **  What the filter might do -- values to be ORed together for
12140266059SGregory Neil Shapiro **  smfiDesc.xxfi_flags.
12240266059SGregory Neil Shapiro */
12340266059SGregory Neil Shapiro 
12440266059SGregory Neil Shapiro #define SMFIF_NONE	0x00000000L	/* no flags */
12540266059SGregory Neil Shapiro #define SMFIF_ADDHDRS	0x00000001L	/* filter may add headers */
12640266059SGregory Neil Shapiro #define SMFIF_CHGBODY	0x00000002L	/* filter may replace body */
12740266059SGregory Neil Shapiro #define SMFIF_MODBODY	SMFIF_CHGBODY	/* backwards compatible */
12840266059SGregory Neil Shapiro #define SMFIF_ADDRCPT	0x00000004L	/* filter may add recipients */
12940266059SGregory Neil Shapiro #define SMFIF_DELRCPT	0x00000008L	/* filter may delete recipients */
13040266059SGregory Neil Shapiro #define SMFIF_CHGHDRS	0x00000010L	/* filter may change/delete headers */
13140266059SGregory Neil Shapiro #if _FFR_QUARANTINE
13240266059SGregory Neil Shapiro # define SMFIF_QUARANTINE 0x00000020L	/* filter may quarantine envelope */
13340266059SGregory Neil Shapiro #endif /* _FFR_QUARANTINE */
13440266059SGregory Neil Shapiro 
13506f25ae9SGregory Neil Shapiro /*
13606f25ae9SGregory Neil Shapiro **  Continue processing message/connection.
13706f25ae9SGregory Neil Shapiro */
13806f25ae9SGregory Neil Shapiro 
13906f25ae9SGregory Neil Shapiro #define SMFIS_CONTINUE	0
14006f25ae9SGregory Neil Shapiro 
14106f25ae9SGregory Neil Shapiro /*
14206f25ae9SGregory Neil Shapiro **  Reject the message/connection.
14306f25ae9SGregory Neil Shapiro **  No further routines will be called for this message
14406f25ae9SGregory Neil Shapiro **  (or connection, if returned from a connection-oriented routine).
14506f25ae9SGregory Neil Shapiro */
14606f25ae9SGregory Neil Shapiro 
14706f25ae9SGregory Neil Shapiro #define SMFIS_REJECT	1
14806f25ae9SGregory Neil Shapiro 
14906f25ae9SGregory Neil Shapiro /*
15006f25ae9SGregory Neil Shapiro **  Accept the message,
15106f25ae9SGregory Neil Shapiro **  but silently discard the message.
15206f25ae9SGregory Neil Shapiro **  No further routines will be called for this message.
15306f25ae9SGregory Neil Shapiro **  This is only meaningful from message-oriented routines.
15406f25ae9SGregory Neil Shapiro */
15506f25ae9SGregory Neil Shapiro 
15606f25ae9SGregory Neil Shapiro #define SMFIS_DISCARD	2
15706f25ae9SGregory Neil Shapiro 
15806f25ae9SGregory Neil Shapiro /*
15906f25ae9SGregory Neil Shapiro **  Accept the message/connection.
16006f25ae9SGregory Neil Shapiro **  No further routines will be called for this message
16106f25ae9SGregory Neil Shapiro **  (or connection, if returned from a connection-oriented routine;
16206f25ae9SGregory Neil Shapiro **  in this case, it causes all messages on this connection
16306f25ae9SGregory Neil Shapiro **  to be accepted without filtering).
16406f25ae9SGregory Neil Shapiro */
16506f25ae9SGregory Neil Shapiro 
16606f25ae9SGregory Neil Shapiro #define SMFIS_ACCEPT	3
16706f25ae9SGregory Neil Shapiro 
16806f25ae9SGregory Neil Shapiro /*
16906f25ae9SGregory Neil Shapiro **  Return a temporary failure, i.e.,
17006f25ae9SGregory Neil Shapiro **  the corresponding SMTP command will return a 4xx status code.
17106f25ae9SGregory Neil Shapiro **  In some cases this may prevent further routines from
17206f25ae9SGregory Neil Shapiro **  being called on this message or connection,
17306f25ae9SGregory Neil Shapiro **  although in other cases (e.g., when processing an envelope
17406f25ae9SGregory Neil Shapiro **  recipient) processing of the message will continue.
17506f25ae9SGregory Neil Shapiro */
17606f25ae9SGregory Neil Shapiro 
17706f25ae9SGregory Neil Shapiro #define SMFIS_TEMPFAIL	4
17806f25ae9SGregory Neil Shapiro 
17906f25ae9SGregory Neil Shapiro #if 0
18006f25ae9SGregory Neil Shapiro /*
18106f25ae9SGregory Neil Shapiro **  Filter Routine Details
18206f25ae9SGregory Neil Shapiro */
18306f25ae9SGregory Neil Shapiro 
18406f25ae9SGregory Neil Shapiro /* connection info filter */
18506f25ae9SGregory Neil Shapiro extern sfsistat	xxfi_connect __P((SMFICTX *, char *, _SOCK_ADDR *));
18606f25ae9SGregory Neil Shapiro 
18706f25ae9SGregory Neil Shapiro /*
18806f25ae9SGregory Neil Shapiro **  xxfi_connect(ctx, hostname, hostaddr) Invoked on each connection
18906f25ae9SGregory Neil Shapiro **
19006f25ae9SGregory Neil Shapiro **	char *hostname; Host domain name, as determined by a reverse lookup
19106f25ae9SGregory Neil Shapiro **		on the host address.
19206f25ae9SGregory Neil Shapiro **	_SOCK_ADDR *hostaddr; Host address, as determined by a getpeername
19306f25ae9SGregory Neil Shapiro **		call on the SMTP socket.
19406f25ae9SGregory Neil Shapiro */
19506f25ae9SGregory Neil Shapiro 
19606f25ae9SGregory Neil Shapiro /* SMTP HELO command filter */
19706f25ae9SGregory Neil Shapiro extern sfsistat	xxfi_helo __P((SMFICTX *, char *));
19806f25ae9SGregory Neil Shapiro 
19906f25ae9SGregory Neil Shapiro /*
20006f25ae9SGregory Neil Shapiro **  xxfi_helo(ctx, helohost) Invoked on SMTP HELO/EHLO command
20106f25ae9SGregory Neil Shapiro **
20206f25ae9SGregory Neil Shapiro **	char *helohost; Value passed to HELO/EHLO command, which should be
20306f25ae9SGregory Neil Shapiro **		the domain name of the sending host (but is, in practice,
20406f25ae9SGregory Neil Shapiro **		anything the sending host wants to send).
20506f25ae9SGregory Neil Shapiro */
20606f25ae9SGregory Neil Shapiro 
20706f25ae9SGregory Neil Shapiro /* envelope sender filter */
20806f25ae9SGregory Neil Shapiro extern sfsistat	xxfi_envfrom __P((SMFICTX *, char **));
20906f25ae9SGregory Neil Shapiro 
21006f25ae9SGregory Neil Shapiro /*
21106f25ae9SGregory Neil Shapiro **  xxfi_envfrom(ctx, argv) Invoked on envelope from
21206f25ae9SGregory Neil Shapiro **
21306f25ae9SGregory Neil Shapiro **	char **argv; Null-terminated SMTP command arguments;
21406f25ae9SGregory Neil Shapiro **		argv[0] is guaranteed to be the sender address.
21506f25ae9SGregory Neil Shapiro **		Later arguments are the ESMTP arguments.
21606f25ae9SGregory Neil Shapiro */
21706f25ae9SGregory Neil Shapiro 
21806f25ae9SGregory Neil Shapiro /* envelope recipient filter */
21906f25ae9SGregory Neil Shapiro extern sfsistat	xxfi_envrcpt __P((SMFICTX *, char **));
22006f25ae9SGregory Neil Shapiro 
22106f25ae9SGregory Neil Shapiro /*
22206f25ae9SGregory Neil Shapiro **  xxfi_envrcpt(ctx, argv) Invoked on each envelope recipient
22306f25ae9SGregory Neil Shapiro **
22406f25ae9SGregory Neil Shapiro **	char **argv; Null-terminated SMTP command arguments;
22506f25ae9SGregory Neil Shapiro **		argv[0] is guaranteed to be the recipient address.
22606f25ae9SGregory Neil Shapiro **		Later arguments are the ESMTP arguments.
22706f25ae9SGregory Neil Shapiro */
22806f25ae9SGregory Neil Shapiro 
22906f25ae9SGregory Neil Shapiro /* header filter */
23006f25ae9SGregory Neil Shapiro extern sfsistat	xxfi_header __P((SMFICTX *, char *, char *));
23106f25ae9SGregory Neil Shapiro 
23206f25ae9SGregory Neil Shapiro /*
23306f25ae9SGregory Neil Shapiro **  xxfi_header(ctx, headerf, headerv) Invoked on each message header. The
23406f25ae9SGregory Neil Shapiro **  content of the header may have folded white space (that is, multiple
23506f25ae9SGregory Neil Shapiro **  lines with following white space) included.
23606f25ae9SGregory Neil Shapiro **
23706f25ae9SGregory Neil Shapiro **	char *headerf; Header field name
23806f25ae9SGregory Neil Shapiro **	char *headerv; Header field value
23906f25ae9SGregory Neil Shapiro */
24006f25ae9SGregory Neil Shapiro 
24106f25ae9SGregory Neil Shapiro /* end of header */
24206f25ae9SGregory Neil Shapiro extern sfsistat	xxfi_eoh __P((SMFICTX *));
24306f25ae9SGregory Neil Shapiro 
24406f25ae9SGregory Neil Shapiro /*
24506f25ae9SGregory Neil Shapiro **  xxfi_eoh(ctx) Invoked at end of header
24606f25ae9SGregory Neil Shapiro */
24706f25ae9SGregory Neil Shapiro 
24806f25ae9SGregory Neil Shapiro /* body block */
24940266059SGregory Neil Shapiro extern sfsistat	xxfi_body __P((SMFICTX *, unsigned char *, size_t));
25006f25ae9SGregory Neil Shapiro 
25106f25ae9SGregory Neil Shapiro /*
25206f25ae9SGregory Neil Shapiro **  xxfi_body(ctx, bodyp, bodylen) Invoked for each body chunk. There may
25306f25ae9SGregory Neil Shapiro **  be multiple body chunks passed to the filter. End-of-lines are
25406f25ae9SGregory Neil Shapiro **  represented as received from SMTP (normally Carriage-Return/Line-Feed).
25506f25ae9SGregory Neil Shapiro **
25640266059SGregory Neil Shapiro **	unsigned char *bodyp; Pointer to body data
25706f25ae9SGregory Neil Shapiro **	size_t bodylen; Length of body data
25806f25ae9SGregory Neil Shapiro */
25906f25ae9SGregory Neil Shapiro 
26006f25ae9SGregory Neil Shapiro /* end of message */
26106f25ae9SGregory Neil Shapiro extern sfsistat	xxfi_eom __P((SMFICTX *));
26206f25ae9SGregory Neil Shapiro 
26306f25ae9SGregory Neil Shapiro /*
26406f25ae9SGregory Neil Shapiro **  xxfi_eom(ctx) Invoked at end of message. This routine can perform
26506f25ae9SGregory Neil Shapiro **  special operations such as modifying the message header, body, or
26606f25ae9SGregory Neil Shapiro **  envelope.
26706f25ae9SGregory Neil Shapiro */
26806f25ae9SGregory Neil Shapiro 
26906f25ae9SGregory Neil Shapiro /* message aborted */
27006f25ae9SGregory Neil Shapiro extern sfsistat	xxfi_abort __P((SMFICTX *));
27106f25ae9SGregory Neil Shapiro 
27206f25ae9SGregory Neil Shapiro /*
27306f25ae9SGregory Neil Shapiro **  xxfi_abort(ctx) Invoked if message is aborted outside of the control of
27406f25ae9SGregory Neil Shapiro **  the filter, for example, if the SMTP sender issues an RSET command. If
27506f25ae9SGregory Neil Shapiro **  xxfi_abort is called, xxfi_eom will not be called and vice versa.
27606f25ae9SGregory Neil Shapiro */
27706f25ae9SGregory Neil Shapiro 
27806f25ae9SGregory Neil Shapiro /* connection cleanup */
27906f25ae9SGregory Neil Shapiro extern sfsistat	xxfi_close __P((SMFICTX *));
28006f25ae9SGregory Neil Shapiro 
28106f25ae9SGregory Neil Shapiro /*
28206f25ae9SGregory Neil Shapiro **  xxfi_close(ctx) Invoked at end of the connection. This is called on
28306f25ae9SGregory Neil Shapiro **  close even if the previous mail transaction was aborted.
28406f25ae9SGregory Neil Shapiro */
28506f25ae9SGregory Neil Shapiro #endif /* 0 */
28606f25ae9SGregory Neil Shapiro 
28706f25ae9SGregory Neil Shapiro /*
28806f25ae9SGregory Neil Shapiro **  Additional information is passed in to the vendor filter routines using
28906f25ae9SGregory Neil Shapiro **  symbols. Symbols correspond closely to sendmail macros. The symbols
29006f25ae9SGregory Neil Shapiro **  defined depend on the context. The value of a symbol is accessed using:
29106f25ae9SGregory Neil Shapiro */
29206f25ae9SGregory Neil Shapiro 
29306f25ae9SGregory Neil Shapiro /* Return the value of a symbol. */
29406f25ae9SGregory Neil Shapiro LIBMILTER_API char * smfi_getsymval __P((SMFICTX *, char *));
29506f25ae9SGregory Neil Shapiro 
29606f25ae9SGregory Neil Shapiro /*
29706f25ae9SGregory Neil Shapiro **  Return the value of a symbol.
29806f25ae9SGregory Neil Shapiro **
29906f25ae9SGregory Neil Shapiro **	SMFICTX *ctx; Opaque context structure
30006f25ae9SGregory Neil Shapiro **	char *symname; The name of the symbol to access.
30106f25ae9SGregory Neil Shapiro */
30206f25ae9SGregory Neil Shapiro 
30306f25ae9SGregory Neil Shapiro /*
30406f25ae9SGregory Neil Shapiro **  Vendor filter routines that want to pass additional information back to
30506f25ae9SGregory Neil Shapiro **  the MTA for use in SMTP replies may call smfi_setreply before returning.
30606f25ae9SGregory Neil Shapiro */
30706f25ae9SGregory Neil Shapiro 
30806f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_setreply __P((SMFICTX *, char *, char *, char *));
30906f25ae9SGregory Neil Shapiro 
31040266059SGregory Neil Shapiro #if _FFR_MULTILINE
31140266059SGregory Neil Shapiro /*
31240266059SGregory Neil Shapiro **  Alternatively, smfi_setmlreply can be called if a multi-line SMTP reply
31340266059SGregory Neil Shapiro **  is needed.
31440266059SGregory Neil Shapiro */
31540266059SGregory Neil Shapiro 
31640266059SGregory Neil Shapiro LIBMILTER_API int smfi_setmlreply __P((SMFICTX *, const char *, const char *, ...));
31740266059SGregory Neil Shapiro #endif /* _FFR_MULTILINE */
31840266059SGregory Neil Shapiro 
31906f25ae9SGregory Neil Shapiro /*
32006f25ae9SGregory Neil Shapiro **  Set the specific reply code to be used in response to the active
32106f25ae9SGregory Neil Shapiro **  command. If not specified, a generic reply code is used.
32206f25ae9SGregory Neil Shapiro **
32306f25ae9SGregory Neil Shapiro **	SMFICTX *ctx; Opaque context structure
32406f25ae9SGregory Neil Shapiro **	char *rcode; The three-digit (RFC 821) SMTP reply code to be
32506f25ae9SGregory Neil Shapiro **		returned, e.g., ``551''.
32606f25ae9SGregory Neil Shapiro **	char *xcode; The extended (RFC 2034) reply code, e.g., ``5.7.6''.
32706f25ae9SGregory Neil Shapiro **	char *message; The text part of the SMTP reply.
32806f25ae9SGregory Neil Shapiro */
32906f25ae9SGregory Neil Shapiro 
33006f25ae9SGregory Neil Shapiro /*
33106f25ae9SGregory Neil Shapiro **  The xxfi_eom routine is called at the end of a message (essentially,
33206f25ae9SGregory Neil Shapiro **  after the final DATA dot). This routine can call some special routines
33306f25ae9SGregory Neil Shapiro **  to modify the envelope, header, or body of the message before the
33406f25ae9SGregory Neil Shapiro **  message is enqueued. These routines must not be called from any vendor
33506f25ae9SGregory Neil Shapiro **  routine other than xxfi_eom.
33606f25ae9SGregory Neil Shapiro */
33706f25ae9SGregory Neil Shapiro 
33806f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_addheader __P((SMFICTX *, char *, char *));
33906f25ae9SGregory Neil Shapiro 
34006f25ae9SGregory Neil Shapiro /*
34106f25ae9SGregory Neil Shapiro **  Add a header to the message. This header is not passed to other
34206f25ae9SGregory Neil Shapiro **  filters. It is not checked for standards compliance; the mail filter
34306f25ae9SGregory Neil Shapiro **  must ensure that no protocols are violated as a result of adding this
34406f25ae9SGregory Neil Shapiro **  header.
34506f25ae9SGregory Neil Shapiro **
34606f25ae9SGregory Neil Shapiro **	SMFICTX *ctx; Opaque context structure
34706f25ae9SGregory Neil Shapiro **	char *headerf; Header field name
34806f25ae9SGregory Neil Shapiro **	char *headerv; Header field value
34906f25ae9SGregory Neil Shapiro */
35006f25ae9SGregory Neil Shapiro 
35106f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_chgheader __P((SMFICTX *, char *, int, char *));
35206f25ae9SGregory Neil Shapiro 
35306f25ae9SGregory Neil Shapiro /*
35406f25ae9SGregory Neil Shapiro **  Change/delete a header in the message.  It is not checked for standards
35506f25ae9SGregory Neil Shapiro **  compliance; the mail filter must ensure that no protocols are violated
35606f25ae9SGregory Neil Shapiro **  as a result of adding this header.
35706f25ae9SGregory Neil Shapiro **
35806f25ae9SGregory Neil Shapiro **	SMFICTX *ctx; Opaque context structure
35906f25ae9SGregory Neil Shapiro **	char *headerf; Header field name
36006f25ae9SGregory Neil Shapiro **	int index; The Nth occurence of header field name
36106f25ae9SGregory Neil Shapiro **	char *headerv; New header field value (empty for delete header)
36206f25ae9SGregory Neil Shapiro */
36306f25ae9SGregory Neil Shapiro 
36406f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_addrcpt __P((SMFICTX *, char *));
36506f25ae9SGregory Neil Shapiro 
36606f25ae9SGregory Neil Shapiro /*
36706f25ae9SGregory Neil Shapiro **  Add a recipient to the envelope
36806f25ae9SGregory Neil Shapiro **
36906f25ae9SGregory Neil Shapiro **	SMFICTX *ctx; Opaque context structure
37006f25ae9SGregory Neil Shapiro **	char *rcpt; Recipient to be added
37106f25ae9SGregory Neil Shapiro */
37206f25ae9SGregory Neil Shapiro 
37306f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_delrcpt __P((SMFICTX *, char *));
37406f25ae9SGregory Neil Shapiro 
375605302a5SGregory Neil Shapiro #if _FFR_SMFI_PROGRESS
376605302a5SGregory Neil Shapiro /*
377605302a5SGregory Neil Shapiro **  Send a "no-op" up to the MTA to tell it we're still alive, so long
378605302a5SGregory Neil Shapiro **  milter-side operations don't time out.
379605302a5SGregory Neil Shapiro **
380605302a5SGregory Neil Shapiro **	SMFICTX *ctx; Opaque context structure
381605302a5SGregory Neil Shapiro */
382605302a5SGregory Neil Shapiro 
383605302a5SGregory Neil Shapiro LIBMILTER_API int smfi_progress __P((SMFICTX *));
384605302a5SGregory Neil Shapiro #endif /* _FFR_SMFI_PROGRESS */
385605302a5SGregory Neil Shapiro 
38606f25ae9SGregory Neil Shapiro /*
38706f25ae9SGregory Neil Shapiro **  Delete a recipient from the envelope
38806f25ae9SGregory Neil Shapiro **
38906f25ae9SGregory Neil Shapiro **	SMFICTX *ctx; Opaque context structure
39006f25ae9SGregory Neil Shapiro **	char *rcpt; Envelope recipient to be deleted. This should be in
39106f25ae9SGregory Neil Shapiro **		exactly the form passed to xxfi_envrcpt or the address may
39206f25ae9SGregory Neil Shapiro **		not be deleted.
39306f25ae9SGregory Neil Shapiro */
39406f25ae9SGregory Neil Shapiro 
39540266059SGregory Neil Shapiro LIBMILTER_API int smfi_replacebody __P((SMFICTX *, unsigned char *, int));
39606f25ae9SGregory Neil Shapiro 
39706f25ae9SGregory Neil Shapiro /*
39806f25ae9SGregory Neil Shapiro **  Replace the body of the message. This routine may be called multiple
39906f25ae9SGregory Neil Shapiro **  times if the body is longer than convenient to send in one call. End of
40006f25ae9SGregory Neil Shapiro **  line should be represented as Carriage-Return/Line Feed.
40106f25ae9SGregory Neil Shapiro **
40206f25ae9SGregory Neil Shapiro **	char *bodyp; Pointer to block of body information to insert
40306f25ae9SGregory Neil Shapiro **	int bodylen; Length of data pointed at by bodyp
40406f25ae9SGregory Neil Shapiro */
40506f25ae9SGregory Neil Shapiro 
40606f25ae9SGregory Neil Shapiro /*
40706f25ae9SGregory Neil Shapiro **  If the message is aborted (for example, if the SMTP sender sends the
40806f25ae9SGregory Neil Shapiro **  envelope but then does a QUIT or RSET before the data is sent),
40906f25ae9SGregory Neil Shapiro **  xxfi_abort is called. This can be used to reset state.
41006f25ae9SGregory Neil Shapiro */
41106f25ae9SGregory Neil Shapiro 
41240266059SGregory Neil Shapiro #if _FFR_QUARANTINE
41340266059SGregory Neil Shapiro /*
41440266059SGregory Neil Shapiro **  Quarantine an envelope
41540266059SGregory Neil Shapiro **
41640266059SGregory Neil Shapiro **	SMFICTX *ctx; Opaque context structure
41740266059SGregory Neil Shapiro **	char *reason: explanation
41840266059SGregory Neil Shapiro */
41940266059SGregory Neil Shapiro 
42040266059SGregory Neil Shapiro LIBMILTER_API int smfi_quarantine __P((SMFICTX *ctx, char *reason));
42140266059SGregory Neil Shapiro #endif /* _FFR_QUARANTINE */
42206f25ae9SGregory Neil Shapiro 
42306f25ae9SGregory Neil Shapiro /*
42406f25ae9SGregory Neil Shapiro **  Connection-private data (specific to an SMTP connection) can be
42506f25ae9SGregory Neil Shapiro **  allocated using the smfi_setpriv routine; routines can access private
42606f25ae9SGregory Neil Shapiro **  data using smfi_getpriv.
42706f25ae9SGregory Neil Shapiro */
42806f25ae9SGregory Neil Shapiro 
42906f25ae9SGregory Neil Shapiro LIBMILTER_API int smfi_setpriv __P((SMFICTX *, void *));
43006f25ae9SGregory Neil Shapiro 
43106f25ae9SGregory Neil Shapiro /*
43206f25ae9SGregory Neil Shapiro **  Set the private data pointer
43306f25ae9SGregory Neil Shapiro **
43406f25ae9SGregory Neil Shapiro **	SMFICTX *ctx; Opaque context structure
43506f25ae9SGregory Neil Shapiro **	void *privatedata; Pointer to private data area
43606f25ae9SGregory Neil Shapiro */
43706f25ae9SGregory Neil Shapiro 
43806f25ae9SGregory Neil Shapiro LIBMILTER_API void *smfi_getpriv __P((SMFICTX *));
43906f25ae9SGregory Neil Shapiro 
44006f25ae9SGregory Neil Shapiro 
44106f25ae9SGregory Neil Shapiro #endif /* !_LIBMILTER_MFAPI_H */
442