2018-12-03 22:22:59 +00:00
|
|
|
#ifndef LLARP_DNS_QUESTION_HPP
|
|
|
|
#define LLARP_DNS_QUESTION_HPP
|
2018-12-12 02:52:51 +00:00
|
|
|
|
2018-12-12 00:58:08 +00:00
|
|
|
#include <dns/serialize.hpp>
|
|
|
|
#include <dns/name.hpp>
|
2019-01-11 01:42:02 +00:00
|
|
|
#include <net/net_int.hpp>
|
2018-12-03 22:22:59 +00:00
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace dns
|
|
|
|
{
|
2018-12-04 16:16:43 +00:00
|
|
|
using QType_t = uint16_t;
|
|
|
|
using QClass_t = uint16_t;
|
2018-12-03 22:22:59 +00:00
|
|
|
|
|
|
|
struct Question : public Serialize
|
|
|
|
{
|
2018-12-04 16:16:43 +00:00
|
|
|
Question() = default;
|
|
|
|
Question(Question&& other);
|
|
|
|
Question(const Question& other);
|
2018-12-03 22:22:59 +00:00
|
|
|
bool
|
|
|
|
Encode(llarp_buffer_t* buf) const override;
|
|
|
|
|
|
|
|
bool
|
|
|
|
Decode(llarp_buffer_t* buf) override;
|
|
|
|
|
2018-12-04 16:16:43 +00:00
|
|
|
bool
|
|
|
|
operator==(const Question& other) const
|
|
|
|
{
|
|
|
|
return qname == other.qname && qtype == other.qtype
|
|
|
|
&& qclass == other.qclass;
|
|
|
|
}
|
|
|
|
|
|
|
|
friend std::ostream&
|
|
|
|
operator<<(std::ostream& out, const Question& q)
|
|
|
|
{
|
|
|
|
return out << "qname=" << q.qname << " qtype=" << (int)q.qtype
|
|
|
|
<< " qclass=" << (int)q.qclass;
|
|
|
|
}
|
|
|
|
|
2018-12-03 22:22:59 +00:00
|
|
|
Name_t qname;
|
|
|
|
QType_t qtype;
|
|
|
|
QClass_t qclass;
|
|
|
|
};
|
|
|
|
} // namespace dns
|
|
|
|
} // namespace llarp
|
|
|
|
|
|
|
|
#endif
|