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
|
#ifndef _DSN_H_INCLUDED_
#define _DSN_H_INCLUDED_
/*++
/* NAME
/* dsn 3h
/* SUMMARY
/* RFC-compliant delivery status information
/* SYNOPSIS
/* #include <dsn.h>
/* DESCRIPTION
/* .nf
/*
* External interface.
*/
typedef struct {
const char *status; /* RFC 3463 status */
const char *action; /* Null / RFC 3464 action */
const char *reason; /* descriptive reason */
const char *dtype; /* Null / RFC 3464 diagnostic type */
const char *dtext; /* Null / RFC 3464 diagnostic code */
const char *mtype; /* Null / RFC 3464 MTA type */
const char *mname; /* Null / RFC 3464 remote MTA */
} DSN;
extern DSN *dsn_create(const char *, const char *, const char *, const char *,
const char *, const char *, const char *);
extern void dsn_free(DSN *);
#define DSN_ASSIGN(dsn, _status, _action, _reason, _dtype, _dtext, _mtype, _mname) \
(((dsn)->status = (_status)), \
((dsn)->action = (_action)), \
((dsn)->reason = (_reason)), \
((dsn)->dtype = (_dtype)), \
((dsn)->dtext = (_dtext)), \
((dsn)->mtype = (_mtype)), \
((dsn)->mname = (_mname)), \
(dsn))
#define DSN_SIMPLE(dsn, _status, _reason) \
(((dsn)->status = (_status)), \
((dsn)->action = DSN_NO_ACTION), \
((dsn)->reason = (_reason)), \
((dsn)->dtype = DSN_NO_DTYPE), \
((dsn)->dtext = DSN_NO_DTEXT), \
((dsn)->mtype = DSN_NO_MTYPE), \
((dsn)->mname = DSN_NO_MNAME), \
(dsn))
#define DSN_NO_ACTION ""
#define DSN_NO_DTYPE ""
#define DSN_NO_DTEXT ""
#define DSN_NO_MTYPE ""
#define DSN_NO_MNAME ""
/*
* Early implementations represented unavailable information with null
* pointers. This resulted in code that is hard to maintain. We now use
* empty strings instead. This does not waste precious memory as long as we
* can represent empty strings efficiently by collapsing them.
*
* The only restriction left is that the status and reason are never null or
* empty; this is enforced by dsn_create() which is invoked by DSN_COPY().
* This complicates the server reply parsing code in the smtp(8) and lmtp(8)
* clients. they must never supply empty strings for these required fields.
*/
#define DSN_COPY(dsn) \
dsn_create((dsn)->status, (dsn)->action, (dsn)->reason, \
(dsn)->dtype, (dsn)->dtext, \
(dsn)->mtype, (dsn)->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
|