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