[svn] commit: r642 - in /branches/parkinglot/src/lib/dns/cpp/rdata: template.cc template.h

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Jan 29 18:48:36 UTC 2010


Author: jinmei
Date: Fri Jan 29 18:48:36 2010
New Revision: 642

Log:
added hints to define new RDATA classes

Modified:
    branches/parkinglot/src/lib/dns/cpp/rdata/template.cc
    branches/parkinglot/src/lib/dns/cpp/rdata/template.h

Modified: branches/parkinglot/src/lib/dns/cpp/rdata/template.cc
==============================================================================
--- branches/parkinglot/src/lib/dns/cpp/rdata/template.cc (original)
+++ branches/parkinglot/src/lib/dns/cpp/rdata/template.cc Fri Jan 29 18:48:36 2010
@@ -26,5 +26,48 @@
 // BEGIN_ISC_NAMESPACE
 // BEGIN_RDATA_NAMESPACE
 
+// To add RDATA implementation of a new RR type (say "MyType"), copy this
+// template into the appropriate subdirectory with the appropriate name
+// (see template.h).
+// Then define (at least) the following common methods (that are inherited
+// from the base abstract class).
+// If you added member functions specific to this derived class, you'll need
+// to implement them here, of course.
+
+MyType::MyType(const std::string& type_str)
+{
+}
+
+MyType::MyType(InputBuffer& buffer, size_t rdata_len)
+{
+}
+
+MyType::MyType(const MyType& other)
+{
+}
+
+std::string
+MyType::toText() const
+{
+}
+
+void
+MyType::toWire(OutputBuffer& buffer) const
+{
+}
+
+void
+MyType::toWire(MessageRenderer& renderer) const
+{
+}
+
+int
+MyType::compare(const Rdata& other) const
+{
+    // The compare method normally begins with this dynamic cast.
+    const MyType& other_mytype = dynamic_cast<const MyType&>(other);
+    // ...
+}
+
 // END_RDATA_NAMESPACE
 // END_ISC_NAMESPACE

Modified: branches/parkinglot/src/lib/dns/cpp/rdata/template.h
==============================================================================
--- branches/parkinglot/src/lib/dns/cpp/rdata/template.h (original)
+++ branches/parkinglot/src/lib/dns/cpp/rdata/template.h Fri Jan 29 18:48:36 2010
@@ -27,11 +27,24 @@
 
 // BEGIN_RDATA_NAMESPACE
 
-//class XX : public Rdata {
+// To add RDATA class definition of a new RR type (say "MyType"), copy this
+// file to an appropriate subdirectory (if it's class-independent type, it
+// should go to "generic/", if it's IN-class specific, it should be in
+// "in_1/", and so on).  The copied file should be named as type_nn.h where
+// "type" is textual representation (all lower cased) of the RR type, and "nn"
+// is the 16-bit type code of the RR type.
+// Normally, you'll need to define some specific member variables in the
+// "RR-type specific members" space (please make them private).  In addition,
+// you may want to define some specific member functions, either public or
+// private (or, though unlikely for a leaf class, protected).
+
+class MyType : public Rdata {
 public:
     // BEGIN_COMMON_MEMBERS
     // END_COMMON_MEMBERS
-//};
+private:
+    // RR-type specific members are here.
+};
 
 // END_RDATA_NAMESPACE
 // END_ISC_NAMESPACE




More information about the bind10-changes mailing list