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

WhoisBasedAbuseAddiesCache.h

Go to the documentation of this file.
00001 #ifndef WHOISBASEDABUSEADDIESCACHE_H
00002 #define WHOISBASEDABUSEADDIESCACHE_H
00003 
00004 #include <abuse/Url.h>
00005 #include <abuse/AbuseAddiesCache.h>
00006 
00007 
00008 /*
00009 This class implements AbuseAddiesCache interface.
00010 It queries an external whois server which maps ip addresses to abuse addresses.
00011 NB: That is *not* what whois.abuse.net is actually doing, since whois.abuse.net
00012 maps *domains* to abuse addresses
00013 
00014 you may wonder why the ctor first arg is a std::string& and not an Url. Well, if 
00015 it was an url, you cannot create an object unless you were online, or it wouldn't
00016 resolve (no dns available), and the class Url would throw an exception. Since the 
00017 abuse cache is constructed in the bootstrap of the program, this will kill the app
00018 at its very startup.
00019 */
00020 
00021 class WhoisBasedAbuseAddiesCache: public AbuseAddiesCache
00022 {
00023 public:
00024         WhoisBasedAbuseAddiesCache(const std::string& host, int port=43);
00025         virtual ~WhoisBasedAbuseAddiesCache();
00026         //AbuseAddiesCache interface
00027         virtual std::list<std::string> query(const Url& url)const throw(std::runtime_error);
00028         virtual std::list<std::string> query(const std::string& doman)const throw(std::runtime_error);
00029         //there's no need to implement this
00030         //virtual void add(const UrlRange& range,const std::list<std::string>& addies){}
00031 private:
00032         static std::list<std::string> extractMail(const std::string& fromWhere)throw(NotFoundException);
00033         std::string m_host;
00034         int m_port;
00035 };
00036 
00037 #endif // WHOISBASEDABUSEADDIESCACHE_H

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