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