3 #ifndef _DELIVER_REQUEST_H_INCLUDED_
4 #define _DELIVER_REQUEST_H_INCLUDED_
10 /* mail delivery request protocol, server side
12 /* #include <deliver_request.h>
25 #include <recipient_list.h>
27 #include <msg_stats.h>
30 * Structure of a server mail delivery request.
32 typedef struct DELIVER_REQUEST
{
33 VSTREAM
*fp
; /* stream, shared lock */
34 int flags
; /* see below */
35 char *queue_name
; /* message queue name */
36 char *queue_id
; /* message queue id */
37 long data_offset
; /* offset to message */
38 long data_size
; /* message size */
39 char *nexthop
; /* next hop name */
40 char *encoding
; /* content encoding */
41 char *sender
; /* envelope sender */
42 MSG_STATS msg_stats
; /* time profile */
43 RECIPIENT_LIST rcpt_list
; /* envelope recipients */
44 DSN
*hop_status
; /* DSN status */
45 char *client_name
; /* client hostname */
46 char *client_addr
; /* client address */
47 char *client_port
; /* client port */
48 char *client_proto
; /* client protocol */
49 char *client_helo
; /* helo parameter */
50 char *sasl_method
; /* SASL method */
51 char *sasl_username
; /* SASL user name */
52 char *sasl_sender
; /* SASL sender */
53 char *rewrite_context
; /* address rewrite context */
54 char *dsn_envid
; /* DSN envelope ID */
55 int dsn_ret
; /* DSN full/header notification */
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.
62 #define DEL_REQ_ATTR_AVAIL(a) (*(a))
65 * How to deliver, really?
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 */
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 */
78 * Cache Load and Store as value or mask. Use explicit _MASK for multi-bit
81 #define DEL_REQ_FLAG_CONN_MASK \
82 (DEL_REQ_FLAG_CONN_LOAD | DEL_REQ_FLAG_CONN_STORE)
85 * For compatibility, the old confusing names.
87 #define DEL_REQ_FLAG_VERIFY DEL_REQ_FLAG_MTA_VRFY
88 #define DEL_REQ_FLAG_EXPAND DEL_REQ_FLAG_USR_VRFY
91 * Mail that uses the trace(8) service, and maybe more.
93 #define DEL_REQ_TRACE_FLAGS_MASK \
94 (DEL_REQ_FLAG_MTA_VRFY | DEL_REQ_FLAG_USR_VRFY | DEL_REQ_FLAG_RECORD)
95 #define DEL_REQ_TRACE_FLAGS(f) ((f) & DEL_REQ_TRACE_FLAGS_MASK)
98 * Mail that is not delivered (i.e. uses the trace(8) service only).
100 #define DEL_REQ_TRACE_ONLY_MASK \
101 (DEL_REQ_FLAG_MTA_VRFY | DEL_REQ_FLAG_USR_VRFY)
102 #define DEL_REQ_TRACE_ONLY(f) ((f) & DEL_REQ_TRACE_ONLY_MASK)
105 * Per-recipient delivery status. Not to be confused with per-delivery
108 #define DEL_RCPT_STAT_OK 0
109 #define DEL_RCPT_STAT_DEFER 1
110 #define DEL_RCPT_STAT_BOUNCE 2
111 #define DEL_RCPT_STAT_TODO 3
114 * Delivery request status. Note that there are only FINAL and DEFER. This
115 * is because delivery status information can be lost when a delivery agent
116 * or queue manager process terminates prematurely. The only distinctions we
117 * can rely on are "final delivery completed" (positive confirmation that
118 * all recipients are marked as done) and "everything else". In the absence
119 * of a definitive statement the queue manager will always have to be
120 * prepared for all possibilities.
122 #define DEL_STAT_FINAL 0 /* delivered or bounced */
123 #define DEL_STAT_DEFER (-1) /* not delivered or bounced */
125 typedef struct VSTREAM _deliver_vstream_
;
126 extern DELIVER_REQUEST
*deliver_request_read(_deliver_vstream_
*);
127 extern int deliver_request_done(_deliver_vstream_
*, DELIVER_REQUEST
*, int);
132 /* The Secure Mailer license must be distributed with this software.
135 /* IBM T.J. Watson Research
137 /* Yorktown Heights, NY 10598, USA