Commit b15e778c authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

handled SOA query correctly.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1421 e5f2f494-b856-4b98-b285-d166d9295462
parent 574aada7
......@@ -59,8 +59,10 @@ public:
// We should revisit this design later.
RRsetPtr authors;
RRsetPtr authors_ns;
RRsetPtr authors_soa;
RRsetPtr version;
RRsetPtr version_ns;
RRsetPtr version_soa;
};
StaticDataSrcImpl::StaticDataSrcImpl() :
......@@ -84,6 +86,12 @@ StaticDataSrcImpl::StaticDataSrcImpl() :
RRType::NS(), RRTTL(0)));
authors_ns->addRdata(generic::NS(authors_name));
authors_soa = RRsetPtr(new RRset(authors_name, RRClass::CH(),
RRType::SOA(), RRTTL(86400)));
authors_soa->addRdata(generic::SOA(
"authors.bind. hostmaster.authors.bind. "
"0 28800 7200 604800 86400"));
version = RRsetPtr(new RRset(version_name, RRClass::CH(),
RRType::TXT(), RRTTL(0)));
version->addRdata(generic::TXT("BIND10 0.0.0 (pre-alpha)"));
......@@ -91,6 +99,12 @@ StaticDataSrcImpl::StaticDataSrcImpl() :
version_ns = RRsetPtr(new RRset(version_name, RRClass::CH(),
RRType::NS(), RRTTL(0)));
version_ns->addRdata(generic::NS(version_name));
version_soa = RRsetPtr(new RRset(version_name, RRClass::CH(),
RRType::SOA(), RRTTL(86400)));
version_soa->addRdata(generic::SOA(
"version.bind. hostmaster.version.bind. "
"0 28800 7200 604800 86400"));
}
StaticDataSrc::StaticDataSrc()
......@@ -177,6 +191,8 @@ StaticDataSrc::findRRset(const Name& qname,
target.addRRset(impl_->version);
} else if (qtype == RRType::NS()) {
target.addRRset(impl_->version_ns);
} else if (qtype == RRType::SOA()) {
target.addRRset(impl_->version_soa);
} else {
flags = TYPE_NOT_FOUND;
}
......@@ -192,6 +208,9 @@ StaticDataSrc::findRRset(const Name& qname,
} else if (qtype == RRType::NS()) {
target.addRRset(impl_->authors_ns);
return (SUCCESS);
} else if (qtype == RRType::SOA()) {
target.addRRset(impl_->authors_soa);
return (SUCCESS);
} else {
flags = TYPE_NOT_FOUND;
}
......
......@@ -45,7 +45,8 @@ protected:
authors_name("authors.bind"),
nomatch_name("example.com"),
rrclass(RRClass::CH()), rrtype(RRType::TXT()),
rrttl(RRTTL(0)), find_flags(0), matched_rdata(0)
rrttl(RRTTL(0)), soa_rrttl(RRTTL(86400)),
find_flags(0), matched_rdata(0)
{
// XXX: the following values can change as release/developers change,
// in which case the test code must be updated accordingly.
......@@ -66,6 +67,11 @@ protected:
version_ns_data.push_back("version.bind.");
authors_ns_data.push_back("authors.bind.");
version_soa_data.push_back("version.bind. hostmaster.version.bind. "
"0 28800 7200 604800 86400");
authors_soa_data.push_back("authors.bind. hostmaster.authors.bind. "
"0 28800 7200 604800 86400");
}
StaticDataSrc data_source;
const Name version_name;
......@@ -74,6 +80,7 @@ protected:
const RRClass rrclass;
RRType rrtype; // we allow this to be modified in the test
RRTTL rrttl;
RRTTL soa_rrttl;
RRsetList result_sets;
uint32_t find_flags;
unsigned matched_rdata;
......@@ -81,6 +88,8 @@ protected:
vector<string> authors_data;
vector<string> version_ns_data;
vector<string> authors_ns_data;
vector<string> version_soa_data;
vector<string> authors_soa_data;
};
void
......@@ -218,6 +227,14 @@ TEST_F(StaticDataSourceTest, findRRsetVersionNS) {
rrtype, rrttl, 0, version_ns_data);
}
TEST_F(StaticDataSourceTest, findRRsetVersionSOA) {
rrtype = RRType::SOA();
checkFind(data_source, version_name, NULL, rrclass, rrclass,
rrtype, soa_rrttl, 0, version_soa_data);
checkFind(data_source, version_name, &version_name, rrclass, rrclass,
rrtype, soa_rrttl, 0, version_soa_data);
}
TEST_F(StaticDataSourceTest, findRRsetAuthorsTXT) {
checkFind(data_source, authors_name, NULL, rrclass, rrclass,
rrtype, rrttl, 0, authors_data);
......@@ -233,6 +250,14 @@ TEST_F(StaticDataSourceTest, findRRsetAuthorsNS) {
rrtype, rrttl, 0, authors_ns_data);
}
TEST_F(StaticDataSourceTest, findRRsetAuthorsSOA) {
rrtype = RRType::SOA();
checkFind(data_source, authors_name, NULL, rrclass, rrclass,
rrtype, soa_rrttl, 0, authors_soa_data);
checkFind(data_source, authors_name, &authors_name, rrclass, rrclass,
rrtype, soa_rrttl, 0, authors_soa_data);
}
// Class ANY lookup should result in the same answer.
TEST_F(StaticDataSourceTest, findRRsetVersionClassAny) {
checkFind(data_source, version_name, NULL, RRClass::ANY(), rrclass,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment