summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-04-27 20:02:01 +0200
committerAttila Molnar <attilamolnar@hush.com>2015-04-27 20:02:01 +0200
commitbd1471bc08be28bc2554d35fdaeb078338b14266 (patch)
tree6d50a886a9fcce5e78138b69695220aab0af6da1 /include
parent8f5efbc7aa33b792e02d01e3288f553e6e98ccaa (diff)
parent3d32852e7e459d403179e8f79354e2e52bbc4a52 (diff)
Merge branch 'master+dns'
Diffstat (limited to 'include')
-rw-r--r--include/modules/dns.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/include/modules/dns.h b/include/modules/dns.h
index 400d2085d..cfa048184 100644
--- a/include/modules/dns.h
+++ b/include/modules/dns.h
@@ -68,6 +68,8 @@ namespace DNS
ERROR_INVALIDTYPE
};
+ typedef uint16_t RequestId;
+
const int PORT = 53;
/**
@@ -86,11 +88,11 @@ namespace DNS
{
std::string name;
QueryType type;
- unsigned short qclass;
- Question() : type(QUERY_NONE), qclass(0) { }
- Question(const std::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; }
+ Question() : type(QUERY_NONE) { }
+ Question(const std::string& n, QueryType t) : name(n), type(t) { }
+ bool operator==(const Question& other) const { return ((name == other.name) && (type == other.type)); }
+ bool operator!=(const Question& other) const { return (!(*this == other)); }
struct hash
{
@@ -107,19 +109,19 @@ namespace DNS
std::string rdata;
time_t created;
- ResourceRecord(const std::string& n, QueryType t, unsigned short c = 1) : Question(n, t, c), ttl(0), created(ServerInstance->Time()) { }
+ ResourceRecord(const std::string& n, QueryType t) : Question(n, t), ttl(0), created(ServerInstance->Time()) { }
ResourceRecord(const Question& question) : Question(question), ttl(0), created(ServerInstance->Time()) { }
};
struct Query
{
- std::vector<Question> questions;
+ Question question;
std::vector<ResourceRecord> answers;
Error error;
bool cached;
Query() : error(ERROR_NONE), cached(false) { }
- Query(const Question& question) : error(ERROR_NONE), cached(false) { questions.push_back(question); }
+ Query(const Question& q) : question(q), error(ERROR_NONE), cached(false) { }
};
class ReplySocket;
@@ -147,7 +149,7 @@ namespace DNS
/* Use result cache if available */
bool use_cache;
/* Request id */
- unsigned short id;
+ RequestId id;
/* Creator of this request */
Module* const creator;