Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

XmlDnsblCache.h

Go to the documentation of this file.
00001 #ifndef XMLDNSBLCACHE_H
00002 #define XMLDNSBLCACHE_H
00003 
00004 #include <abuse/DnsblCache.h>
00005 #include <map>
00006 #include <ctime>
00007 #include <stdexcept>
00008 #include "msxml.h"
00009 
00010 class XmlDnsblCache: public DnsblCache
00011 {
00012 public:
00013         XmlDnsblCache(const std::string& path,const std::string& dnsblname="");
00014         ~XmlDnsblCache();
00015         void setValidity(int hours);
00016         int getValidity()const;
00017         Result get(const Url& what,std::string* comments=NULL)const throw(cache_miss);
00018         void put(const Url& what,Result entry,const std::string* comments=NULL);
00019         void save(const std::string& name="")throw(std::runtime_error);
00020 private:
00021         struct Entry
00022         {
00023                 time_t time;
00024                 Result result;
00025                 std::string comments;
00026         };
00027         typedef std::map<Url,Entry> CacheMap;
00028         CacheMap m_map;
00029         int m_validity;
00030         time_t m_lastvalid;
00031         std::string m_name;
00032         std::string m_dnsblName;
00033         static const int DEFAULT_VALIDITY;
00034         std::string writeDateTime(time_t time)const;
00035         time_t readDateTime(const std::string& fmt)const;
00036 
00037 };
00038 
00039 #endif

Generated on Thu Jun 16 00:13:24 2005 for Abuse! by  doxygen 1.4.3