The Database Schema

The slowmilt milter uses Berkeley DB 4.2, which is not a relational database. Although two databases can be joined for bidirectional lookups, that approach was not used for slowmilt.

The slowmilt milter uses a single database:

The keys for the IP address database are IP addresses stored in binary in standard network byte order.

typedef unsigned long PRIMARY_KEY; /* IPv4 IP number in numeric binary */ For version 3 of the database duplicate keys are allowed so all entries are grouped by IP number keys.

The data for the database is a structure that looks like this:

# define MAX_MESSAGE_ID (256)
typedef struct {
        BITMAP          eventmap;       /* See the BIT_ definitions below */
	time_t          date;
        unsigned int    envrcpts;       /* excess envelope recipients */
        unsigned int    headrcpts;      /* excess header recipients */
        unsigned int    honeyrcpts;     /* total honey pot recipients */
        unsigned int    badrcpts;       /* total bad recipients */
        char            msgid[MAX_MESSAGE_ID];
The items in this datum structure (together) define a single event. See the standard event set for a description of what the items in this structure mean. Also see slow.h in the source distribution to understand the ordering of bits in eventmap.

The database can be dumped to a file using the slowedit list command, and that text output can be later be fed back into the slowedit rebuild command to recreate the database.