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

added quick hack implementation of the SOA rdata class for datasource

development.
passed minimum level of unit test, will get it reviewed in the next review
cycle.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@789 e5f2f494-b856-4b98-b285-d166d9295462
parent c2fb21d9
...@@ -39,10 +39,35 @@ SOA::SOA(InputBuffer& buffer, size_t rdata_len) : ...@@ -39,10 +39,35 @@ SOA::SOA(InputBuffer& buffer, size_t rdata_len) :
buffer.readData(numdata_, sizeof(numdata_)); buffer.readData(numdata_, sizeof(numdata_));
} }
SOA::SOA(const std::string& soastr) : SOA::SOA(const string& soastr) :
mname_("."), rname_(".") mname_("."), rname_(".") // quick hack workaround
{ {
dns_throw(InvalidRdataText, "Not implemented yet"); istringstream iss(soastr);
string token;
iss >> token;
if (iss.bad() || iss.fail()) {
dns_throw(InvalidRdataText, "Invalid SOA MNAME");
}
mname_ = Name(token);
iss >> token;
rname_ = Name(token);
if (iss.bad() || iss.fail()) {
dns_throw(InvalidRdataText, "Invalid SOA RNAME");
}
uint32_t serial, refresh, retry, expire, minimum;
iss >> serial >> refresh >> retry >> expire >> minimum;
if (iss.rdstate() != ios::eofbit) {
dns_throw(InvalidRdataText, "Invalid SOA format");
}
OutputBuffer buffer(20);
buffer.writeUint32(serial);
buffer.writeUint32(refresh);
buffer.writeUint32(retry);
buffer.writeUint32(expire);
buffer.writeUint32(minimum);
memcpy(numdata_, buffer.getData(), buffer.getLength());
} }
SOA::SOA(const Name& mname, const Name& rname, uint32_t serial, SOA::SOA(const Name& mname, const Name& rname, uint32_t serial,
......
...@@ -330,7 +330,11 @@ TEST_F(RdataTest, getNSName) ...@@ -330,7 +330,11 @@ TEST_F(RdataTest, getNSName)
TEST_F(RdataTest, createFromText_SOA) TEST_F(RdataTest, createFromText_SOA)
{ {
//TBD EXPECT_EQ(0, rdata_soa.compare(generic::SOA("ns.example.com. "
"root.example.com. "
"2010012601 3600 300 3600000 "
"1200")));
// TBD: more tests
} }
TEST_F(RdataTest, createFromWire_SOA) TEST_F(RdataTest, createFromWire_SOA)
......
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