+#define SOB (smtp_transport_options_block *)
+
+
+/* smtp connect context */
+typedef struct {
+ uschar * from_addr;
+ address_item * addrlist;
+
+ smtp_connect_args conn_args;
+ int port;
+
+ BOOL verify:1;
+ BOOL lmtp:1;
+ BOOL smtps:1;
+ BOOL ok:1;
+ BOOL setting_up:1;
+#ifndef DISABLE_PIPE_CONNECT
+ BOOL early_pipe_ok:1;
+ BOOL early_pipe_active:1;
+#endif
+ BOOL esmtp:1;
+ BOOL esmtp_sent:1;
+ BOOL pipelining_used:1;
+#ifndef DISABLE_PRDR
+ BOOL prdr_active:1;
+#endif
+#ifdef SUPPORT_I18N
+ BOOL utf8_needed:1;
+#endif
+ BOOL dsn_all_lasthop:1;
+#if !defined(DISABLE_TLS) && defined(SUPPORT_DANE)
+ BOOL dane_required:1;
+#endif
+#ifndef DISABLE_PIPE_CONNECT
+ BOOL pending_BANNER:1;
+ BOOL pending_EHLO:1;
+#endif
+ BOOL pending_MAIL:1;
+ BOOL pending_BDAT:1;
+ BOOL RCPT_452:1;
+ BOOL good_RCPT:1;
+#ifdef EXPERIMENTAL_ESMTP_LIMITS
+ BOOL single_rcpt_domain:1;
+#endif
+ BOOL completed_addr:1;
+ BOOL send_rset:1;
+ BOOL send_quit:1;
+ BOOL send_tlsclose:1;
+
+ unsigned peer_offered;
+#ifdef EXPERIMENTAL_ESMTP_LIMITS
+ unsigned peer_limit_mail;
+ unsigned peer_limit_rcpt;
+ unsigned peer_limit_rcptdom;
+#endif
+
+ unsigned max_mail;
+ int max_rcpt;
+ int cmd_count;
+
+ unsigned avoid_option;
+ uschar * igquotstr;
+ uschar * helo_data;
+#ifdef EXPERIMENTAL_DSN_INFO
+ uschar * smtp_greeting;
+ uschar * helo_response;
+#endif
+#ifndef DISABLE_PIPE_CONNECT
+ /* Info about the EHLO response stored to / retrieved from cache. When
+ operating early-pipe, we use the cached values. For each of plaintext and
+ crypted we store bitmaps for ESMTP features and AUTH methods. If the LIMITS
+ extension is built and usable them at least one of the limits values cached
+ is nonzero, and we use the values to constrain the connection. */
+ ehlo_resp_precis ehlo_resp;
+#endif
+
+ struct timeval delivery_start;
+ address_item * first_addr;
+ address_item * next_addr;
+ address_item * sync_addr;
+
+ client_conn_ctx cctx;
+ smtp_inblock inblock;
+ smtp_outblock outblock;
+ uschar buffer[DELIVER_BUFFER_SIZE];
+ uschar inbuffer[4096];
+ uschar outbuffer[4096];
+} smtp_context;
+
+extern int smtp_setup_conn(smtp_context *, BOOL);
+extern int smtp_write_mail_and_rcpt_cmds(smtp_context *, int *);
+extern int smtp_reap_early_pipe(smtp_context *, int *);
+
+