1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) University of Cambridge 1995 - 2018 */
6 /* Copyright (c) The Exim Maintainers 2020 - 2021 */
7 /* See the file NOTICE for conditions of use and distribution. */
8 /* SPDX-License-Identifier: GPL-2.0-or-later */
10 /* This header file contains the definitions of the structures used in the
11 various hints databases are also kept in this file, which is used by the
12 maintenance utilities as well as the main Exim binary. */
14 #ifndef HINTSDB_STRUCTS_H
15 #define HINTSDB_STRUCTS_H
18 /* Structure for carrying around an open DBM file, and an open locking file
19 that relates to it. */
27 /* Structures for records stored in exim database dbm files. They all
28 start with the same fields, described in the generic type. */
32 time_t time_stamp; /* Timestamp of writing */
36 /* This structure keeps track of retry information for a host or a local
42 time_t first_failed; /* Time of first failure */
43 time_t last_try; /* Time of last try */
44 time_t next_try; /* Time of next try */
45 BOOL expired; /* Retry time has expired */
46 int basic_errno; /* Errno of last failure */
47 int more_errno; /* Additional information */
48 uschar text[1]; /* Text message for last failure */
51 /* These structures keep track of addresses that have had callout verification
52 performed on them. There are two groups of records:
54 1. keyed by localpart@domain -
55 Full address was tested and record holds result
58 Domain response upto MAIL FROM:<>, postmaster, random local part;
60 If a record exists, the result field is either ccache_accept or ccache_reject,
61 or, for a domain record only, ccache_reject_mfnull when MAIL FROM:<> was
62 rejected. The other fields, however, (which are only relevant to domain
63 records) may also contain ccache_unknown if that particular test has not been
66 Originally, there was only one structure, used for both types. However, it got
67 expanded for domain records, so it got split. To make it possible for Exim to
68 handle the old type of record, we retain the old definition. The different
69 kinds of record can be distinguished by their different lengths. */
75 int postmaster_result; /* Postmaster is accepted */
76 int random_result; /* Random local part was accepted */
77 } dbdata_callout_cache_obs;
80 time_t time_stamp; /* Timestamp of last address check */
82 int result; /* accept or reject */
83 } dbdata_callout_cache_address;
85 /* For this new layout, we put the additional fields (the timestamps)
86 last so that if somebody reverts to an older Exim, the new records will
87 still make sense because they match the old layout. */
90 time_t time_stamp; /* Time stamp of last connection */
92 int result; /* Domain reject or accept */
93 int postmaster_result; /* Postmaster result */
94 int random_result; /* Random result */
95 time_t postmaster_stamp; /* Timestamp of postmaster check */
96 time_t random_stamp; /* Timestamp of random check */
97 } dbdata_callout_cache;
99 /* This structure keeps track of messages that are waiting for a particular
100 host for a particular transport. */
105 int count; /* Count of message ids */
106 int sequence; /* Sequence for continued records */
107 uschar text[1]; /* One long character string */
111 /* The contents of the "misc" database are a mixture of different kinds of
112 record, as defined below. The keys used for a specific type all start with a
113 given string such as "etrn-" or "host-serialize-". */
116 /* This structure records a connection to a particular host, for the
117 purpose of serializing access to certain hosts. For possible future extension,
118 a field is defined for holding the count of connections, but it is not
119 at present in use. The same structure is used for recording a running ETRN
125 int count; /* Reserved for possible connection count */
129 /* This structure records the information required for the ratelimit
135 int time_usec; /* Fractional part of time, from gettimeofday() */
136 double rate; /* Smoothed sending rate at that time */
139 /* Same as above, plus a Bloom filter for uniquifying events. */
142 dbdata_ratelimit dbd;
143 time_t bloom_epoch; /* When the Bloom filter was last reset */
144 unsigned bloom_size; /* Number of bytes in the Bloom filter */
145 uschar bloom[40]; /* Bloom filter which may be larger than this */
146 } dbdata_ratelimit_unique;
149 /* For "seen" ACL condition */
154 #ifndef DISABLE_PIPE_CONNECT
155 /* This structure records the EHLO responses, cleartext and crypted,
156 for an IP, as bitmasks (cf. OPTION_TLS). For LIMITS, also values
157 advertised for MAILMAX, RCPTMAX and RCPTDOMAINMAX; zero meaning no
161 unsigned short cleartext_features;
162 unsigned short crypted_features;
163 unsigned short cleartext_auths;
164 unsigned short crypted_auths;
166 # ifndef DISABLE_ESMTP_LIMITS
167 unsigned int limit_mail;
168 unsigned int limit_rcpt;
169 unsigned int limit_rcptdom;
176 ehlo_resp_precis data;
183 uschar verify_override:1;
186 } dbdata_tls_session;
189 #endif /* whole file */
190 /* End of hintsdb_structs.h */