string getText(bool multi, bool lenField);
string getUnquotedText(bool lenField);
-
+ /* Whether the current position is at (or after, which would indicate a problem
+ and should have been detected earlier) the end of wire data corresponding to
+ the current DNS record */
bool eof() const
{
return d_pos >= (d_startrecordpos + d_recordlen);
}
- const string getRemaining() const {
+ /* Returns a string, formatted for human/log consumption, containing information
+ about the wire data from the current position to the end of the current DNS record */
+ std::string getRemaining() const {
return "Remaining data from PacketReader, current position " + std::to_string(d_pos) + " in packet of size " + std::to_string(d_content.size()) + ", end of record expected at " + std::to_string(d_startrecordpos + d_recordlen) + ": " + makeHexDump(std::string(d_content.begin() + d_pos, d_content.begin() + d_startrecordpos + d_recordlen));
};
+#if defined(PDNS_AUTH) // [
+ /* This method moves the position to the end of the current DNS record.
+ The only case where it makes sense to call this method is when processing ENT
+ records, and only because of a bug in the authoritative server used to insert
+ non-empty content for some ENT records (see https://github.com/PowerDNS/pdns/pull/17000)
+ */
+ void consumeRemaining()
+ {
+ d_pos = (d_startrecordpos + d_recordlen);
+ }
+#endif // ]
+
uint16_t getPosition() const
{
return d_pos;
#ifdef HAVE_LUA_RECORDS
boilerplate_conv(LUA, conv.xfrType(d_type); conv.xfrText(d_code, true));
#endif
+#if defined(PDNS_AUTH) // [
+/* Move the position to the end of the current DNS record,
+ because of a bug in the authoritative server used to insert
+ non-empty content for some ENT records (see https://github.com/PowerDNS/pdns/pull/17000)
+*/
+boilerplate_conv(ENT, conv.consumeRemaining());
+#else
boilerplate_conv(ENT, );
+#endif // ]
boilerplate_conv(SPF, conv.xfrText(d_text, true));
boilerplate_conv(HINFO, conv.xfrText(d_cpu); conv.xfrText(d_host));
{
return d_content;
}
- bool eof() { return true; } // we don't know how long the record should be
+ bool eof() const { return true; } // we don't know how long the record should be
- const string getRemaining() const {
+ std::string getRemaining() const {
return "";
}
+#if defined(PDNS_AUTH) // [
+ /* This method is only there for parity with DNSParser::consumeRemaining(),
+ see the comment there to know why it is needed.
+ */
+ void consumeRemaining() const
+ {
+ }
+#endif // ]
+
size_t getSizeWithOpts(const optvect_t& options) const;
private:
val.sin4.sin_port = port;
}
-bool RecordTextReader::eof()
+bool RecordTextReader::eof() const
{
return d_pos==d_end;
}
void xfrRFC1035CharString(string &val);
void xfrSVCBValueList(vector<string> &val);
- const string getRemaining() const {
+ std::string getRemaining() const {
return d_string.substr(d_pos);
}
+ bool eof() const;
+
+#if defined(PDNS_AUTH) // [
+ /* This method is only there for parity with DNSParser::consumeRemaining(),
+ see the comment there to know why it is needed.
+ */
+ void consumeRemaining() const
+ {
+ }
+#endif // ]
- bool eof();
private:
string d_string;
ZoneName d_zone;
void xfrBlob(const string& val, int len=-1);
void xfrHexBlob(const string& val, bool keepReading=false);
void xfrSvcParamKeyVals(const set<SvcParam>& val);
- bool eof() { return true; };
-
void xfrSVCBValueList(const vector<string> &val);
- const string getRemaining() const {
+ bool eof() const { return true; };
+
+ std::string getRemaining() const {
return "";
}
+
+ #if defined(PDNS_AUTH) // [
+ /* This method is only there for parity with DNSParser::consumeRemaining(),
+ see the comment there to know why it is needed.
+ */
+ void consumeRemaining() const
+ {
+ }
+#endif // ]
private:
string& d_string;
bool d_nodot;