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