Browse Source

added hints to define new RDATA classes

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@642 e5f2f494-b856-4b98-b285-d166d9295462
JINMEI Tatuya 15 years ago
parent
commit
dbe66a3c8d
2 changed files with 58 additions and 2 deletions
  1. 43 0
      src/lib/dns/cpp/rdata/template.cc
  2. 15 2
      src/lib/dns/cpp/rdata/template.h

+ 43 - 0
src/lib/dns/cpp/rdata/template.cc

@@ -26,5 +26,48 @@ using namespace std;
 // BEGIN_ISC_NAMESPACE
 // BEGIN_ISC_NAMESPACE
 // BEGIN_RDATA_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_RDATA_NAMESPACE
 // END_ISC_NAMESPACE
 // END_ISC_NAMESPACE

+ 15 - 2
src/lib/dns/cpp/rdata/template.h

@@ -27,11 +27,24 @@
 
 
 // BEGIN_RDATA_NAMESPACE
 // 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:
 public:
     // BEGIN_COMMON_MEMBERS
     // BEGIN_COMMON_MEMBERS
     // END_COMMON_MEMBERS
     // END_COMMON_MEMBERS
-//};
+private:
+    // RR-type specific members are here.
+};
 
 
 // END_RDATA_NAMESPACE
 // END_RDATA_NAMESPACE
 // END_ISC_NAMESPACE
 // END_ISC_NAMESPACE