database.html #3

  • //
  • guest/
  • bryan_costales/
  • docs/
  • database.html
  • View
  • Commits
  • Open Download .zip Download (2 KB)
<html>
<body>
<h2>The Database Schema</h2>
The <b>slowmilt</b> milter uses Berkeley DB 4.2, which is <i>not</i>
a relational database. Although two databases can be joined for bidirectional
lookups, that approach was not used for <b>slowmilt</b>.
<p>
The <b>slowmilt</b> milter uses a single database:
<ul>
	<li>The IP address database</li>
</ul>
The keys for the <b>IP address</b> database are IP addresses stored
in binary in standard network byte order.
<p><code><menu>
typedef unsigned long     PRIMARY_KEY;  /* IPv4 IP number in numeric binary */
</menu></code>
For version 3 of the database duplicate keys are allowed so all entries
are grouped by IP number keys.
<p>
The data for the database is a structure that looks like
this:
<p><code><pre><menu>
# 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];
} SECONDARY_DATUM;
</menu></pre></code>
The items in this datum structure (together) define a single event.
See the <a href="slowedit/events.html">standard event set</a> for a
description of what the items in this structure mean. Also see
<i>slow.h</i> in the source distribution to understand the ordering
of bits in <code>eventmap</code>.
<p>
The database
can be dumped to a file using the
<a href="slowedit/list.html">slowedit list</a> command, and that text
output can be later be fed back into the
<a href="slowedit/rebuild">slowedit rebuild</a> command
 to recreate the database.
</body>
</html>	
# Change User Description Committed
#3 4222 bryan_costales Massive rewrite to speed up the database writes.
Using a single database now with duplicate keys
where the keys are the IP numbers. Added a purge
command and removed the garbage command. Fixed
some leaking memory bugs and properly closed the
database in a few places were it was not
properly closed. Updated the docs to reflect
this and bumped both the database version and
release number. Running on a FreeBSD 3.x machine
and a Solaris 9 machine.
#2 4052 bryan_costales Implimented:
    whitelisting
    AddMXHost for MX servers that lie
    Converted to thread safe DNS routines
    garbage collection
    RunAsUser and RunAsGroup for root startups
    rebuild the database
    summarize by IP number
Finished all documentation.
Moved release from alpha to beta
#1 3998 bryan_costales Brought the whole distribution up to V0.9
Added a huge abount of documentation.
Added slowedit find
Created startup scripts to launch for testing
Fixed numerous bugs.
Fixed a few portablity issues.
Installed hooks for whitelisting and IP aliases.