bool isPartOf(const DNSName& rhs) const; //!< Are we part of the rhs name? Note that name.isPartOf(name).
inline bool operator==(const DNSName& rhs) const; //!< DNS-native comparison (case insensitive) - empty compares to empty
bool operator!=(const DNSName& other) const { return !(*this == other); }
- bool matches(const std::string_view& wire_uncompressed) const; // DNS-native (case insensitive) comparison against raw data in wire format
+ // !< DNS-native (case insensitive) comparison against raw data in wire format. The view has to start with the DNS name, but does not have to contain only a DNS name. For example passing a view of a DNS packet starting just after the DNS header is OK.
+ bool matches(const std::string_view& wire_uncompressed) const;
std::string toString(const std::string& separator=".", const bool trailing=true) const; //!< Our human-friendly, escaped, representation
void toString(std::string& output, const std::string& separator=".", const bool trailing=true) const;
const std::string_view raw(reinterpret_cast<const char*>(query.data()) + sizeof(dnsheader), query.size() - sizeof(dnsheader));
BOOST_CHECK(aroot.matches(raw));
- DNSName differentCase("A.RooT-Servers.NET");
+ const DNSName differentCase("A.RooT-Servers.NET");
BOOST_CHECK(differentCase.matches(raw));
const DNSName broot("b.root-servers.net");