MacOS: TCP Fast Open
[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;
0756eb3c 49 uschar *hosts_avoid_esmtp;
875512a3 50#ifdef SUPPORT_TLS
0756eb3c 51 uschar *hosts_nopass_tls;
875512a3
JH
52 uschar *hosts_noproxy_tls;
53#endif
0756eb3c
PH
54 int command_timeout;
55 int connect_timeout;
56 int data_timeout;
57 int final_timeout;
58 int size_addition;
59 int hosts_max_try;
8e669ac1 60 int hosts_max_try_hardlimit;
48c7f9e2 61 BOOL address_retry_include_sender;
0756eb3c 62 BOOL allow_localhost;
382afc6b 63 BOOL authenticated_sender_force;
0756eb3c
PH
64 BOOL gethostbyname;
65 BOOL dns_qualify_single;
66 BOOL dns_search_parents;
7cd171b7 67 dnssec_domains dnssec;
0756eb3c
PH
68 BOOL delay_after_cutoff;
69 BOOL hosts_override;
70 BOOL hosts_randomize;
71 BOOL keepalive;
f1513293 72 BOOL lmtp_ignore_quota;
9c695f6d 73 uschar *expand_retry_include_ip_address;
0756eb3c 74 BOOL retry_include_ip_address;
f0989ec0 75#ifdef SUPPORT_SOCKS
7eb6c37c
JH
76 uschar *socks_proxy;
77#endif
e51c7be2 78#ifdef SUPPORT_TLS
0756eb3c
PH
79 uschar *tls_certificate;
80 uschar *tls_crl;
81 uschar *tls_privatekey;
82 uschar *tls_require_ciphers;
54c90be1 83 uschar *tls_sni;
0756eb3c 84 uschar *tls_verify_certificates;
54c90be1 85 int tls_dh_min_bits;
0756eb3c 86 BOOL tls_tempfail_tryclear;
a63be306
WB
87 uschar *tls_verify_hosts;
88 uschar *tls_try_verify_hosts;
e51c7be2 89 uschar *tls_verify_cert_hostnames;
e51c7be2 90#endif
71c15846
JH
91#ifdef SUPPORT_I18N
92 uschar *utf8_downconvert;
93#endif
e51c7be2 94#ifndef DISABLE_DKIM
ff5aac2b 95 struct ob_dkim dkim;
e51c7be2 96#endif
617d3932
JH
97#ifdef EXPERIMENTAL_ARC
98 uschar *arc_sign;
99#endif
0756eb3c
PH
100} smtp_transport_options_block;
101
02b41d71
JH
102/* smtp connect context */
103typedef struct {
d9c3c8ed 104 uschar * from_addr;
02b41d71
JH
105 address_item * addrlist;
106 host_item * host;
107 int host_af;
108 int port;
109 uschar * interface;
110
e9166683 111 BOOL verify:1;
02b41d71
JH
112 BOOL lmtp:1;
113 BOOL smtps:1;
114 BOOL ok:1;
02b41d71
JH
115 BOOL setting_up:1;
116 BOOL esmtp:1;
117 BOOL esmtp_sent:1;
7c576fca 118 BOOL pipelining_used:1;
02b41d71
JH
119#ifndef DISABLE_PRDR
120 BOOL prdr_active:1;
121#endif
122#ifdef SUPPORT_I18N
123 BOOL utf8_needed:1;
124#endif
125 BOOL dsn_all_lasthop:1;
c0635b6d 126#if defined(SUPPORT_TLS) && defined(SUPPORT_DANE)
02b41d71
JH
127 BOOL dane:1;
128 BOOL dane_required:1;
129#endif
e9166683
JH
130 BOOL pending_MAIL:1;
131 BOOL pending_BDAT:1;
132 BOOL good_RCPT:1;
133 BOOL completed_addr:1;
134 BOOL send_rset:1;
135 BOOL send_quit:1;
02b41d71
JH
136
137 int max_rcpt;
e9166683 138 int cmd_count;
02b41d71 139
8ac90765
JH
140 unsigned peer_offered;
141 unsigned avoid_option;
02b41d71
JH
142 uschar * igquotstr;
143 uschar * helo_data;
144#ifdef EXPERIMENTAL_DSN_INFO
145 uschar * smtp_greeting;
146 uschar * helo_response;
147#endif
148
d9c3c8ed
JH
149 address_item * first_addr;
150 address_item * next_addr;
151 address_item * sync_addr;
152
74f1a423
JH
153 client_conn_ctx cctx;
154 smtp_inblock inblock;
155 smtp_outblock outblock;
02b41d71
JH
156 uschar buffer[DELIVER_BUFFER_SIZE];
157 uschar inbuffer[4096];
158 uschar outbuffer[4096];
159
160 transport_instance * tblock;
161 smtp_transport_options_block * ob;
162} smtp_context;
163
e9166683
JH
164extern int smtp_setup_conn(smtp_context *, BOOL);
165extern int smtp_write_mail_and_rcpt_cmds(smtp_context *, int *);
02b41d71
JH
166
167
0756eb3c
PH
168/* Data for reading the private options. */
169
170extern optionlist smtp_transport_options[];
171extern int smtp_transport_options_count;
172
173/* Block containing default values. */
174
175extern smtp_transport_options_block smtp_transport_option_defaults;
176
177/* The main, init, and closedown entry points for the transport */
178
179extern BOOL smtp_transport_entry(transport_instance *, address_item *);
180extern void smtp_transport_init(transport_instance *);
181extern void smtp_transport_closedown(transport_instance *);
182
b4a2b536
JH
183
184
b4a2b536
JH
185extern BOOL smtp_mail_auth_str(uschar *, unsigned,
186 address_item *, smtp_transport_options_block *);
187
f0989ec0 188#ifdef SUPPORT_SOCKS
160ef8ca 189extern int socks_sock_connect(host_item *, int, int, uschar *,
7eb6c37c
JH
190 transport_instance *, int);
191#endif
192
0756eb3c 193/* End of transports/smtp.h */