[svn] commit: r79 - in /experiments/jinmei-messageapi: dnsexceptions.hh dnsmessage-test.cc dnsmessage.cc dnsmessage.hh rrset-test.cc rrset.cc rrset.hh

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Oct 9 22:08:17 UTC 2009


Author: jinmei
Date: Fri Oct  9 22:08:17 2009
New Revision: 79

Log:
s/Rdata{Class,Type}/RR{Class,Type}/

Modified:
    experiments/jinmei-messageapi/dnsexceptions.hh
    experiments/jinmei-messageapi/dnsmessage-test.cc
    experiments/jinmei-messageapi/dnsmessage.cc
    experiments/jinmei-messageapi/dnsmessage.hh
    experiments/jinmei-messageapi/rrset-test.cc
    experiments/jinmei-messageapi/rrset.cc
    experiments/jinmei-messageapi/rrset.hh

Modified: experiments/jinmei-messageapi/dnsexceptions.hh
==============================================================================
--- experiments/jinmei-messageapi/dnsexceptions.hh (original)
+++ experiments/jinmei-messageapi/dnsexceptions.hh Fri Oct  9 22:08:17 2009
@@ -25,8 +25,8 @@
 class DNSLabelTooLong : public DNSException {};
 class DNSBadEscape : public DNSException {};
 class DNSBadLabelType : public DNSException {};
-class DNSInvalidRdataClass : public DNSException {};
-class DNSInvalidRdataType : public DNSException {};
+class DNSInvalidRRClass : public DNSException {};
+class DNSInvalidRRType : public DNSException {};
 class DNSRdtypeMismatch : public DNSException {};
 class DNSInvalidWireRdata : public DNSException {};
 class DNSNoMessageIOBuffer : public DNSException {};

Modified: experiments/jinmei-messageapi/dnsmessage-test.cc
==============================================================================
--- experiments/jinmei-messageapi/dnsmessage-test.cc (original)
+++ experiments/jinmei-messageapi/dnsmessage-test.cc Fri Oct  9 22:08:17 2009
@@ -82,11 +82,11 @@
                                      query->get_type().to_text()));
             if (it != dnsdb.end()) {
                 // XXX: this code logic is NOT clean.  should revisit API.
-                if (query->get_type() == RdataType::A) {
+                if (query->get_type() == RRType::A) {
                     rdatap = rdataptr_t(new ARdata(it->second));
-                } else if (query->get_type() == RdataType::AAAA) {
+                } else if (query->get_type() == RRType::AAAA) {
                     rdatap = rdataptr_t(new AAAARdata(it->second));
-                } else if (query->get_type() == RdataType::NS) {
+                } else if (query->get_type() == RRType::NS) {
                     rdatap = rdataptr_t(new NSRdata(it->second));
                 }
 
@@ -169,7 +169,7 @@
     } else {
         msg.set_qid(42);            // can be omitted, then QID will be 0
         msg.set_rd(true);
-        msg.add_question(Name(argv[0]), RdataClass::IN, RdataType(type_name));
+        msg.add_question(Name(argv[0]), RRClass::IN, RRType(type_name));
         msg.to_wire();
         cout << "sending a query (" <<
             boost::lexical_cast<string>(msg.get_iobuffer().get_size())

Modified: experiments/jinmei-messageapi/dnsmessage.cc
==============================================================================
--- experiments/jinmei-messageapi/dnsmessage.cc (original)
+++ experiments/jinmei-messageapi/dnsmessage.cc Fri Oct  9 22:08:17 2009
@@ -80,8 +80,8 @@
 }
 
 void
-Message::add_question(const Name& qname, const RdataClass& qclass,
-                      const RdataType& qtype)
+Message::add_question(const Name& qname, const RRClass& qclass,
+                      const RRType& qtype)
 {
     add_rrset(SECTION_QUESTION, RRSetPtr(new Question(qname, qclass, qtype)));
 }
@@ -180,8 +180,8 @@
         // algorithm that requires the question section contain exactly one
         // RR.
 
-        RdataType rdtype(_iobuffer->read_uint16());
-        RdataClass rdclass(_iobuffer->read_uint16());
+        RRType rdtype(_iobuffer->read_uint16());
+        RRClass rdclass(_iobuffer->read_uint16());
         add_rrset(SECTION_QUESTION,
                   RRSetPtr(new Question(name, rdclass, rdtype))); 
     }

Modified: experiments/jinmei-messageapi/dnsmessage.hh
==============================================================================
--- experiments/jinmei-messageapi/dnsmessage.hh (original)
+++ experiments/jinmei-messageapi/dnsmessage.hh Fri Oct  9 22:08:17 2009
@@ -99,8 +99,8 @@
     void add_rrset(section_t section, RRSetPtr rrset);
     // set_question() is redundant in that it's a special case of add_rrset,
     // but it'd be convenient for general purpose applications.
-    void add_question(const Name& qname, const RdataClass& qclass,
-                      const RdataType& qtype);
+    void add_question(const Name& qname, const RRClass& qclass,
+                      const RRType& qtype);
     void remove_rrset(section_t section, RRSetPtr rrset);
     void add_rr(section_t section, const RR& rr);
     void remove_rr(section_t section, const RR& rr);

Modified: experiments/jinmei-messageapi/rrset-test.cc
==============================================================================
--- experiments/jinmei-messageapi/rrset-test.cc (original)
+++ experiments/jinmei-messageapi/rrset-test.cc Fri Oct  9 22:08:17 2009
@@ -29,22 +29,21 @@
 int
 main()
 {
-    RdataClass rdclass("IN");
-    RdataClass numericRdclass(3);
-    RdataType rdtype("AAAA");
-    RdataType numericRdtype(28);
+    RRClass rdclass("IN");
+    RRClass numericRdclass(3);
+    RRType rdtype("AAAA");
+    RRType numericRdtype(28);
 
-    cout << (rdclass == RdataClass::IN) << endl; // should be 1
-    cout << (numericRdclass == RdataClass::CHAOS) << endl; // should be 1
-    cout << (rdtype != RdataType::A) << endl; // should be 1
-    cout << (numericRdtype == RdataType::AAAA) << endl; // should be 1
+    cout << (rdclass == RRClass::IN) << endl; // should be 1
+    cout << (numericRdclass == RRClass::CHAOS) << endl; // should be 1
+    cout << (rdtype != RRType::A) << endl; // should be 1
+    cout << (numericRdtype == RRType::AAAA) << endl; // should be 1
 
     AAAARdata aaaa("2001:0db8:0000:0000:0000:0000:0000:1234");
     cout << aaaa.to_text() << endl; // should be (e.g.) "2001:db8::1234"
 
     // Construct a AAAA RRset and print it.
-    RRSet rrset(Name("www.example.com."), RdataClass::IN, RdataType::AAAA,
-                3600);
+    RRSet rrset(Name("www.example.com."), RRClass::IN, RRType::AAAA, 3600);
     rrset.add_rdata(rdataptr_t(new AAAARdata("2001:db8::1234")));
     rrset.add_rdata(rdataptr_t(new AAAARdata("2001:db8::abcd")));
     cout << rrset.to_text() << endl; // "<name> <TTL> IN AAAA <addr>"

Modified: experiments/jinmei-messageapi/rrset.cc
==============================================================================
--- experiments/jinmei-messageapi/rrset.cc (original)
+++ experiments/jinmei-messageapi/rrset.cc Fri Oct  9 22:08:17 2009
@@ -28,7 +28,7 @@
 using namespace std;
 using namespace ISC::DNS;
 
-RdataClass::RdataClass(const string& classstr)
+RRClass::RRClass(const string& classstr)
 {
     // XXX: this is a quick hack implementation to see feasibility.
     // should be rewritten in a cleaner way.
@@ -37,11 +37,11 @@
     else if (classstr == "CHAOS")
         _classval = 3;
     else
-        throw DNSInvalidRdataClass();
+        throw DNSInvalidRRClass();
 }
 
 const string
-RdataClass::to_text() const
+RRClass::to_text() const
 {
     // XXX: quick hack
     if (_classval == 1)
@@ -52,15 +52,15 @@
 }
 
 void
-RdataClass::to_wire(IOBuffer& b) const
+RRClass::to_wire(IOBuffer& b) const
 {
     b.write_uint16(_classval);
 }
 
-const RdataClass RdataClass::IN("IN");
-const RdataClass RdataClass::CHAOS("CHAOS");
-
-RdataType::RdataType(const string& typestr)
+const RRClass RRClass::IN("IN");
+const RRClass RRClass::CHAOS("CHAOS");
+
+RRType::RRType(const string& typestr)
 {
     // XXX: this is a quick hack implementation to see feasibility.
     // should be rewritten in a cleaner way.
@@ -71,11 +71,11 @@
     else if (typestr == "AAAA")
         _typeval = 28;
     else
-        throw DNSInvalidRdataType();
+        throw DNSInvalidRRType();
 }
 
 const string
-RdataType::to_text() const
+RRType::to_text() const
 {
     if (_typeval == 1)
         return ("A");
@@ -87,14 +87,14 @@
 }
 
 void
-RdataType::to_wire(IOBuffer& b) const
+RRType::to_wire(IOBuffer& b) const
 {
     b.write_uint16(_typeval);
 }
 
-const RdataType RdataType::A("A");
-const RdataType RdataType::NS("NS");
-const RdataType RdataType::AAAA("AAAA");
+const RRType RRType::A("A");
+const RRType RRType::NS("NS");
+const RRType RRType::AAAA("AAAA");
 // ...more to follow
 
 void

Modified: experiments/jinmei-messageapi/rrset.hh
==============================================================================
--- experiments/jinmei-messageapi/rrset.hh (original)
+++ experiments/jinmei-messageapi/rrset.hh Fri Oct  9 22:08:17 2009
@@ -51,45 +51,45 @@
                SECTION_ADDITIONAL = 3,
                SECTION_MAX = 4 } section_t;
 
-class RdataClass {
-public:
-    RdataClass() {}
-    explicit RdataClass(uint16_t classval) :
+class RRClass {
+public:
+    RRClass() {}
+    explicit RRClass(uint16_t classval) :
         _classval(classval) {}
-    explicit RdataClass(const string& classstr);
+    explicit RRClass(const string& classstr);
     const string to_text() const;
     void to_wire(IOBuffer& b) const;
     uint16_t get_value() const { return (_classval); }
-    bool operator==(const RdataClass& other) const
+    bool operator==(const RRClass& other) const
     { return (_classval == other._classval); }
-    bool operator!=(const RdataClass& other) const
+    bool operator!=(const RRClass& other) const
     { return (_classval != other._classval); }
 
     // (Some) well-known Rdclass constants
-    static const RdataClass IN;
-    static const RdataClass CHAOS;
+    static const RRClass IN;
+    static const RRClass CHAOS;
 private:
     uint16_t _classval;
 };
 
-class RdataType {
-public:
-    RdataType() {}
-    explicit RdataType(uint16_t typeval) :
+class RRType {
+public:
+    RRType() {}
+    explicit RRType(uint16_t typeval) :
         _typeval(typeval) {}
-    explicit RdataType(const string& typestr);
+    explicit RRType(const string& typestr);
     const string to_text() const;
     void to_wire(IOBuffer& b) const;
     uint16_t get_value() const { return (_typeval); }
-    bool operator==(const RdataType& other) const
+    bool operator==(const RRType& other) const
     { return (_typeval == other._typeval); }
-    bool operator!=(const RdataType& other) const
+    bool operator!=(const RRType& other) const
     { return (_typeval != other._typeval); }
 
     // (Some) Well-known Rdtype constants
-    static const RdataType A;
-    static const RdataType NS;
-    static const RdataType AAAA;
+    static const RRType A;
+    static const RRType NS;
+    static const RRType AAAA;
     // more to follow...
 
 private:
@@ -125,7 +125,7 @@
 public:
     virtual ~Rdata() {};
     virtual unsigned int count() const = 0;
-    virtual const RdataType& get_type() const = 0;
+    virtual const RRType& get_type() const = 0;
     virtual string to_text() const = 0;
     virtual void from_wire(IOBuffer& b, NameDecompressor& c) = 0;
     virtual void to_wire(IOBuffer& b, NameCompressor& c) const = 0;
@@ -138,17 +138,17 @@
 class WireRdata : public Rdata {
 public:
     WireRdata() {}
-    explicit WireRdata(const RdataClass& rdclass,
-                       const RdataType& rdtype,
+    explicit WireRdata(const RRClass& rdclass,
+                       const RRType& rdtype,
                        const string& wireData) :
         _rdclass(rdclass), _rdtype(rdtype),
         _wireData(wireData) {}
     // disallow to/from_wire() for this class by not defining
     // it.  (should we allow that?)
-    const RdataType& get_type() const { return (_rdtype); }
-private:
-    RdataClass _rdclass;
-    RdataType _rdtype;
+    const RRType& get_type() const { return (_rdtype); }
+private:
+    RRClass _rdclass;
+    RRType _rdtype;
     string _wireData;
 };
 
@@ -159,8 +159,8 @@
     // constructor from a textual IPv4 address
     explicit ARdata(const string& addrstr);
     unsigned int count() const { return (1); }
-    const RdataType& get_type() const { return (RdataType::A); }
-    static const RdataType& get_type_static() { return (RdataType::A); }
+    const RRType& get_type() const { return (RRType::A); }
+    static const RRType& get_type_static() { return (RRType::A); }
     string to_text() const;
     void from_wire(IOBuffer& b, NameDecompressor& c);
     void to_wire(IOBuffer& b, NameCompressor& c) const;
@@ -181,8 +181,8 @@
     explicit NSRdata(const string& namestr) : _nsname(namestr) {}
     explicit NSRdata(const Name& nsname) : _nsname(nsname) {}
     unsigned int count() const { return (1); }
-    const RdataType& get_type() const { return (RdataType::NS); }
-    static const RdataType& get_type_static() { return (RdataType::NS); }
+    const RRType& get_type() const { return (RRType::NS); }
+    static const RRType& get_type_static() { return (RRType::NS); }
     string to_text() const;
     void from_wire(IOBuffer& b, NameDecompressor& c);
     void to_wire(IOBuffer& b, NameCompressor& c) const;
@@ -202,9 +202,9 @@
     AAAARdata(const string& addrstr);
     unsigned int count() const { return (1); }
     string to_text() const;
-    const RdataType& get_type() const { return (RdataType::AAAA); }
-    static const RdataType& get_type_static()
-    { return (RdataType::AAAA); }
+    const RRType& get_type() const { return (RRType::AAAA); }
+    static const RRType& get_type_static()
+    { return (RRType::AAAA); }
     void from_wire(IOBuffer& b, NameDecompressor& c);
     void to_wire(IOBuffer& b, NameCompressor& c) const;
     const struct in6_addr& getAddress() const
@@ -236,8 +236,8 @@
 class RdataSet {
 public:
     RdataSet() {}
-    explicit RdataSet(const RdataClass& rdclass,
-                      const RdataType& rdtype,
+    explicit RdataSet(const RRClass& rdclass,
+                      const RRType& rdtype,
                       const TTL& ttl) :
         _rdclass(rdclass), _rdtype(rdtype), _ttl(ttl) {}
     void add_rdata(rdataptr_t rdata);
@@ -245,12 +245,12 @@
     string to_text() const;
     string to_wire() const;
     unsigned int count_rdata() const { return (_rdatalist.size()); }
-    const RdataClass& get_class() const { return (_rdclass); }
-    const RdataType& get_type() const { return (_rdtype); }
+    const RRClass& get_class() const { return (_rdclass); }
+    const RRType& get_type() const { return (_rdtype); }
     const TTL& getTTL() const { return (_ttl); }
 private:
-    RdataClass _rdclass;
-    RdataType _rdtype;
+    RRClass _rdclass;
+    RRType _rdtype;
     TTL _ttl;
     vector<rdataptr_t> _rdatalist;
 };
@@ -264,16 +264,16 @@
     virtual int to_wire(Message& message, section_t section) = 0;
     virtual unsigned int count_rdata() const = 0;
     virtual const Name& get_name() const = 0;
-    virtual const RdataClass& get_class() const = 0;
-    virtual const RdataType& get_type() const = 0;
+    virtual const RRClass& get_class() const = 0;
+    virtual const RRType& get_type() const = 0;
 };
 
 class RRSet : public AbstractRRSet {
 public:
     RRSet() {}
     explicit RRSet(const Name &name,
-                   const RdataClass &rdclass,
-                   const RdataType &rdtype,
+                   const RRClass &rdclass,
+                   const RRType &rdtype,
                    const TTL &ttl) :
         _name(name), _rdclass(rdclass), _rdtype(rdtype), _ttl(ttl) {}
     unsigned int count_rdata() const { return (_rdatalist.size()); }
@@ -282,34 +282,34 @@
     string to_text() const;
     int to_wire(Message& message, section_t section);
     const Name& get_name() const { return (_name); } 
-    const RdataClass& get_class() const { return (_rdclass); }
-    const RdataType& get_type() const { return (_rdtype); }
+    const RRClass& get_class() const { return (_rdclass); }
+    const RRType& get_type() const { return (_rdtype); }
     const TTL& get_ttl() const { return (_ttl); }
     template <typename T> void get_rdatalist(vector<T>&) const;
 private:
     Name _name;
-    RdataClass _rdclass;
-    RdataType _rdtype;
+    RRClass _rdclass;
+    RRType _rdtype;
     TTL _ttl;
     vector<rdataptr_t> _rdatalist;
 };
 
 class Question : public AbstractRRSet { // generic Question section entry
 public:
-    explicit Question(const Name& name, const RdataClass& rdclass,
-             const RdataType& rdtype) :
+    explicit Question(const Name& name, const RRClass& rdclass,
+             const RRType& rdtype) :
         _name(name), _rdclass(rdclass), _rdtype(rdtype) {}
     string to_text() const;
     int to_wire(Message& message, section_t section);
     unsigned int count_rdata() const { return (0); }
     const Name& get_name() const { return (_name); } 
-    const RdataClass& get_class() const { return (_rdclass); }
-    const RdataType& get_type() const { return (_rdtype); }
+    const RRClass& get_class() const { return (_rdclass); }
+    const RRType& get_type() const { return (_rdtype); }
     
 private:
     Name _name;
-    RdataClass _rdclass;
-    RdataType _rdtype;
+    RRClass _rdclass;
+    RRType _rdtype;
 };
 
 // TBD: this interface should be revisited.
@@ -336,16 +336,16 @@
 public:
     RR() {}
     explicit RR(const string& rrstr);
-    explicit RR(const Name &name, const RdataClass &rdclass,
-                const RdataType &rdtype, const TTL &ttl,
+    explicit RR(const Name &name, const RRClass &rdclass,
+                const RRType &rdtype, const TTL &ttl,
                 const Rdata &rdata);
     string to_text() const
     { return (_rrset.to_text()); }
     const Name& get_name() const
     { return (_rrset.get_name()); }
-    const RdataClass& get_class() const
+    const RRClass& get_class() const
     { return (_rrset.get_class()); }
-    const RdataType& get_type() const
+    const RRType& get_type() const
     { return (_rrset.get_type()); }
     const TTL& get_ttl() const { return (_rrset.get_ttl()); }
 private:




More information about the bind10-changes mailing list