Parcourir la source

use getQR() rather than getQr() etc.

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/f2f200910@147 e5f2f494-b856-4b98-b285-d166d9295462
JINMEI Tatuya il y a 15 ans
Parent
commit
538098d861
3 fichiers modifiés avec 50 ajouts et 50 suppressions
  1. 8 8
      src/lib/dns/message.cc
  2. 20 20
      src/lib/dns/message.h
  3. 22 22
      src/lib/dns/message_unittest.cc

+ 8 - 8
src/lib/dns/message.cc

@@ -245,19 +245,19 @@ Message::toText() const
     s += ", status: " + std::string(rcodetext[rcode_]);
     s += ", status: " + std::string(rcodetext[rcode_]);
     s += ", id: " + boost::lexical_cast<std::string>(qid_);
     s += ", id: " + boost::lexical_cast<std::string>(qid_);
     s += "\n;; flags: ";
     s += "\n;; flags: ";
-    if (getQr())
+    if (getQR())
         s += "qr ";
         s += "qr ";
-    if (getAa())
+    if (getAA())
         s += "aa ";
         s += "aa ";
-    if (getTc())
+    if (getTC())
         s += "tc ";
         s += "tc ";
-    if (getRd())
+    if (getRD())
         s += "rd ";
         s += "rd ";
-    if (getRa())
+    if (getRA())
         s += "ra ";
         s += "ra ";
-    if (getAd())
+    if (getAD())
         s += "ad ";
         s += "ad ";
-    if (getCd())
+    if (getCD())
         s += "cd ";
         s += "cd ";
 
 
     // for simply, don't consider the update case
     // for simply, don't consider the update case
@@ -320,7 +320,7 @@ void
 Message::makeResponse()
 Message::makeResponse()
 {
 {
     flags_ &= MESSAGE_REPLYPRESERVE;
     flags_ &= MESSAGE_REPLYPRESERVE;
-    setQr(true);
+    setQR(true);
 
 
     for (int section = SECTION_ANSWER; section < SECTION_MAX; ++section) {
     for (int section = SECTION_ANSWER; section < SECTION_MAX; ++section) {
         sections_[section].clear();
         sections_[section].clear();

+ 20 - 20
src/lib/dns/message.h

@@ -46,14 +46,14 @@ public:
     void sort(Message& message, section_t section) {} // dummy for now.
     void sort(Message& message, section_t section) {} // dummy for now.
 };
 };
 
 
-#define getMsgFlg(flg, capflg) \
-bool get ## flg() const { return ((flags_ & FLAG_ ## capflg) != 0); }
-#define setMsgFlg(flg, capflg) \
-bool set ## flg(bool on) { \
+#define getMsgFlg(flag) \
+bool get ## flag() const { return ((flags_ & FLAG_ ## flag) != 0); }
+#define setMsgFlg(flag) \
+bool set ## flag(bool on) { \
         if (on) \
         if (on) \
-            flags_ |= FLAG_ ## capflg; \
+            flags_ |= FLAG_ ## flag; \
         else \
         else \
-            flags_ &= ~FLAG_ ## capflg; \
+            flags_ &= ~FLAG_ ## flag; \
     }
     }
 
 
 class Message {
 class Message {
@@ -62,20 +62,20 @@ public:
     ~Message();
     ~Message();
     qid_t getQid() const { return (qid_); }
     qid_t getQid() const { return (qid_); }
     void setQid(qid_t qid) { qid_ = qid; }
     void setQid(qid_t qid) { qid_ = qid; }
-    getMsgFlg(Rd, RD)
-    setMsgFlg(Rd, RD)
-    getMsgFlg(Aa, AA)
-    setMsgFlg(Aa, AA)
-    getMsgFlg(Qr, QR)
-    setMsgFlg(Qr, QR)
-    getMsgFlg(Tc, TC)
-    setMsgFlg(Tc, TC)
-    getMsgFlg(Ra, RA)
-    setMsgFlg(Ra, RA)
-    getMsgFlg(Ad, AD)
-    setMsgFlg(Ad, AD)
-    getMsgFlg(Cd, CD)
-    setMsgFlg(Cd, CD)
+    getMsgFlg(RD)
+    setMsgFlg(RD)
+    getMsgFlg(AA)
+    setMsgFlg(AA)
+    getMsgFlg(QR)
+    setMsgFlg(QR)
+    getMsgFlg(TC)
+    setMsgFlg(TC)
+    getMsgFlg(RA)
+    setMsgFlg(RA)
+    getMsgFlg(AD)
+    setMsgFlg(AD)
+    getMsgFlg(CD)
+    setMsgFlg(CD)
     rcode_t getRcode() const { return (rcode_); }
     rcode_t getRcode() const { return (rcode_); }
     void setRcode(rcode_t rcode) { rcode_ = rcode; }
     void setRcode(rcode_t rcode) { rcode_ = rcode; }
     opcode_t getOpcode() const { return (opcode_); }
     opcode_t getOpcode() const { return (opcode_); }

+ 22 - 22
src/lib/dns/message_unittest.cc

@@ -49,33 +49,33 @@ protected:
 
 
 TEST_F(MessageTest, check_flags)
 TEST_F(MessageTest, check_flags)
 {
 {
-    EXPECT_EQ(false, query.getQr());
-    query.setQr(true);
-    EXPECT_EQ(true, query.getQr());
+    EXPECT_EQ(false, query.getQR());
+    query.setQR(true);
+    EXPECT_EQ(true, query.getQR());
 
 
-    EXPECT_EQ(false, query.getAa());
-    query.setAa(true);
-    EXPECT_EQ(true, query.getAa());
+    EXPECT_EQ(false, query.getAA());
+    query.setAA(true);
+    EXPECT_EQ(true, query.getAA());
 
 
-    EXPECT_EQ(false, query.getTc());
-    query.setTc(true);
-    EXPECT_EQ(true, query.getTc());
+    EXPECT_EQ(false, query.getTC());
+    query.setTC(true);
+    EXPECT_EQ(true, query.getTC());
 
 
-    EXPECT_EQ(false, query.getRd());
-    query.setRd(true);
-    EXPECT_EQ(true, query.getRd());
+    EXPECT_EQ(false, query.getRD());
+    query.setRD(true);
+    EXPECT_EQ(true, query.getRD());
 
 
-    EXPECT_EQ(false, query.getRa());
-    query.setRa(true);
-    EXPECT_EQ(true, query.getRa());
+    EXPECT_EQ(false, query.getRA());
+    query.setRA(true);
+    EXPECT_EQ(true, query.getRA());
 
 
-    EXPECT_EQ(false, query.getAd());
-    query.setAd(true);
-    EXPECT_EQ(true, query.getAd());
+    EXPECT_EQ(false, query.getAD());
+    query.setAD(true);
+    EXPECT_EQ(true, query.getAD());
 
 
-    EXPECT_EQ(false, query.getCd());
-    query.setCd(true);
-    EXPECT_EQ(true, query.getCd());
+    EXPECT_EQ(false, query.getCD());
+    query.setCD(true);
+    EXPECT_EQ(true, query.getCD());
 }
 }
 
 
 TEST_F(MessageTest, getQuestion)
 TEST_F(MessageTest, getQuestion)
@@ -88,7 +88,7 @@ TEST_F(MessageTest, getQuestion)
 TEST_F(MessageTest, makeResponse)
 TEST_F(MessageTest, makeResponse)
 {
 {
     query.makeResponse();
     query.makeResponse();
-    EXPECT_EQ(true, query.getQr());
+    EXPECT_EQ(true, query.getQR());
     EXPECT_EQ("www.example.com. IN A",
     EXPECT_EQ("www.example.com. IN A",
               (**query.getSection(SECTION_QUESTION).begin()).toText());
               (**query.getSection(SECTION_QUESTION).begin()).toText());
     EXPECT_EQ(0, query.getSection(SECTION_ANSWER).size());
     EXPECT_EQ(0, query.getSection(SECTION_ANSWER).size());