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