Browse Source

added some getters for MX

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/f2f200910@221 e5f2f494-b856-4b98-b285-d166d9295462
JINMEI Tatuya 15 years ago
parent
commit
69c0bc983a
2 changed files with 8 additions and 0 deletions
  1. 2 0
      src/lib/dns/rrset.h
  2. 6 0
      src/lib/dns/rrset_unittest.cc

+ 2 - 0
src/lib/dns/rrset.h

@@ -177,6 +177,8 @@ public:
     unsigned int count() const { return (1); }
     unsigned int count() const { return (1); }
     const RRType& getType() const { return (RRType::MX); }
     const RRType& getType() const { return (RRType::MX); }
     static const RRType& getTypeStatic() { return (RRType::MX); }
     static const RRType& getTypeStatic() { return (RRType::MX); }
+    uint16_t getPreference() const { return (preference_); }
+    const Name getMXName() const { return (mxname_); }
     std::string toText() const;
     std::string toText() const;
     void toWire(Buffer& buffer, NameCompressor& compressor) const;
     void toWire(Buffer& buffer, NameCompressor& compressor) const;
     bool operator==(const MX& other) const
     bool operator==(const MX& other) const

+ 6 - 0
src/lib/dns/rrset_unittest.cc

@@ -169,6 +169,12 @@ TEST_F(Rdata_Generic_MX_Test, fromToText)
     EXPECT_EQ("10 mail.example.com.", rdata.toText());
     EXPECT_EQ("10 mail.example.com.", rdata.toText());
 }
 }
 
 
+TEST_F(Rdata_Generic_MX_Test, getFields)
+{
+    EXPECT_EQ(10, rdata.getPreference());
+    EXPECT_EQ("mail.example.com.", rdata.getMXName().toText());
+}
+
 // The fixture for testing Generic/TXT Rdata class
 // The fixture for testing Generic/TXT Rdata class
 class Rdata_Generic_TXT_Test : public ::testing::Test {
 class Rdata_Generic_TXT_Test : public ::testing::Test {
 protected:
 protected: