ERROR_INVALIDTYPE
};
+ typedef uint16_t RequestId;
+
const int PORT = 53;
/**
{
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)); }
struct hash
{
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()) { }
};
/* Use result cache if available */
bool use_cache;
/* Request id */
- unsigned short id;
+ RequestId id;
/* Creator of this request */
Module* const creator;
Request(Manager* mgr, Module* mod, const std::string& addr, QueryType qt, bool usecache = true)
- : Timer((ServerInstance->Config->dns_timeout ? ServerInstance->Config->dns_timeout : 5), ServerInstance->Time())
+ : Timer((ServerInstance->Config->dns_timeout ? ServerInstance->Config->dns_timeout : 5))
, Question(addr, qt)
, manager(mgr)
, use_cache(usecache)
, id(0)
, creator(mod)
{
- ServerInstance->Timers->AddTimer(this);
+ ServerInstance->Timers.AddTimer(this);
}
virtual ~Request()
Query rr(*this);
rr.error = ERROR_TIMEDOUT;
this->OnError(&rr);
+ delete this;
return false;
}
};