summaryrefslogtreecommitdiffstats
path: root/dnsname.hh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 21:14:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 21:14:51 +0000
commitbc282425088455198a7a99511c75914477d4ed32 (patch)
tree1b1fb887a634136a093deea7e4dd95d054201e7a /dnsname.hh
parentReleasing progress-linux version 1.8.3-3~progress7.99u1. (diff)
downloaddnsdist-bc282425088455198a7a99511c75914477d4ed32.tar.xz
dnsdist-bc282425088455198a7a99511c75914477d4ed32.zip
Merging upstream version 1.9.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dnsname.hh')
-rw-r--r--dnsname.hh13
1 files changed, 7 insertions, 6 deletions
diff --git a/dnsname.hh b/dnsname.hh
index 29c8325..0d9112b 100644
--- a/dnsname.hh
+++ b/dnsname.hh
@@ -57,6 +57,7 @@ inline unsigned char dns_tolower(unsigned char c)
}
#include "burtle.hh"
+#include "views.hh"
// #include "dns.hh"
// #include "logger.hh"
@@ -80,7 +81,7 @@ class DNSName
public:
static const size_t s_maxDNSNameLength = 255;
- DNSName() {} //!< Constructs an *empty* DNSName, NOT the root!
+ DNSName() = default; //!< Constructs an *empty* DNSName, NOT the root!
// Work around assertion in some boost versions that do not like self-assignment of boost::container::string
DNSName& operator=(const DNSName& rhs)
{
@@ -89,7 +90,7 @@ public:
}
return *this;
}
- DNSName& operator=(DNSName&& rhs)
+ DNSName& operator=(DNSName&& rhs) noexcept
{
if (this != &rhs) {
d_storage = std::move(rhs.d_storage);
@@ -100,7 +101,7 @@ public:
DNSName(DNSName&& a) = default;
explicit DNSName(std::string_view sw); //!< Constructs from a human formatted, escaped presentation
- DNSName(const char* p, int len, int offset, bool uncompress, uint16_t* qtype=nullptr, uint16_t* qclass=nullptr, unsigned int* consumed=nullptr, uint16_t minOffset=0); //!< Construct from a DNS Packet, taking the first question if offset=12. If supplied, consumed is set to the number of bytes consumed from the packet, which will not be equal to the wire length of the resulting name in case of compression.
+ DNSName(const char* p, size_t len, size_t offset, bool uncompress, uint16_t* qtype = nullptr, uint16_t* qclass = nullptr, unsigned int* consumed = nullptr, uint16_t minOffset = 0); //!< Construct from a DNS Packet, taking the first question if offset=12. If supplied, consumed is set to the number of bytes consumed from the packet, which will not be equal to the wire length of the resulting name in case of compression.
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
@@ -216,7 +217,8 @@ public:
private:
string_t d_storage;
- void packetParser(const char* p, int len, int offset, bool uncompress, uint16_t* qtype, uint16_t* qclass, unsigned int* consumed, int depth, uint16_t minOffset);
+ void packetParser(const char* qpos, size_t len, size_t offset, bool uncompress, uint16_t* qtype, uint16_t* qclass, unsigned int* consumed, int depth, uint16_t minOffset);
+ size_t parsePacketUncompressed(const pdns::views::UnsignedCharView& view, size_t position, bool uncompress);
static void appendEscapedLabel(std::string& appendTo, const char* orig, size_t len);
static std::string unescapeLabel(const std::string& orig);
static void throwSafeRangeError(const std::string& msg, const char* buf, size_t length);
@@ -561,8 +563,7 @@ private:
struct SuffixMatchNode
{
public:
- SuffixMatchNode()
- {}
+ SuffixMatchNode() = default;
SuffixMatchTree<bool> d_tree;
void add(const DNSName& dnsname)