[svn] commit: r1295 - in /trunk/src/lib/dns: message.cc message.h

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Mar 10 19:52:38 UTC 2010


Author: jinmei
Date: Wed Mar 10 19:52:38 2010
New Revision: 1295

Log:
- associate DNSProtocolError classes with corresponding RCODE 
- define operator!= for Rcode

Modified:
    trunk/src/lib/dns/message.cc
    trunk/src/lib/dns/message.h

Modified: trunk/src/lib/dns/message.cc
==============================================================================
--- trunk/src/lib/dns/message.cc (original)
+++ trunk/src/lib/dns/message.cc Wed Mar 10 19:52:38 2010
@@ -151,6 +151,16 @@
     "RESERVED14",
     "RESERVED15"
 };
+}
+
+const Rcode&
+DNSMessageFORMERR::getRcode() const {
+    return (Rcode::FORMERR());
+}
+
+const Rcode&
+DNSMessageBADVERS::getRcode() const {
+    return (Rcode::BADVERS());
 }
 
 string

Modified: trunk/src/lib/dns/message.h
==============================================================================
--- trunk/src/lib/dns/message.h (original)
+++ trunk/src/lib/dns/message.h Wed Mar 10 19:52:38 2010
@@ -30,22 +30,27 @@
 ///
 /// \brief A standard DNS module exception ...[TBD]
 ///
+class Rcode;                    // forward declaration
+
 class DNSProtocolError : public Exception {
 public:
     DNSProtocolError(const char* file, size_t line, const char* what) :
         isc::Exception(file, line, what) {}
+    virtual const Rcode& getRcode() const = 0;
 };
 
 class DNSMessageFORMERR : public DNSProtocolError {
 public:
     DNSMessageFORMERR(const char* file, size_t line, const char* what) :
         DNSProtocolError(file, line, what) {}
+    virtual const Rcode& getRcode() const;
 };
 
 class DNSMessageBADVERS : public DNSProtocolError {
 public:
     DNSMessageBADVERS(const char* file, size_t line, const char* what) :
         DNSProtocolError(file, line, what) {}
+    virtual const Rcode& getRcode() const;
 };
 
 ///
@@ -156,6 +161,8 @@
     uint16_t getCode() const { return (code_); }
     bool operator==(const Opcode& other) const
     { return (code_ == other.code_); }
+    bool operator!=(const Opcode& other) const
+    { return (code_ != other.code_); }
     std::string toText() const;
     static const Opcode& QUERY();
     static const Opcode& IQUERY();




More information about the bind10-changes mailing list