debian experimental exim-daemon-heavy config
[exim.git] / src / src / transports / smtp.h
1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
4
5 /* Copyright (c) University of Cambridge 1995 - 2018 */
6 /* Copyright (c) The Exim Maintainers 2020 */
7 /* See the file NOTICE for conditions of use and distribution. */
8
9 #define DELIVER_BUFFER_SIZE 4096
10
11 #define PENDING 256
12 #define PENDING_DEFER (PENDING + DEFER)
13 #define PENDING_OK (PENDING + OK)
14
15
16 /* Private structure for the private options and other private data. */
17
18 typedef struct {
19 uschar *hosts;
20 uschar *fallback_hosts;
21 host_item *hostlist;
22 host_item *fallback_hostlist;
23 uschar *authenticated_sender;
24 uschar *helo_data;
25 uschar *interface;
26 uschar *port;
27 uschar *protocol;
28 uschar *dscp;
29 uschar *serialize_hosts;
30 uschar *hosts_try_auth;
31 uschar *hosts_require_auth;
32 uschar *hosts_try_chunking;
33 #ifdef SUPPORT_DANE
34 uschar *hosts_try_dane;
35 uschar *hosts_require_dane;
36 uschar *dane_require_tls_ciphers;
37 #endif
38 uschar *hosts_try_fastopen;
39 #ifndef DISABLE_PRDR
40 uschar *hosts_try_prdr;
41 #endif
42 #ifndef DISABLE_OCSP
43 uschar *hosts_request_ocsp;
44 uschar *hosts_require_ocsp;
45 #endif
46 uschar *hosts_require_tls;
47 uschar *hosts_avoid_tls;
48 uschar *hosts_verify_avoid_tls;
49 uschar *hosts_avoid_pipelining;
50 #ifndef DISABLE_PIPE_CONNECT
51 uschar *hosts_pipe_connect;
52 #endif
53 uschar *hosts_avoid_esmtp;
54 #ifndef DISABLE_TLS
55 uschar *hosts_nopass_tls;
56 uschar *hosts_noproxy_tls;
57 #endif
58 int command_timeout;
59 int connect_timeout;
60 int data_timeout;
61 int final_timeout;
62 int size_addition;
63 int hosts_max_try;
64 int hosts_max_try_hardlimit;
65 BOOL address_retry_include_sender;
66 BOOL allow_localhost;
67 BOOL authenticated_sender_force;
68 BOOL gethostbyname;
69 BOOL dns_qualify_single;
70 BOOL dns_search_parents;
71 dnssec_domains dnssec;
72 BOOL delay_after_cutoff;
73 BOOL hosts_override;
74 BOOL hosts_randomize;
75 BOOL keepalive;
76 BOOL lmtp_ignore_quota;
77 uschar *expand_retry_include_ip_address;
78 BOOL retry_include_ip_address;
79 #ifdef SUPPORT_SOCKS
80 uschar *socks_proxy;
81 #endif
82 #ifndef DISABLE_TLS
83 uschar *tls_certificate;
84 uschar *tls_crl;
85 uschar *tls_privatekey;
86 uschar *tls_require_ciphers;
87 # ifdef EXPERIMENTAL_TLS_RESUME
88 uschar *tls_resumption_hosts;
89 # endif
90 uschar *tls_sni;
91 uschar *tls_verify_certificates;
92 int tls_dh_min_bits;
93 BOOL tls_tempfail_tryclear;
94 uschar *tls_verify_hosts;
95 uschar *tls_try_verify_hosts;
96 uschar *tls_verify_cert_hostnames;
97 #endif
98 #ifdef SUPPORT_I18N
99 uschar *utf8_downconvert;
100 #endif
101 #ifndef DISABLE_DKIM
102 struct ob_dkim dkim;
103 #endif
104 #ifdef EXPERIMENTAL_ARC
105 uschar *arc_sign;
106 #endif
107 } smtp_transport_options_block;
108
109 #define SOB (smtp_transport_options_block *)
110
111
112 /* smtp connect context */
113 typedef struct {
114 uschar * from_addr;
115 address_item * addrlist;
116
117 smtp_connect_args conn_args;
118 int port;
119
120 BOOL verify:1;
121 BOOL lmtp:1;
122 BOOL smtps:1;
123 BOOL ok:1;
124 BOOL setting_up:1;
125 #ifndef DISABLE_PIPE_CONNECT
126 BOOL early_pipe_ok:1;
127 BOOL early_pipe_active:1;
128 #endif
129 BOOL esmtp:1;
130 BOOL esmtp_sent:1;
131 BOOL pipelining_used:1;
132 #ifndef DISABLE_PRDR
133 BOOL prdr_active:1;
134 #endif
135 #ifdef SUPPORT_I18N
136 BOOL utf8_needed:1;
137 #endif
138 BOOL dsn_all_lasthop:1;
139 #if !defined(DISABLE_TLS) && defined(SUPPORT_DANE)
140 BOOL dane_required:1;
141 #endif
142 #ifndef DISABLE_PIPE_CONNECT
143 BOOL pending_BANNER:1;
144 BOOL pending_EHLO:1;
145 #endif
146 BOOL pending_MAIL:1;
147 BOOL pending_BDAT:1;
148 BOOL RCPT_452:1;
149 BOOL good_RCPT:1;
150 BOOL completed_addr:1;
151 BOOL send_rset:1;
152 BOOL send_quit:1;
153
154 int max_rcpt;
155 int cmd_count;
156
157 unsigned peer_offered;
158 unsigned avoid_option;
159 uschar * igquotstr;
160 uschar * helo_data;
161 #ifdef EXPERIMENTAL_DSN_INFO
162 uschar * smtp_greeting;
163 uschar * helo_response;
164 #endif
165 #ifndef DISABLE_PIPE_CONNECT
166 ehlo_resp_precis ehlo_resp;
167 #endif
168
169 struct timeval delivery_start;
170 address_item * first_addr;
171 address_item * next_addr;
172 address_item * sync_addr;
173
174 client_conn_ctx cctx;
175 smtp_inblock inblock;
176 smtp_outblock outblock;
177 uschar buffer[DELIVER_BUFFER_SIZE];
178 uschar inbuffer[4096];
179 uschar outbuffer[4096];
180 } smtp_context;
181
182 extern int smtp_setup_conn(smtp_context *, BOOL);
183 extern int smtp_write_mail_and_rcpt_cmds(smtp_context *, int *);
184 extern int smtp_reap_early_pipe(smtp_context *, int *);
185
186
187 /* Data for reading the private options. */
188
189 extern optionlist smtp_transport_options[];
190 extern int smtp_transport_options_count;
191
192 /* Block containing default values. */
193
194 extern smtp_transport_options_block smtp_transport_option_defaults;
195
196 /* The main, init, and closedown entry points for the transport */
197
198 extern BOOL smtp_transport_entry(transport_instance *, address_item *);
199 extern void smtp_transport_init(transport_instance *);
200 extern void smtp_transport_closedown(transport_instance *);
201
202
203
204 #ifdef SUPPORT_SOCKS
205 extern int socks_sock_connect(host_item *, int, int, uschar *,
206 transport_instance *, int);
207 #endif
208
209 /* End of transports/smtp.h */