summaryrefslogtreecommitdiff
path: root/include/modules/dns.h
diff options
context:
space:
mode:
authorRobby <robby@chatbelgie.be>2016-01-28 20:24:49 +0100
committerRobby <robby@chatbelgie.be>2016-01-28 20:24:49 +0100
commitf118960a25dd1f482e77586b7853107692d31ec9 (patch)
treec9f232bfeee7a8bc35a4ff5aabfa93969ce3fbef /include/modules/dns.h
parent5d6a71b6d2dc72d95e188c5b1a5bfb7527bd38cd (diff)
Update copyright to 2016. This was done with:
find include/ src/ lang/ docs/ modules/ *.* Config -exec sed -i 's/-20.. Anope Team/-2014 Anope Team/i' {} \; Added missing copyright headers to files that didn't have it yet. Fixed some whitespace and blank lines along the way.
Diffstat (limited to 'include/modules/dns.h')
-rw-r--r--include/modules/dns.h35
1 files changed, 16 insertions, 19 deletions
diff --git a/include/modules/dns.h b/include/modules/dns.h
index 37af05cc9..646691cb1 100644
--- a/include/modules/dns.h
+++ b/include/modules/dns.h
@@ -1,15 +1,14 @@
/*
*
- * (C) 2003-2014 Anope Team
+ * (C) 2003-2016 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
- *
*/
-
+
#ifndef DNS_H
#define DNS_H
@@ -53,7 +52,7 @@ namespace DNS
QUERYFLAGS_Z = 0x70,
QUERYFLAGS_RCODE = 0xF
};
-
+
enum Error
{
ERROR_NONE,
@@ -70,13 +69,13 @@ namespace DNS
ERROR_NO_RECORDS,
ERROR_INVALIDTYPE
};
-
+
struct Question
{
Anope::string name;
QueryType type;
unsigned short qclass;
-
+
Question() : type(QUERY_NONE), qclass(0) { }
Question(const Anope::string &n, QueryType t, unsigned short c = 1) : name(n), type(t), qclass(c) { }
inline bool operator==(const Question & other) const { return name == other.name && type == other.type && qclass == other.qclass; }
@@ -89,7 +88,7 @@ namespace DNS
}
};
};
-
+
struct ResourceRecord : Question
{
unsigned int ttl;
@@ -99,7 +98,7 @@ namespace DNS
ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), ttl(0), created(Anope::CurTime) { }
ResourceRecord(const Question &q) : Question(q), ttl(0), created(Anope::CurTime) { }
};
-
+
struct Query
{
std::vector<Question> questions;
@@ -123,14 +122,14 @@ namespace DNS
virtual void Process(Request *req) = 0;
virtual void RemoveRequest(Request *req) = 0;
-
+
virtual bool HandlePacket(ReplySocket *s, const unsigned char *const data, int len, sockaddrs *from) = 0;
-
+
virtual void UpdateSerial() = 0;
virtual void Notify(const Anope::string &zone) = 0;
virtual uint32_t GetSerial() const = 0;
};
-
+
/** A DNS query.
*/
class Request : public Timer, public Question
@@ -146,22 +145,22 @@ namespace DNS
Request(Manager *mgr, Module *c, const Anope::string &addr, QueryType qt, bool cache = false) : Timer(0), Question(addr, qt), manager(mgr),
use_cache(cache), id(0), creator(c) { }
-
+
virtual ~Request()
{
manager->RemoveRequest(this);
}
-
+
/** Called when this request succeeds
* @param r The query sent back from the nameserver
*/
virtual void OnLookupComplete(const Query *r) = 0;
-
+
/** Called when this request fails or times out.
* @param r The query sent back from the nameserver, check the error code.
*/
virtual void OnError(const Query *r) { }
-
+
/** Used to time out the query, xalls OnError and lets the TimerManager
* delete this request.
*/
@@ -173,9 +172,7 @@ namespace DNS
this->OnError(&rr);
}
};
-
+
} // namespace DNS
-
+
#endif // DNS_H
-
-