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(); }
42 auto begin() const { return bfr_
.data(); }
43 auto end() const { return bfr_
.data() + bfr_
.size(); }
53 inline auto begin(message
const& pkt
) { return pkt
.begin(); }
54 inline auto end (message
const& pkt
) { return pkt
.end(); }
55 inline auto size (message
const& pkt
) { return pkt
.size(); }
58 size_t min_message_sz();
61 create_question(char const* name
, DNS::RR_type type
, uint16_t cls
, uint16_t id
);
63 void check_answer(bool& nx_domain
,
64 bool& bogus_or_indeterminate
,
66 uint16_t& extended_rcode
,
70 message
const& question
,
71 message
const& answer
,
75 RR_collection
get_records(message
const& pkt
, bool& bogus_or_indeterminate
);
79 #endif // DNS_MESSAGE_DOT_HPP