Commit b88b05b2 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[1331] Add SOA::getSerial method

parent 046729c7
......@@ -106,6 +106,12 @@ SOA::toWire(AbstractMessageRenderer& renderer) const {
renderer.writeData(numdata_, sizeof(numdata_));
}
uint32_t
SOA::getSerial() const {
InputBuffer b(numdata_, sizeof(numdata_));
return (b.readUint32());
}
string
SOA::toText() const {
InputBuffer b(numdata_, sizeof(numdata_));
......
......@@ -34,6 +34,8 @@ public:
SOA(const Name& mname, const Name& rname, uint32_t serial,
uint32_t refresh, uint32_t retry, uint32_t expire,
uint32_t minimum);
/// \brief Returns the serial stored in the SOA.
uint32_t getSerial() const;
private:
/// Note: this is a prototype version; we may reconsider
/// this representation later.
......
......@@ -74,4 +74,9 @@ TEST_F(Rdata_SOA_Test, toText) {
EXPECT_EQ("ns.example.com. root.example.com. "
"2010012601 3600 300 3600000 1200", rdata_soa.toText());
}
TEST_F(Rdata_SOA_Test, getSerial) {
EXPECT_EQ(2010012601, rdata_soa.getSerial());
}
}
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