320 {
321 const size_t size = rr.data.size();
322 if (size < 2) {
323 return boost::none;
324 }
325
326 DnsRR_TXT res;
327
328 for (auto it = rr.data.begin(); it != rr.data.end(); ) {
329 unsigned val_size = static_cast<unsigned char>(*it);
330 if (val_size == 0 || it + val_size >= rr.data.end()) {
331 return boost::none;
332 }
333 ++it;
334
335 const auto it_end = it + val_size;
336 const auto it_eq = std::find(it, it_end, '=');
337 if (it_eq > it && it_eq < it_end - 1) {
338 std::string key(it_eq - it, ' ');
339 std::copy(it, it_eq, key.begin());
340
341 if (txt_keys.find(key) != txt_keys.end() || key == "path") {
342
343 std::string value(it_end - it_eq - 1, ' ');
344 std::copy(it_eq + 1, it_end, value.begin());
345 res.data.insert(std::make_pair(std::move(key), std::move(value)));
346 }
347 }
348
349 it = it_end;
350 }
351
352 return std::move(res);
353 }
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183