+/* Options on tls_close */
+#define TLS_NO_SHUTDOWN 0 /* Just forget the context */
+#define TLS_SHUTDOWN_NOWAIT 1 /* Send alert; do not wait */
+#define TLS_SHUTDOWN_WAIT 2 /* Send alert & wait for peer's alert */
+#define TLS_SHUTDOWN_WONLY 3 /* only wait for peer's alert */
+
+
+#ifdef COMPILE_UTILITY
+# define ALARM(seconds) alarm(seconds);
+# define ALARM_CLR(seconds) alarm(seconds);
+#else
+/* For debugging of odd alarm-signal problems, stash caller info while the
+alarm is active. Clear it down on cancelling the alarm so we can tell there
+should not be one active. */
+
+# define ALARM(seconds) \
+ debug_selector & D_any \
+ ? (sigalarm_setter = CUS __FUNCTION__, alarm(seconds)) : alarm(seconds);
+# define ALARM_CLR(seconds) \
+ debug_selector & D_any \
+ ? (sigalarm_setter = NULL, alarm(seconds)) : alarm(seconds);
+#endif
+
+#define AUTHS_REGEX US"\\n250[\\s\\-]AUTH\\s+([\\-\\w \\t]+)(?:\\n|$)"
+
+#define EARLY_PIPE_FEATURE_NAME "PIPECONNECT"
+#define EARLY_PIPE_FEATURE_LEN 11
+
+
+/* Flags for auth_client_item() */
+
+#define AUTH_ITEM_FIRST BIT(0)
+#define AUTH_ITEM_LAST BIT(1)
+#define AUTH_ITEM_IGN64 BIT(2)
+
+
+/* Flags for tls_{in,out}_resumption */
+#define RESUME_SUPPORTED BIT(0)
+#define RESUME_CLIENT_REQUESTED BIT(1)
+#define RESUME_CLIENT_SUGGESTED BIT(2)
+#define RESUME_SERVER_TICKET BIT(3)
+#define RESUME_USED BIT(4)
+
+#define RESUME_DECODE_STRING \
+ US"not requested or offered" \
+ ": 0x02 :client requested, no server ticket" \
+ ": 0x04 : 0x05 " \
+ ": 0x06 :client offered session, no server action" \
+ ": 0x08 :no client request" \
+ ": 0x0A :client requested new ticket, server provided" \
+ ": 0x0C :client offered session, not used" \
+ ": 0x0E :client offered session, server only provided new ticket" \
+ ": 0x10 :session resumed unasked" \
+ ": 0x12 :session resumed unasked" \
+ ": 0x14 : 0x15" \
+ ": 0x16 :session resumed" \
+ ": 0x18 :session resumed unasked" \
+ ": 0x1A :session resumed unasked" \
+ ": 0x1C :session resumed" \
+ ": 0x1E :session resumed, also new ticket"
+
+/* Flags for string_vformat */
+#define SVFMT_EXTEND BIT(0)
+#define SVFMT_REBUFFER BIT(1)
+#define SVFMT_TAINT_NOCHK BIT(2)
+
+
+#define NOTIFIER_SOCKET_NAME "exim_daemon_notify"
+/* Notify message types */
+#define NOTIFY_MSG_QRUN 1 /* 2stage qrun fast-ramp trigger */
+#define NOTIFY_QUEUE_SIZE_REQ 2 /* obtain current queue count */
+#define NOTIFY_REGEX 3 /* an RE for caching */
+
+/* Flags for match_check_string() */
+typedef unsigned mcs_flags;
+#define MCS_NOFLAGS 0
+#define MCS_PARTIAL BIT(0) /* permit partial- search types */
+#define MCS_CASELESS BIT(1) /* caseless matching where possible */
+#define MCS_AT_SPECIAL BIT(2) /* recognize @, @[], etc. */
+#define MCS_CACHEABLE BIT(3) /* no dynamic expansions used for pattern */
+
+/* Flags for open() */
+#ifdef O_CLOEXEC
+# define EXIM_CLOEXEC O_CLOEXEC
+#else
+# define EXIM_CLOEXEC 0
+#endif
+#ifdef O_NOFOLLOW
+# define EXIM_NOFOLLOW O_NOFOLLOW
+#else
+# define EXIM_NOFOLLOW 0
+#endif
+
+/* A big number for (effectively) unlimited envelope addresses */
+#define UNLIMITED_ADDRS 999999
+
+/* Flags for queue_list() */
+#define QL_BASIC 0
+#define QL_UNDELIVERED_ONLY 1
+#define QL_PLUS_GENERATED 2
+#define QL_MSGID_ONLY 3
+#define QL_UNSORTED 8
+
+/* Flags for transport_set_up_command() */
+#define TSUC_EXPAND_ARGS BIT(0)
+#define TSUC_ALLOW_TAINTED_ARGS BIT(1)
+#define TSUC_ALLOW_RECIPIENTS BIT(2)
+
+/* Flags for smtp_printf */
+#define SP_MORE TRUE
+#define SP_NO_MORE FALSE
+
+/* Flags for smtp_respond */
+#define SR_FINAL TRUE
+#define SR_NOT_FINAL FALSE
+
+/* Return codes for smtp_write_mail_and_rcpt_cmds() */
+typedef enum {
+ sw_mrc_ok, /* good, rcpt results in addr->transport_return (PENDING_OK, DEFER, FAIL) */
+ sw_mrc_bad_mail, /* MAIL response error */
+ sw_mrc_bad_read, /* any non-MAIL read i/o error */
+ sw_mrc_nonmail_read_timeo, /* non-MAIL response timeout */
+ sw_mrc_bad_internal, /* internal error; channel still usable */
+ sw_mrc_tx_fail, /* transmit failed */
+} sw_mrc_t;
+
+/* Recent versions of PCRE2 are allocating 20kB per match, rather than the previous 112 B.
+When doing en extended loop of matching, release store periodically. */
+
+#define REGEX_LOOPCOUNT_STORE_RESET 1000
+
+/* Debug an option access. Use for non-list ones about to be expanded. */
+#define GET_OPTION(name) \
+ DEBUG(D_expand) debug_printf("try option " name "\n");