summaryrefslogtreecommitdiff
path: root/include/dns.h
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-10-22 00:54:30 -0400
committerAdam <Adam@anope.org>2012-10-22 00:54:30 -0400
commit0b9db15efc322336ddb08671ce68a3d45fb22520 (patch)
tree2e8149f370c63f08f2f197eaa92b1b36e857b0e9 /include/dns.h
parentd5b2f9cfa78ed176ffe1d9f2923799fdd37217a5 (diff)
Add os_dns, a way to control your DNS zone via services
Diffstat (limited to 'include/dns.h')
-rw-r--r--include/dns.h31
1 files changed, 20 insertions, 11 deletions
diff --git a/include/dns.h b/include/dns.h
index 3102ec72c..062fed26f 100644
--- a/include/dns.h
+++ b/include/dns.h
@@ -95,7 +95,6 @@ struct CoreExport DNSQuery
DNSQuery();
DNSQuery(const Question &q);
- DNSQuery(const DNSPacket &p);
};
/** The request
@@ -124,7 +123,7 @@ class CoreExport DNSRequest : public Timer, public Question
void Tick(time_t) anope_override;
};
-/** A full packet sent or recieved to/from the nameserver, may contain multiple queries
+/** A full packet sent or recieved to/from the nameserver
*/
class DNSPacket : public DNSQuery
{
@@ -139,12 +138,14 @@ class DNSPacket : public DNSQuery
public:
static const int HEADER_LENGTH = 12;
- /* Our 16-bit id for this header */
+ /* Source or destination of the packet */
+ sockaddrs addr;
+ /* ID for this packet */
unsigned short id;
- /* Flags on the query */
+ /* Flags on the packet */
unsigned short flags;
- DNSPacket();
+ DNSPacket(const sockaddrs &a);
void Fill(const unsigned char *input, const unsigned short len);
unsigned short Pack(unsigned char *output, unsigned short output_size);
};
@@ -155,20 +156,19 @@ class CoreExport DNSManager : public Timer, public Socket
{
typedef std::multimap<Anope::string, ResourceRecord, ci::less> cache_map;
cache_map cache;
- sockaddrs addrs;
- public:
+
std::deque<DNSPacket *> packets;
+ public:
+ sockaddrs addrs;
std::map<unsigned short, DNSRequest *> requests;
- static const int DNSPort = 53;
-
DNSManager(const Anope::string &nameserver, int port);
~DNSManager();
- bool ProcessRead();
+ bool ProcessRead() anope_override;
- bool ProcessWrite();
+ bool ProcessWrite() anope_override;
/** Add a record to the dns cache
* @param r The record
@@ -189,6 +189,15 @@ class CoreExport DNSManager : public Timer, public Socket
*/
void Cleanup(Module *mod);
+ /** Get the list of packets pending to be sent
+ */
+ std::deque<DNSPacket *>& GetPackets();
+
+ /** Queues a packet for sending
+ * @param p The packet
+ */
+ void SendPacket(DNSPacket *p);
+
/** Does a BLOCKING DNS query and returns the first IP.
* Only use this if you know what you are doing. Unless you specifically
* need a blocking query use the DNSRequest system