407 {
408 const auto size = buffer.size();
409 if (size < DnsHeader::SIZE + DnsQuestion::MIN_SIZE || size >
MAX_SIZE) {
410 return boost::none;
411 }
412
413 DnsMessage res;
415
416 if (res.header.qdcount > 1 || res.header.ancount >
MAX_ANS) {
417 return boost::none;
418 }
419
421 if (res.header.qdcount == 1) {
423 }
424
425 for (unsigned i = 0; i < res.header.rrcount(); i++) {
426 size_t dataoffset = 0;
428 if (!rr) {
429 return boost::none;
430 }
431 else {
432 res.parse_rr(buffer, std::move(*rr), dataoffset, txt_keys);
433 }
434 }
435
436 return std::move(res);
437 }
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, ClipperLib::JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:416
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183
static optional< DnsQuestion > decode(const std::vector< char > &buffer, size_t &offset)
Definition Bonjour.cpp:166
static optional< DnsResource > decode(const std::vector< char > &buffer, size_t &offset, size_t &dataoffset)
Definition Bonjour.cpp:198