From 2caf5868d010f74b14214da6a003f0753b82d74d Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 3 Jul 2011 00:19:54 -0400 Subject: Clean up some of the dns code, udp is connectionless anyway so this isnt required --- include/dns.h | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'include') diff --git a/include/dns.h b/include/dns.h index cb6d6b5c7..8a84bdd47 100644 --- a/include/dns.h +++ b/include/dns.h @@ -137,44 +137,26 @@ struct CoreExport DNSRecord operator bool() const; }; -/** The socket used to talk to the nameserver, uses UDP - */ -class DNSSocket : public ConnectionSocket -{ - private: - int SendTo(const unsigned char *buf, size_t len) const; - int RecvFrom(char *buf, size_t size, sockaddrs &addrs) const; - - public: - DNSSocket(); - virtual ~DNSSocket(); - - bool ProcessRead(); - - bool ProcessWrite(); - - void OnConnect(); - - void OnError(const Anope::string &error); -}; - /** DNS manager, manages the connection and all requests */ -class CoreExport DNSManager : public Timer +class CoreExport DNSManager : public Timer, public Socket { std::multimap cache; + sockaddrs addrs; public: - DNSSocket *sock; - std::deque packets; std::map requests; static const int DNSPort = 53; - DNSManager(); + DNSManager(const Anope::string &nameserver, int port); ~DNSManager(); + bool ProcessRead(); + + bool ProcessWrite(); + void AddCache(DNSRecord *rr); bool CheckCache(DNSRequest *request); void Tick(time_t now); -- cgit