RRset::~RRset() {}
+unsigned int
+RRset::getSIGRdataCount() const {
+ if (rrsig_ != NULL) {
+ return (rrsig_->getRdataCount());
+ } else {
+ return (0);
+ }
+}
+
namespace {
class BasicRdataIterator : public RdataIterator {
private:
virtual ~RRset();
+ /// \brief Returns the number of \c RRSIG records associated with
+ /// the \c RRset.
+ ///
+ /// Note that an \c RRset with no RRSIG records may exist, so this
+ /// method may return 0.
+ ///
+ /// \return The number of \c RRSIG records associated.
+ unsigned int getSIGRdataCount() const;
+
/// \brief Updates the owner name of the \c RRset, including RRSIGs if any
virtual void setName(const Name& n) {
BasicRRset::setName(n);
rrset_a->addRRsig(rrset_rrsig);
EXPECT_EQ(3, sp->getRdataCount());
}
+
+TEST_F(RRsetRRSIGTest, getSIGRdataCount) {
+ EXPECT_EQ(1, rrset_aaaa->getSIGRdataCount());
+ EXPECT_EQ(0, rrset_a->getSIGRdataCount());
+
+ rrset_rrsig = RRsetPtr(new RRset(test_name, RRClass::IN(),
+ RRType::RRSIG(), RRTTL(3600)));
+ // one signature algorithm (5 = RSA/SHA-1)
+ rrset_rrsig->addRdata(generic::RRSIG("A 5 3 3600 "
+ "20000101000000 20000201000000 "
+ "12345 example.com. FAKEFAKEFAKE"));
+ // another signature algorithm (3 = DSA/SHA-1)
+ rrset_rrsig->addRdata(generic::RRSIG("A 3 3 3600 "
+ "20000101000000 20000201000000 "
+ "12345 example.com. FAKEFAKEFAKE"));
+ rrset_a->addRRsig(rrset_rrsig);
+
+ EXPECT_EQ(2, rrset_a->getSIGRdataCount());
+}
}