summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-07-03 00:19:54 -0400
committerAdam <Adam@anope.org>2011-07-03 00:19:54 -0400
commit2caf5868d010f74b14214da6a003f0753b82d74d (patch)
tree506641b404784297654ee8070f7bff70f2e4afad /include
parentc585964e608414488378ca2c5869e8d258997e8d (diff)
Clean up some of the dns code, udp is connectionless anyway so this isnt required
Diffstat (limited to 'include')
-rw-r--r--include/dns.h32
1 files changed, 7 insertions, 25 deletions
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<Anope::string, DNSRecord *> cache;
+ sockaddrs addrs;
public:
- DNSSocket *sock;
-
std::deque<DNSPacket *> packets;
std::map<short, DNSRequest *> 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);