static std::shared_ptr<DNSRecordContent> make(const DNSRecord &dr, PacketReader& pr); \
static std::shared_ptr<DNSRecordContent> make(const string& zonedata); \
string getZoneRepresentation(bool noDot=false) const override; \
- void toPacket(DNSPacketWriter& pw) override; \
- uint16_t getType() const override { return QType::RNAME; } \
+ void toPacket(DNSPacketWriter& pw) const override; \
+ uint16_t getType() const override { return QType::RNAME; } \
+ template<class Convertor> void xfrPacket(Convertor& conv, bool noDot=false) const; \
template<class Convertor> void xfrPacket(Convertor& conv, bool noDot=false);
class NAPTRRecordContent : public DNSRecordContent
public:
includeboilerplate(ALIAS)
+ [[nodiscard]] const DNSName& getContent() const
+ {
+ return d_content;
+ }
+private:
DNSName d_content;
};
#endif
public:
OPTRecordContent(){}
includeboilerplate(OPT)
- void getData(vector<pair<uint16_t, string> > &opts);
+ void getData(vector<pair<uint16_t, string> > &opts) const;
private:
string d_data;
};
DNSKEYRecordContent();
includeboilerplate(DNSKEY)
uint16_t getTag() const;
- uint16_t getTag();
uint16_t d_flags{0};
uint8_t d_protocol{0};
}
void fromPacket(PacketReader& pr);
- void toPacket(DNSPacketWriter& pw);
+ void toPacket(DNSPacketWriter& pw) const;
std::string getZoneRepresentation() const;
static constexpr size_t const nbTypes = 65536;
static std::shared_ptr<DNSRecordContent> make(const DNSRecord &dr, PacketReader& pr);
static std::shared_ptr<DNSRecordContent> make(const string& content);
string getZoneRepresentation(bool noDot=false) const override;
- void toPacket(DNSPacketWriter& pw) override;
+ void toPacket(DNSPacketWriter& pw) const override;
uint16_t getType() const override
{
return QType::NSEC;
static std::shared_ptr<DNSRecordContent> make(const DNSRecord &dr, PacketReader& pr);
static std::shared_ptr<DNSRecordContent> make(const string& content);
string getZoneRepresentation(bool noDot=false) const override;
- void toPacket(DNSPacketWriter& pw) override;
+ void toPacket(DNSPacketWriter& pw) const override;
uint8_t d_algorithm{0}, d_flags{0};
uint16_t d_iterations{0};
static std::shared_ptr<DNSRecordContent> make(const DNSRecord &dr, PacketReader& pr);
static std::shared_ptr<DNSRecordContent> make(const string& content);
string getZoneRepresentation(bool noDot=false) const override;
- void toPacket(DNSPacketWriter& pw) override;
+ void toPacket(DNSPacketWriter& pw) const override;
uint16_t getType() const override
{
static std::shared_ptr<DNSRecordContent> make(const DNSRecord &dr, PacketReader& pr);
static std::shared_ptr<DNSRecordContent> make(const string& content);
string getZoneRepresentation(bool noDot=false) const override;
- void toPacket(DNSPacketWriter& pw) override;
+ void toPacket(DNSPacketWriter& pw) const override;
uint16_t getType() const override
{
static std::shared_ptr<DNSRecordContent> make(const DNSRecord &dr, PacketReader& pr);
static std::shared_ptr<DNSRecordContent> make(const string& content);
string getZoneRepresentation(bool noDot=false) const override;
- void toPacket(DNSPacketWriter& pw) override;
+ void toPacket(DNSPacketWriter& pw) const override;
uint8_t d_version{0}, d_size{0}, d_horizpre{0}, d_vertpre{0};
uint32_t d_latitude{0}, d_longitude{0}, d_altitude{0};
static std::shared_ptr<DNSRecordContent> make(const DNSRecord &dr, PacketReader& pr);
static std::shared_ptr<DNSRecordContent> make(const string& zone); // FIXME400: DNSName& zone?
string getZoneRepresentation(bool noDot=false) const override;
- void toPacket(DNSPacketWriter& pw) override;
+ void toPacket(DNSPacketWriter& pw) const override;
uint16_t getType() const override { return QType::EUI48; }
private:
// storage for the bytes
static std::shared_ptr<DNSRecordContent> make(const DNSRecord &dr, PacketReader& pr);
static std::shared_ptr<DNSRecordContent> make(const string& zone); // FIXME400: DNSName& zone?
string getZoneRepresentation(bool noDot=false) const override;
- void toPacket(DNSPacketWriter& pw) override;
+ void toPacket(DNSPacketWriter& pw) const override;
uint16_t getType() const override { return QType::EUI64; }
private:
// storage for the bytes
return std::make_shared<RNAME##RecordContent>(zonedata); \
} \
\
-void RNAME##RecordContent::toPacket(DNSPacketWriter& pw) \
+void RNAME##RecordContent::toPacket(DNSPacketWriter& pw) const \
{ \
this->xfrPacket(pw); \
} \
CONV; \
if (conv.eof() == false) throw MOADNSException("When parsing " #RNAME " trailing data was not parsed: '" + conv.getRemaining() + "'"); \
} \
+template<class Convertor> \
+void RNAME##RecordContent::xfrPacket(Convertor& conv, bool /* noDot */) const \
+{ \
+ CONV; \
+ if (conv.eof() == false) throw MOADNSException("When parsing " #RNAME " trailing data was not parsed: '" + conv.getRemaining() + "'"); \
+} \
struct EDNSOpts
{