diff src/context.h @ 249:15bf4f68a0b2

Add dnswl support
author Carl Byington <carl@five-ten-sg.com>
date Sun, 08 Apr 2012 11:42:59 -0700
parents d8ee4c97b9ab
children d6d5c50b9278
line wrap: on
line diff
--- a/src/context.h	Fri Jan 06 22:07:45 2012 -0800
+++ b/src/context.h	Sun Apr 08 11:42:59 2012 -0700
@@ -15,6 +15,7 @@
              reject};       // rejected by a dns list
 
 class DNSBL;
+class DNSWL;
 class CONTEXT;
 class VERIFY;
 class SMTP;
@@ -27,11 +28,14 @@
 typedef set<int32_t>                            int32_t_set;
 typedef list<SMTP *>                            smtp_list;
 typedef DNSBL *                                 DNSBLP;
+typedef DNSWL *                                 DNSWLP;
 typedef VERIFY *                                VERIFYP;
 typedef WHITELISTER *                           WHITELISTERP;
 typedef DELAYWHITE *                            DELAYWHITEP;
 typedef list<DNSBLP>                            dnsblp_list;
 typedef map<const char *, DNSBLP, ltstr>        dnsblp_map;
+typedef list<DNSWLP>                            dnswlp_list;
+typedef map<const char *, DNSWLP, ltstr>        dnswlp_map;
 typedef CONTEXT *                               CONTEXTP;
 typedef list<CONTEXTP>                          context_list;
 typedef map<const char *, CONTEXTP, ltstr>      context_map;
@@ -126,6 +130,14 @@
     bool operator==(const DNSBL &rhs);
 };
 
+struct DNSWL {
+    const char    *name;    // nickname for this dns based list
+    const char    *suffix;  // whitelist suffix like list.dnswl.org
+    int            level;   // matches 127.0.x.y where y >= level
+    DNSWL(const char *n, const char *s, const int l);
+    bool operator==(const DNSWL &rhs);
+};
+
 class CONTEXT {
     CONTEXTP        parent;
     const char *    name;
@@ -163,6 +175,8 @@
     int             dcc_bulk_threshold; // off = 0, many = 1000
     dnsblp_map      dnsbl_names;        // name to dnsbl mapping for lists that are available in this context and children
     dnsblp_list     dnsbl_list;         // list of dnsbls to be used in this context
+    dnswlp_map      dnswl_names;        // name to dnswl mapping for lists that are available in this context and children
+    dnswlp_list     dnswl_list;         // list of dnswls to be used in this context
     int             default_rcpt_rate;  // if not specified per user
     rcpt_rates      rcpt_per_hour;      // per user limits on number of recipients per hour
 
@@ -221,6 +235,10 @@
     void        add_dnsbl(DNSBLP dns)                       {dnsbl_list.push_back(dns);};
     DNSBLP      find_dnsbl(const char *name);
 
+    void        add_dnswl(const char *name, DNSWLP dns)     {dnswl_names[name] = dns;  };
+    void        add_dnswl(DNSWLP dns)                       {dnswl_list.push_back(dns);};
+    DNSWLP      find_dnswl(const char *name);
+
     bool        set_white(const char *regx);
     bool        white_match(const char *from);
 
@@ -247,6 +265,7 @@
     string_set&     get_content_cctlds();
     string_set&     get_html_tags();
     dnsblp_list&    get_dnsbl_list();
+    dnswlp_list&    get_dnswl_list();
 
     bool        acceptable_content(recorder &memory, int score, int bulk, string& msg);
     bool        ignore_host(const char *host);
@@ -288,6 +307,8 @@
 extern const char *token_default;
 extern const char *token_dnsbl;
 extern const char *token_dnsbll;
+extern const char *token_dnswl;
+extern const char *token_dnswll;
 extern const char *token_envfrom;
 extern const char *token_envto;
 extern const char *token_filter;