Postfix3.3.1
deliver_request.h
[詳解]
1 #ifndef _DELIVER_REQUEST_H_INCLUDED_
2 #define _DELIVER_REQUEST_H_INCLUDED_
3 
4 /*++
5 /* NAME
6 /* deliver_request 3h
7 /* SUMMARY
8 /* mail delivery request protocol, server side
9 /* SYNOPSIS
10 /* #include <deliver_request.h>
11 /* DESCRIPTION
12 /* .nf
13 
14  /*
15  * Utility library.
16  */
17 #include <vstring.h>
18 #include <vstream.h>
19 
20  /*
21  * Global library.
22  */
23 #include <recipient_list.h>
24 #include <dsn.h>
25 #include <msg_stats.h>
26 
27  /*
28  * Structure of a server mail delivery request.
29  */
30 typedef struct DELIVER_REQUEST {
31  VSTREAM *fp; /* stream, shared lock */
32  int flags; /* see below */
33  char *queue_name; /* message queue name */
34  char *queue_id; /* message queue id */
35  long data_offset; /* offset to message */
36  long data_size; /* message size */
37  char *nexthop; /* next hop name */
38  char *encoding; /* content encoding */
39  int smtputf8; /* SMTPUTF8 level */
40  char *sender; /* envelope sender */
41  MSG_STATS msg_stats; /* time profile */
42  RECIPIENT_LIST rcpt_list; /* envelope recipients */
43  DSN *hop_status; /* DSN status */
44  char *client_name; /* client hostname */
45  char *client_addr; /* client address */
46  char *client_port; /* client port */
47  char *client_proto; /* client protocol */
48  char *client_helo; /* helo parameter */
49  char *sasl_method; /* SASL method */
50  char *sasl_username; /* SASL user name */
51  char *sasl_sender; /* SASL sender */
52  char *log_ident; /* original queue ID */
53  char *rewrite_context; /* address rewrite context */
54  char *dsn_envid; /* DSN envelope ID */
55  int dsn_ret; /* DSN full/header notification */
57 
58  /*
59  * Since we can't send null pointers, null strings represent unavailable
60  * attributes instead. They're less likely to explode in our face, too.
61  */
62 #define DEL_REQ_ATTR_AVAIL(a) (*(a))
63 
64  /*
65  * How to deliver, really?
66  */
67 #define DEL_REQ_FLAG_DEFLT (DEL_REQ_FLAG_SUCCESS | DEL_REQ_FLAG_BOUNCE)
68 #define DEL_REQ_FLAG_SUCCESS (1<<0) /* delete successful recipients */
69 #define DEL_REQ_FLAG_BOUNCE (1<<1) /* unimplemented */
70 
71 #define DEL_REQ_FLAG_MTA_VRFY (1<<8) /* MTA-requested address probe */
72 #define DEL_REQ_FLAG_USR_VRFY (1<<9) /* user-requested address probe */
73 #define DEL_REQ_FLAG_RECORD (1<<10) /* record and deliver */
74 #define DEL_REQ_FLAG_CONN_LOAD (1<<11) /* Consult opportunistic cache */
75 #define DEL_REQ_FLAG_CONN_STORE (1<<12) /* Update opportunistic cache */
76 #define DEL_REQ_FLAG_REC_DLY_SENT (1<<13) /* Record delayed delivery */
77 
78  /*
79  * Cache Load and Store as value or mask. Use explicit _MASK for multi-bit
80  * values.
81  */
82 #define DEL_REQ_FLAG_CONN_MASK \
83  (DEL_REQ_FLAG_CONN_LOAD | DEL_REQ_FLAG_CONN_STORE)
84 
85  /*
86  * For compatibility, the old confusing names.
87  */
88 #define DEL_REQ_FLAG_VERIFY DEL_REQ_FLAG_MTA_VRFY
89 #define DEL_REQ_FLAG_EXPAND DEL_REQ_FLAG_USR_VRFY
90 
91  /*
92  * Mail that uses the trace(8) service, and maybe more.
93  */
94 #define DEL_REQ_TRACE_FLAGS_MASK \
95  (DEL_REQ_FLAG_MTA_VRFY | DEL_REQ_FLAG_USR_VRFY | DEL_REQ_FLAG_RECORD \
96  | DEL_REQ_FLAG_REC_DLY_SENT)
97 #define DEL_REQ_TRACE_FLAGS(f) ((f) & DEL_REQ_TRACE_FLAGS_MASK)
98 
99  /*
100  * Mail that is not delivered (i.e. uses the trace(8) service only).
101  */
102 #define DEL_REQ_TRACE_ONLY_MASK \
103  (DEL_REQ_FLAG_MTA_VRFY | DEL_REQ_FLAG_USR_VRFY)
104 #define DEL_REQ_TRACE_ONLY(f) ((f) & DEL_REQ_TRACE_ONLY_MASK)
105 
106  /*
107  * Per-recipient delivery status. Not to be confused with per-delivery
108  * request status.
109  */
110 #define DEL_RCPT_STAT_OK 0
111 #define DEL_RCPT_STAT_DEFER 1
112 #define DEL_RCPT_STAT_BOUNCE 2
113 #define DEL_RCPT_STAT_TODO 3
114 
115  /*
116  * Delivery request status. Note that there are only FINAL and DEFER. This
117  * is because delivery status information can be lost when a delivery agent
118  * or queue manager process terminates prematurely. The only distinctions we
119  * can rely on are "final delivery completed" (positive confirmation that
120  * all recipients are marked as done) and "everything else". In the absence
121  * of a definitive statement the queue manager will always have to be
122  * prepared for all possibilities.
123  */
124 #define DEL_STAT_FINAL 0 /* delivered or bounced */
125 #define DEL_STAT_DEFER (-1) /* not delivered or bounced */
126 
127 typedef struct VSTREAM _deliver_vstream_;
130 
131 /* LICENSE
132 /* .ad
133 /* .fi
134 /* The Secure Mailer license must be distributed with this software.
135 /* AUTHOR(S)
136 /* Wietse Venema
137 /* IBM T.J. Watson Research
138 /* P.O. Box 704
139 /* Yorktown Heights, NY 10598, USA
140 /*--*/
141 
142 #endif
RECIPIENT_LIST rcpt_list
MSG_STATS msg_stats
int deliver_request_done(_deliver_vstream_ *, DELIVER_REQUEST *, int)
struct DELIVER_REQUEST DELIVER_REQUEST
Definition: dsn.h:17
DELIVER_REQUEST * deliver_request_read(_deliver_vstream_ *)