f158e701cea6c4e670935f0b9473ed00f5ea6f43
[exim.git] / src / src / transports / smtp.h
1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
4
5 /* Copyright (c) University of Cambridge 1995 - 2015 */
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 EXPERIMENTAL_DANE
33 uschar *hosts_try_dane;
34 uschar *hosts_require_dane;
35 #endif
36 uschar *hosts_try_fastopen;
37 #ifndef DISABLE_PRDR
38 uschar *hosts_try_prdr;
39 #endif
40 #ifndef DISABLE_OCSP
41 uschar *hosts_request_ocsp;
42 uschar *hosts_require_ocsp;
43 #endif
44 uschar *hosts_require_tls;
45 uschar *hosts_avoid_tls;
46 uschar *hosts_verify_avoid_tls;
47 uschar *hosts_avoid_pipelining;
48 uschar *hosts_avoid_esmtp;
49 uschar *hosts_nopass_tls;
50 int command_timeout;
51 int connect_timeout;
52 int data_timeout;
53 int final_timeout;
54 int size_addition;
55 int hosts_max_try;
56 int hosts_max_try_hardlimit;
57 BOOL address_retry_include_sender;
58 BOOL allow_localhost;
59 BOOL authenticated_sender_force;
60 BOOL gethostbyname;
61 BOOL dns_qualify_single;
62 BOOL dns_search_parents;
63 dnssec_domains dnssec;
64 BOOL delay_after_cutoff;
65 BOOL hosts_override;
66 BOOL hosts_randomize;
67 BOOL keepalive;
68 BOOL lmtp_ignore_quota;
69 uschar *expand_retry_include_ip_address;
70 BOOL retry_include_ip_address;
71 #ifdef SUPPORT_SOCKS
72 uschar *socks_proxy;
73 #endif
74 #ifdef SUPPORT_TLS
75 uschar *tls_certificate;
76 uschar *tls_crl;
77 uschar *tls_privatekey;
78 uschar *tls_require_ciphers;
79 uschar *tls_sni;
80 uschar *tls_verify_certificates;
81 int tls_dh_min_bits;
82 BOOL tls_tempfail_tryclear;
83 uschar *tls_verify_hosts;
84 uschar *tls_try_verify_hosts;
85 uschar *tls_verify_cert_hostnames;
86 #endif
87 #ifndef DISABLE_DKIM
88 struct ob_dkim dkim;
89 #endif
90 } smtp_transport_options_block;
91
92 /* smtp connect context */
93 typedef struct {
94 uschar * from_addr;
95 address_item * addrlist;
96 host_item * host;
97 int host_af;
98 int port;
99 uschar * interface;
100
101 BOOL lmtp:1;
102 BOOL smtps:1;
103 BOOL ok:1;
104 BOOL send_rset:1;
105 BOOL send_quit:1;
106 BOOL setting_up:1;
107 BOOL esmtp:1;
108 BOOL esmtp_sent:1;
109 BOOL pending_MAIL:1;
110 #ifndef DISABLE_PRDR
111 BOOL prdr_active:1;
112 #endif
113 #ifdef SUPPORT_I18N
114 BOOL utf8_needed:1;
115 #endif
116 BOOL dsn_all_lasthop:1;
117 #if defined(SUPPORT_TLS) && defined(EXPERIMENTAL_DANE)
118 BOOL dane:1;
119 BOOL dane_required:1;
120 #endif
121 BOOL completed_addr; /* pointer to this used by BDAT callback */
122
123 int max_rcpt;
124
125 uschar peer_offered;
126 uschar * igquotstr;
127 uschar * helo_data;
128 #ifdef EXPERIMENTAL_DSN_INFO
129 uschar * smtp_greeting;
130 uschar * helo_response;
131 #endif
132
133 address_item * first_addr;
134 address_item * next_addr;
135 address_item * sync_addr;
136
137 smtp_inblock inblock;
138 smtp_outblock outblock;
139 uschar buffer[DELIVER_BUFFER_SIZE];
140 uschar inbuffer[4096];
141 uschar outbuffer[4096];
142
143 transport_instance * tblock;
144 smtp_transport_options_block * ob;
145 } smtp_context;
146
147 extern int smtp_setup_conn(smtp_context *, BOOL, BOOL);
148
149
150 /* Data for reading the private options. */
151
152 extern optionlist smtp_transport_options[];
153 extern int smtp_transport_options_count;
154
155 /* Block containing default values. */
156
157 extern smtp_transport_options_block smtp_transport_option_defaults;
158
159 /* The main, init, and closedown entry points for the transport */
160
161 extern BOOL smtp_transport_entry(transport_instance *, address_item *);
162 extern void smtp_transport_init(transport_instance *);
163 extern void smtp_transport_closedown(transport_instance *);
164
165
166
167 extern int smtp_auth(uschar *, unsigned, address_item *, host_item *,
168 smtp_transport_options_block *, BOOL,
169 smtp_inblock *, smtp_outblock *);
170 extern BOOL smtp_mail_auth_str(uschar *, unsigned,
171 address_item *, smtp_transport_options_block *);
172
173 #ifdef SUPPORT_SOCKS
174 extern int socks_sock_connect(host_item *, int, int, uschar *,
175 transport_instance *, int);
176 #endif
177
178 /* End of transports/smtp.h */