;; test zone file used for ZoneFinderContext tests.
;; RRSIGs are (obviouslly) faked ones for testing.
-example.org. 3600 IN SOA ns1.example.org. bugs.x.w.example.org. 20 3600 300 3600000 3600
+example.org. 3600 IN SOA ns1.example.org. bugs.x.w.example.org. 22 3600 300 3600000 3600
example.org. 3600 IN NS ns1.example.org.
example.org. 3600 IN NS ns2.example.org.
example.org. 3600 IN MX 1 mx1.example.org.
ns2.a.example.org. 3600 IN A 192.0.2.6
ns2.a.example.org. 3600 IN AAAA 2001:db8::6
mx.a.example.org. 3600 IN A 192.0.2.7
+
+;; CNAME
+alias.example.org. 3600 IN CNAME cname.example.org.
+
+;; DNAME
+dname.example.org. 3600 IN DNAME dname.example.com.
sigresult_sets.begin(), sigresult_sets.end());
}
+TEST_P(ZoneFinderContextTest, getAdditionalNoOP) {
+ // getAdditional() is only meaningful after SUCCESS or DELEGATION.
+
+ ZoneFinderContextPtr ctx = finder_->find(Name("nxdomain.example.org"),
+ RRType::NS());
+ EXPECT_EQ(ZoneFinder::NXDOMAIN, ctx->code);
+ ctx->getAdditional(REQUESTED_BOTH, result_sets_);
+ EXPECT_TRUE(result_sets_.empty());
+
+ ctx = finder_->find(qzone_, RRType::TXT());
+ EXPECT_EQ(ZoneFinder::NXRRSET, ctx->code);
+ ctx->getAdditional(REQUESTED_BOTH, result_sets_);
+ EXPECT_TRUE(result_sets_.empty());
+
+ ctx = finder_->find(Name("alias.example.org."), RRType::A());
+ EXPECT_EQ(ZoneFinder::CNAME, ctx->code);
+ ctx->getAdditional(REQUESTED_BOTH, result_sets_);
+ EXPECT_TRUE(result_sets_.empty());
+
+ ctx = finder_->find(Name("www.dname.example.org."), RRType::A());
+ EXPECT_EQ(ZoneFinder::DNAME, ctx->code);
+ ctx->getAdditional(REQUESTED_BOTH, result_sets_);
+ EXPECT_TRUE(result_sets_.empty());
+}
+
}
return ((flags_ & RESULT_NSEC3_SIGNED) != 0);
}
- virtual void getAdditional(
+ void getAdditional(
+ const std::vector<isc::dns::RRType>& requested_types,
+ std::vector<isc::dns::ConstRRsetPtr>& result)
+ {
+ // Perform common checks, and delegate the process the default
+ // or specialized implementation.
+ if (code != SUCCESS && code != DELEGATION) {
+ return;
+ }
+
+ getAdditionalImpl(requested_types, result);
+ }
+
+ protected:
+ virtual void getAdditionalImpl(
const std::vector<isc::dns::RRType>& requested_types,
std::vector<isc::dns::ConstRRsetPtr>& result);
}
void
-ZoneFinder::Context::getAdditional(const vector<RRType>& requested_types,
- vector<ConstRRsetPtr>& result)
+ZoneFinder::Context::getAdditionalImpl(const vector<RRType>& requested_types,
+ vector<ConstRRsetPtr>& result)
{
RdataIteratorPtr rdata_iterator(rrset->getRdataIterator());
ZoneFinder::FindOptions options = ZoneFinder::FIND_DEFAULT;