1#ifndef _DSN_BUF_H_INCLUDED_
2#define _DSN_BUF_H_INCLUDED_
3
4/*++
5/* NAME
6/*	dsn_buf 3h
7/* SUMMARY
8/*	delivery status buffer
9/* SYNOPSIS
10/*	#include <dsn_buf.h>
11/* DESCRIPTION
12/* .nf
13
14 /*
15  * Utility library.
16  */
17#include <vstring.h>
18
19 /*
20  * Global library.
21  */
22#include <dsn.h>
23
24 /*
25  * Delivery status buffer, Postfix-internal form.
26  */
27typedef struct {
28    DSN     dsn;			/* convenience */
29    /* Formal members. */
30    VSTRING *status;			/* RFC 3463 */
31    VSTRING *action;			/* RFC 3464 */
32    VSTRING *mtype;			/* null or remote MTA type */
33    VSTRING *mname;			/* null or remote MTA name */
34    VSTRING *dtype;			/* null, smtp, x-unix */
35    VSTRING *dtext;			/* null, RFC 2821, sysexits.h */
36    /* Informal free text. */
37    VSTRING *reason;			/* free text */
38} DSN_BUF;
39
40#define DSB_DEF_ACTION	((char *) 0)
41
42#define DSB_SKIP_RMTA	((char *) 0), ((char *) 0)
43#define DSB_MTYPE_NONE	((char *) 0)
44#define DSB_MTYPE_DNS	"dns"		/* RFC 2821 */
45
46#define DSB_SKIP_REPLY	(char *) 0, " "	/* XXX Bogus? */
47#define DSB_DTYPE_NONE	((char *) 0)
48#define DSB_DTYPE_SMTP	"smtp"		/* RFC 2821 */
49#define DSB_DTYPE_UNIX	"x-unix"	/* sysexits.h */
50#define DSB_DTYPE_SASL	"x-sasl"	/* libsasl */
51
52extern DSN_BUF *dsb_create(void);
53extern DSN_BUF *PRINTFLIKE(8, 9) dsb_update(DSN_BUF *, const char *, const char *, const char *, const char *, const char *, const char *, const char *,...);
54extern DSN_BUF *vdsb_simple(DSN_BUF *, const char *, const char *, va_list);
55extern DSN_BUF *PRINTFLIKE(3, 4) dsb_simple(DSN_BUF *, const char *, const char *,...);
56extern DSN_BUF *PRINTFLIKE(4, 5) dsb_unix(DSN_BUF *, const char *, const char *, const char *,...);
57extern DSN_BUF *dsb_formal(DSN_BUF *, const char *, const char *, const char *, const char *, const char *, const char *);
58extern DSN_BUF *dsb_status(DSN_BUF *, const char *);
59extern void dsb_reset(DSN_BUF *);
60extern void dsb_free(DSN_BUF *);
61
62 /*
63  * Early implementations of the DSN structure represented unavailable
64  * information with null pointers. This resulted in hard to maintain code.
65  * We now use empty strings instead, so there is no need anymore to convert
66  * empty strings to null pointers in the macro below.
67  */
68#define DSN_FROM_DSN_BUF(dsb) \
69    DSN_ASSIGN(&(dsb)->dsn, \
70	vstring_str((dsb)->status), \
71        vstring_str((dsb)->action), \
72        vstring_str((dsb)->reason), \
73        vstring_str((dsb)->dtype), \
74        vstring_str((dsb)->dtext), \
75        vstring_str((dsb)->mtype), \
76        vstring_str((dsb)->mname))
77
78/* LICENSE
79/* .ad
80/* .fi
81/*	The Secure Mailer license must be distributed with this software.
82/* AUTHOR(S)
83/*	Wietse Venema
84/*	IBM T.J. Watson Research
85/*	P.O. Box 704
86/*	Yorktown Heights, NY 10598, USA
87/*--*/
88
89#endif
90