1 /* $NetBSD: deliver_request.h,v 1.1.1.2 2011/03/02 19:32:13 tron 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 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 *log_ident; /* original queue ID */ 54 char *rewrite_context; /* address rewrite context */ 55 char *dsn_envid; /* DSN envelope ID */ 56 int dsn_ret; /* DSN full/header notification */ 57 } DELIVER_REQUEST; 58 59 /* 60 * Since we can't send null pointers, null strings represent unavailable 61 * attributes instead. They're less likely to explode in our face, too. 62 */ 63 #define DEL_REQ_ATTR_AVAIL(a) (*(a)) 64 65 /* 66 * How to deliver, really? 67 */ 68 #define DEL_REQ_FLAG_DEFLT (DEL_REQ_FLAG_SUCCESS | DEL_REQ_FLAG_BOUNCE) 69 #define DEL_REQ_FLAG_SUCCESS (1<<0) /* delete successful recipients */ 70 #define DEL_REQ_FLAG_BOUNCE (1<<1) /* unimplemented */ 71 72 #define DEL_REQ_FLAG_MTA_VRFY (1<<8) /* MTA-requested address probe */ 73 #define DEL_REQ_FLAG_USR_VRFY (1<<9) /* user-requested address probe */ 74 #define DEL_REQ_FLAG_RECORD (1<<10) /* record and deliver */ 75 #define DEL_REQ_FLAG_CONN_LOAD (1<<11) /* Consult opportunistic cache */ 76 #define DEL_REQ_FLAG_CONN_STORE (1<<12) /* Update opportunistic cache */ 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 #define DEL_REQ_TRACE_FLAGS(f) ((f) & DEL_REQ_TRACE_FLAGS_MASK) 97 98 /* 99 * Mail that is not delivered (i.e. uses the trace(8) service only). 100 */ 101 #define DEL_REQ_TRACE_ONLY_MASK \ 102 (DEL_REQ_FLAG_MTA_VRFY | DEL_REQ_FLAG_USR_VRFY) 103 #define DEL_REQ_TRACE_ONLY(f) ((f) & DEL_REQ_TRACE_ONLY_MASK) 104 105 /* 106 * Per-recipient delivery status. Not to be confused with per-delivery 107 * request status. 108 */ 109 #define DEL_RCPT_STAT_OK 0 110 #define DEL_RCPT_STAT_DEFER 1 111 #define DEL_RCPT_STAT_BOUNCE 2 112 #define DEL_RCPT_STAT_TODO 3 113 114 /* 115 * Delivery request status. Note that there are only FINAL and DEFER. This 116 * is because delivery status information can be lost when a delivery agent 117 * or queue manager process terminates prematurely. The only distinctions we 118 * can rely on are "final delivery completed" (positive confirmation that 119 * all recipients are marked as done) and "everything else". In the absence 120 * of a definitive statement the queue manager will always have to be 121 * prepared for all possibilities. 122 */ 123 #define DEL_STAT_FINAL 0 /* delivered or bounced */ 124 #define DEL_STAT_DEFER (-1) /* not delivered or bounced */ 125 126 typedef struct VSTREAM _deliver_vstream_; 127 extern DELIVER_REQUEST *deliver_request_read(_deliver_vstream_ *); 128 extern int deliver_request_done(_deliver_vstream_ *, DELIVER_REQUEST *, int); 129 130 /* LICENSE 131 /* .ad 132 /* .fi 133 /* The Secure Mailer license must be distributed with this software. 134 /* AUTHOR(S) 135 /* Wietse Venema 136 /* IBM T.J. Watson Research 137 /* P.O. Box 704 138 /* Yorktown Heights, NY 10598, USA 139 /*--*/ 140 141 #endif 142