summaryrefslogtreecommitdiffstats
path: root/src/global/dsn_buf.h
blob: 6fd53dc95e2035a6bab1cdd267c98a1d27b3bfac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef _DSN_BUF_H_INCLUDED_
#define _DSN_BUF_H_INCLUDED_

/*++
/* NAME
/*	dsn_buf 3h
/* SUMMARY
/*	delivery status buffer
/* SYNOPSIS
/*	#include <dsn_buf.h>
/* DESCRIPTION
/* .nf

 /*
  * Utility library.
  */
#include <vstring.h>

 /*
  * Global library.
  */
#include <dsn.h>

 /*
  * Delivery status buffer, Postfix-internal form.
  */
typedef struct {
    DSN     dsn;			/* convenience */
    /* Formal members. */
    VSTRING *status;			/* RFC 3463 */
    VSTRING *action;			/* RFC 3464 */
    VSTRING *mtype;			/* null or remote MTA type */
    VSTRING *mname;			/* null or remote MTA name */
    VSTRING *dtype;			/* null, smtp, x-unix */
    VSTRING *dtext;			/* null, RFC 2821, sysexits.h */
    /* Informal free text. */
    VSTRING *reason;			/* free text */
} DSN_BUF;

#define DSB_DEF_ACTION	((char *) 0)

#define DSB_SKIP_RMTA	((char *) 0), ((char *) 0)
#define DSB_MTYPE_NONE	((char *) 0)
#define DSB_MTYPE_DNS	"dns"		/* RFC 2821 */

#define DSB_SKIP_REPLY	(char *) 0, " "	/* XXX Bogus? */
#define DSB_DTYPE_NONE	((char *) 0)
#define DSB_DTYPE_SMTP	"smtp"		/* RFC 2821 */
#define DSB_DTYPE_UNIX	"x-unix"	/* sysexits.h */
#define DSB_DTYPE_SASL	"x-sasl"	/* libsasl */

extern DSN_BUF *dsb_create(void);
extern DSN_BUF *PRINTFLIKE(8, 9) dsb_update(DSN_BUF *, const char *, const char *, const char *, const char *, const char *, const char *, const char *,...);
extern DSN_BUF *vdsb_simple(DSN_BUF *, const char *, const char *, va_list);
extern DSN_BUF *PRINTFLIKE(3, 4) dsb_simple(DSN_BUF *, const char *, const char *,...);
extern DSN_BUF *PRINTFLIKE(4, 5) dsb_unix(DSN_BUF *, const char *, const char *, const char *,...);
extern DSN_BUF *dsb_formal(DSN_BUF *, const char *, const char *, const char *, const char *, const char *, const char *);
extern DSN_BUF *dsb_status(DSN_BUF *, const char *);
extern void dsb_reset(DSN_BUF *);
extern void dsb_free(DSN_BUF *);

 /*
  * Early implementations of the DSN structure represented unavailable
  * information with null pointers. This resulted in hard to maintain code.
  * We now use empty strings instead, so there is no need anymore to convert
  * empty strings to null pointers in the macro below.
  */
#define DSN_FROM_DSN_BUF(dsb) \
    DSN_ASSIGN(&(dsb)->dsn, \
	vstring_str((dsb)->status), \
        vstring_str((dsb)->action), \
        vstring_str((dsb)->reason), \
        vstring_str((dsb)->dtype), \
        vstring_str((dsb)->dtext), \
        vstring_str((dsb)->mtype), \
        vstring_str((dsb)->mname))

/* LICENSE
/* .ad
/* .fi
/*	The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/*	Wietse Venema
/*	IBM T.J. Watson Research
/*	P.O. Box 704
/*	Yorktown Heights, NY 10598, USA
/*--*/

#endif