From: Bert Hubert Date: Thu, 13 May 2010 11:06:49 +0000 (+0000) Subject: nsec3param work X-Git-Tag: rec-3.3~91 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=827634f07f08a340227118ea66cd35e7cfb5411b;p=thirdparty%2Fpdns.git nsec3param work git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1611 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index 0369b845c0..2efb6fc96e 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -378,7 +378,16 @@ private: class NSEC3PARAMRecordContent : public DNSRecordContent { public: - includeboilerplate(NSEC3PARAM) + static void report(void); + NSEC3PARAMRecordContent() : DNSRecordContent(51) + {} + NSEC3PARAMRecordContent(const string& content, const string& zone=""); + + static DNSRecordContent* make(const DNSRecord &dr, PacketReader& pr); + static DNSRecordContent* make(const string& content); + string getZoneRepresentation() const; + void toPacket(DNSPacketWriter& pw); + uint8_t d_algorithm, d_flags; uint16_t d_iterations; diff --git a/pdns/nsecrecords.cc b/pdns/nsecrecords.cc index 1a3e59e9c3..98b9d874d8 100644 --- a/pdns/nsecrecords.cc +++ b/pdns/nsecrecords.cc @@ -181,7 +181,7 @@ NSEC3RecordContent::DNSRecordContent* NSEC3RecordContent::make(const DNSRecord & uint8_t val=bitmap[2+n]; for(int bit = 0; bit < 8 ; ++bit , val>>=1) if(val & 1) { - ret->d_set.insert((7-bit) + 8*(n)); + ret->d_set.insert((7-bit) + 8*(n)); } } @@ -208,10 +208,55 @@ string NSEC3RecordContent::getZoneRepresentation() const } -boilerplate_conv(NSEC3PARAM, 51, - conv.xfr8BitInt(d_algorithm); - conv.xfr8BitInt(d_flags); - conv.xfr16BitInt(d_iterations); - conv.xfr8BitInt(d_saltlength); - conv.xfrHexBlob(d_salt); - ) +void NSEC3PARAMRecordContent::report(void) +{ + regist(1, 51, &make, &make, "NSEC3PARAM"); +} + +DNSRecordContent* NSEC3PARAMRecordContent::make(const string& content) +{ + return new NSEC3PARAMRecordContent(content); +} + +NSEC3PARAMRecordContent::NSEC3PARAMRecordContent(const string& content, const string& zone) : DNSRecordContent(51) +{ + RecordTextReader rtr(content, zone); + rtr.xfr8BitInt(d_algorithm); + rtr.xfr8BitInt(d_flags); + rtr.xfr16BitInt(d_iterations); + rtr.xfrHexBlob(d_salt); +} + +void NSEC3PARAMRecordContent::toPacket(DNSPacketWriter& pw) +{ + pw.xfr8BitInt(d_algorithm); + pw.xfr8BitInt(d_flags); + pw.xfr16BitInt(d_iterations); + pw.xfr8BitInt(d_salt.length()); + cerr<<"salt: '"<d_algorithm); + pr.xfr8BitInt(ret->d_flags); + pr.xfr16BitInt(ret->d_iterations); + pr.xfr8BitInt(ret->d_saltlength); + pr.xfrHexBlob(ret->d_salt); + + return ret; +} + +string NSEC3PARAMRecordContent::getZoneRepresentation() const +{ + string ret; + RecordTextWriter rtw(ret); + rtw.xfr8BitInt(d_algorithm); + rtw.xfr8BitInt(d_flags); + rtw.xfr16BitInt(d_iterations); + rtw.xfrHexBlob(d_salt); + return ret; +} +