1#ifndef _CLEANUP_USER_H_INCLUDED_
2#define _CLEANUP_USER_H_INCLUDED_
3
4/*++
5/* NAME
6/*	cleanup_user 3h
7/* SUMMARY
8/*	cleanup user interface codes
9/* SYNOPSIS
10/*	#include <cleanup_user.h>
11/* DESCRIPTION
12/* .nf
13
14 /*
15  * Client processing options. Flags 16- are reserved for cleanup.h.
16  */
17#define CLEANUP_FLAG_NONE	0	/* No special features */
18#define CLEANUP_FLAG_BOUNCE	(1<<0)	/* Bounce bad messages */
19#define CLEANUP_FLAG_FILTER	(1<<1)	/* Enable header/body checks */
20#define CLEANUP_FLAG_HOLD	(1<<2)	/* Place message on hold */
21#define CLEANUP_FLAG_DISCARD	(1<<3)	/* Discard message silently */
22#define CLEANUP_FLAG_BCC_OK	(1<<4)	/* Ok to add auto-BCC addresses */
23#define CLEANUP_FLAG_MAP_OK	(1<<5)	/* Ok to map addresses */
24#define CLEANUP_FLAG_MILTER	(1<<6)	/* Enable Milter applications */
25#define CLEANUP_FLAG_SMTP_REPLY	(1<<7)	/* Enable SMTP reply */
26
27#define CLEANUP_FLAG_FILTER_ALL	(CLEANUP_FLAG_FILTER | CLEANUP_FLAG_MILTER)
28 /*
29  * These are normally set when receiving mail from outside.
30  */
31#define CLEANUP_FLAG_MASK_EXTERNAL \
32	(CLEANUP_FLAG_FILTER_ALL | CLEANUP_FLAG_BCC_OK | CLEANUP_FLAG_MAP_OK)
33
34 /*
35  * These are normally set when generating notices or when forwarding mail
36  * internally.
37  */
38#define CLEANUP_FLAG_MASK_INTERNAL CLEANUP_FLAG_MAP_OK
39
40 /*
41  * These are set on the fly while processing SMTP envelopes or message
42  * content.
43  */
44#define CLEANUP_FLAG_MASK_EXTRA \
45	(CLEANUP_FLAG_HOLD | CLEANUP_FLAG_DISCARD)
46
47 /*
48  * Diagnostics.
49  *
50  * CLEANUP_STAT_CONT and CLEANUP_STAT_DEFER both update the reason attribute,
51  * but CLEANUP_STAT_DEFER takes precedence. It terminates queue record
52  * processing, and prevents bounces from being sent.
53  */
54#define CLEANUP_STAT_OK		0	/* Success. */
55#define CLEANUP_STAT_BAD	(1<<0)	/* Internal protocol error */
56#define CLEANUP_STAT_WRITE	(1<<1)	/* Error writing message file */
57#define CLEANUP_STAT_SIZE	(1<<2)	/* Message file too big */
58#define CLEANUP_STAT_CONT	(1<<3)	/* Message content rejected */
59#define CLEANUP_STAT_HOPS	(1<<4)	/* Too many hops */
60#define CLEANUP_STAT_RCPT	(1<<6)	/* No recipients found */
61#define CLEANUP_STAT_PROXY	(1<<7)	/* Proxy reject */
62#define CLEANUP_STAT_DEFER	(1<<8)	/* Temporary reject */
63
64 /*
65  * These are set when we can't bounce even if we were asked to.
66  */
67#define CLEANUP_STAT_MASK_CANT_BOUNCE \
68	(CLEANUP_STAT_BAD | CLEANUP_STAT_WRITE | CLEANUP_STAT_DEFER \
69	    | CLEANUP_STAT_RCPT)
70
71 /*
72  * These are set when we can't examine every record of a message.
73  */
74#define CLEANUP_STAT_MASK_INCOMPLETE \
75	(CLEANUP_STAT_BAD | CLEANUP_STAT_WRITE | CLEANUP_STAT_SIZE \
76	    | CLEANUP_STAT_DEFER)
77
78 /*
79  * Mapping from status code to DSN detail and free text.
80  */
81typedef struct {
82    const unsigned status;		/* CLEANUP_STAT_MUMBLE */
83    const int smtp;			/* RFC 821 */
84    const char *dsn;			/* RFC 3463 */
85    const char *text;			/* free text */
86} CLEANUP_STAT_DETAIL;
87
88extern const char *cleanup_strerror(unsigned);
89extern const CLEANUP_STAT_DETAIL *cleanup_stat_detail(unsigned);
90extern const char *cleanup_strflags(unsigned);
91
92/* LICENSE
93/* .ad
94/* .fi
95/*	The Secure Mailer license must be distributed with this software.
96/* AUTHOR(S)
97/*	Wietse Venema
98/*	IBM T.J. Watson Research
99/*	P.O. Box 704
100/*	Yorktown Heights, NY 10598, USA
101/*--*/
102
103#endif
104