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