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