1 #ifndef DNS_MESSAGE_DOT_HPP
2 #define DNS_MESSAGE_DOT_HPP
9 #include "iobuffer.hpp"
11 #include <glog/logging.h>
14 auto constexpr max_udp_sz
{uint16_t(4 * 1024)};
21 using octet
= unsigned char;
23 using container_t
= iobuffer
<octet
>;
27 explicit message(container_t::size_type sz
)
30 CHECK_LE(sz
, std::numeric_limits
<uint16_t>::max());
33 explicit message(container_t
&& bfr
)
34 : bfr_
{std::move(bfr
)}
36 CHECK_LE(size(), std::numeric_limits
<uint16_t>::max());
39 uint16_t size() const { return bfr_
.size(); }
41 auto begin() const { return bfr_
.data(); }
42 auto end() const { return bfr_
.data() + bfr_
.size(); }
50 inline auto begin(message
const& pkt
) { return pkt
.begin(); }
51 inline auto end(message
const& pkt
) { return pkt
.end(); }
52 inline auto size(message
const& pkt
) { return pkt
.size(); }
57 create_question(char const* name
, DNS::RR_type type
, uint16_t cls
, uint16_t id
);
59 void check_answer(bool& nx_domain
,
60 bool& bogus_or_indeterminate
,
62 uint16_t& extended_rcode
,
65 message
const& question
,
66 message
const& answer
,
70 RR_collection
get_records(message
const& pkt
, bool& bogus_or_indeterminate
);
74 #endif // DNS_MESSAGE_DOT_HPP