[svn] commit: r507 - in /branches/jinmei-dnsrdata/src/lib/dns/cpp: ./ testdata/
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Jan 25 09:40:57 UTC 2010
Author: jinmei
Date: Mon Jan 25 09:40:57 2010
New Revision: 507
Log:
quick (but hopefully not so ad hoc) prototype of RRset and Message classes.
Added:
branches/jinmei-dnsrdata/src/lib/dns/cpp/message.cc
branches/jinmei-dnsrdata/src/lib/dns/cpp/question.cc
branches/jinmei-dnsrdata/src/lib/dns/cpp/question.h
branches/jinmei-dnsrdata/src/lib/dns/cpp/question_unittest.cc
branches/jinmei-dnsrdata/src/lib/dns/cpp/rrset.cc
branches/jinmei-dnsrdata/src/lib/dns/cpp/rrset.h
branches/jinmei-dnsrdata/src/lib/dns/cpp/rrset_unittest.cc
branches/jinmei-dnsrdata/src/lib/dns/cpp/testdata/rrset_toWire1
branches/jinmei-dnsrdata/src/lib/dns/cpp/testdata/rrset_toWire2
Modified:
branches/jinmei-dnsrdata/src/lib/dns/cpp/Makefile.am
branches/jinmei-dnsrdata/src/lib/dns/cpp/messagerenderer.cc
branches/jinmei-dnsrdata/src/lib/dns/cpp/messagerenderer.h
branches/jinmei-dnsrdata/src/lib/dns/cpp/rdata.h
branches/jinmei-dnsrdata/src/lib/dns/cpp/rrclass_unittest.cc
branches/jinmei-dnsrdata/src/lib/dns/cpp/rrtype_unittest.cc
Modified: branches/jinmei-dnsrdata/src/lib/dns/cpp/Makefile.am
==============================================================================
--- branches/jinmei-dnsrdata/src/lib/dns/cpp/Makefile.am (original)
+++ branches/jinmei-dnsrdata/src/lib/dns/cpp/Makefile.am Mon Jan 25 09:40:57 2010
@@ -6,7 +6,9 @@
libdns_la_SOURCES = buffer.h name.cc name.h messagerenderer.h messagerenderer.cc
libdns_la_SOURCES += rrparamregistry.h rrparamregistry.cc
libdns_la_SOURCES += rrclass.h rrclass.cc rrtype.h rrtype.cc rrttl.h rrttl.cc
-libdns_la_SOURCES += rdata.h rdata.cc
+libdns_la_SOURCES += rdata.h rdata.cc rrset.h rrset.cc
+libdns_la_SOURCES += question.h question.cc
+libdns_la_SOURCES += message.h message.cc
libdns_la_SOURCES += exceptions.h exceptions.cc
TESTS =
@@ -18,6 +20,8 @@
run_unittests_SOURCES += rrclass_unittest.cc rrtype_unittest.cc
run_unittests_SOURCES += rrttl_unittest.cc
run_unittests_SOURCES += rdata_unittest.cc
+run_unittests_SOURCES += rrset_unittest.cc
+run_unittests_SOURCES += question_unittest.cc
run_unittests_SOURCES += rrparamregistry_unittest.cc
run_unittests_SOURCES += run_unittests.cc
run_unittests_CPPFLAGS = $(GTEST_INCLUDES)
Modified: branches/jinmei-dnsrdata/src/lib/dns/cpp/messagerenderer.cc
==============================================================================
--- branches/jinmei-dnsrdata/src/lib/dns/cpp/messagerenderer.cc (original)
+++ branches/jinmei-dnsrdata/src/lib/dns/cpp/messagerenderer.cc Mon Jan 25 09:40:57 2010
@@ -157,9 +157,21 @@
}
void
+MessageRenderer::skip(size_t len)
+{
+ impl_->buffer_.skip(len);
+}
+
+void
MessageRenderer::writeUint16(uint16_t data)
{
impl_->buffer_.writeUint16(data);
+}
+
+void
+MessageRenderer::writeUint16At(uint16_t data, size_t pos)
+{
+ impl_->buffer_.writeUint16At(data, pos);
}
void
Modified: branches/jinmei-dnsrdata/src/lib/dns/cpp/messagerenderer.h
==============================================================================
--- branches/jinmei-dnsrdata/src/lib/dns/cpp/messagerenderer.h (original)
+++ branches/jinmei-dnsrdata/src/lib/dns/cpp/messagerenderer.h Mon Jan 25 09:40:57 2010
@@ -105,11 +105,31 @@
/// \name Methods for writing data into the internal buffer.
///
//@{
+ /// \brief Insert a specified length of gap at the end of the buffer.
+ ///
+ /// The caller should not assume any particular value to be inserted.
+ /// This method is provided as a shortcut to make a hole in the buffer
+ /// that is to be filled in later, e.g, by \ref writeUint16At().
+ ///
+ /// \param len The length of the gap to be inserted in bytes.
+ void skip(size_t len);
/// \brief Write an unsigned 16-bit integer in host byte order into the
/// internal buffer in network byte order.
///
/// \param data The 16-bit integer to be written into the buffer.
void writeUint16(uint16_t data);
+ /// \brief Write an unsigned 16-bit integer in host byte order at the
+ /// specified position of the internal buffer in network byte order.
+ ///
+ /// The buffer must have a sufficient room to store the given data at the
+ /// given position, that is, <code>pos + 2 < getLength()</code>;
+ /// otherwise an exception of class \c isc::dns::InvalidBufferPosition will
+ /// be thrown.
+ /// Note also that this method never extends the internal buffer.
+ ///
+ /// \param data The 16-bit integer to be written into the internal buffer.
+ /// \param pos The beginning position in the buffer to write the data.
+ void writeUint16At(uint16_t data, size_t pos);
/// \brief Write an unsigned 32-bit integer in host byte order into the
/// internal buffer in network byte order.
///
Modified: branches/jinmei-dnsrdata/src/lib/dns/cpp/rdata.h
==============================================================================
--- branches/jinmei-dnsrdata/src/lib/dns/cpp/rdata.h (original)
+++ branches/jinmei-dnsrdata/src/lib/dns/cpp/rdata.h Mon Jan 25 09:40:57 2010
@@ -182,6 +182,8 @@
const std::string& rdata_string);
RdataPtr createRdata(const RRType& rrtype, const RRClass& rrclass,
InputBuffer& buffer, size_t len);
+RdataPtr createRdata(const RRType& rrtype, const RRClass& rrclass,
+ const Rdata& source);
///
/// \brief Gives relative ordering of two names in terms of DNSSEC RDATA
Modified: branches/jinmei-dnsrdata/src/lib/dns/cpp/rrclass_unittest.cc
==============================================================================
--- branches/jinmei-dnsrdata/src/lib/dns/cpp/rrclass_unittest.cc (original)
+++ branches/jinmei-dnsrdata/src/lib/dns/cpp/rrclass_unittest.cc Mon Jan 25 09:40:57 2010
@@ -37,7 +37,7 @@
static RRClass rrclassFactoryFromWire(const char* datafile);
static const RRClass rrclass_1, rrclass_0x80, rrclass_0x800,
rrclass_0x8000, rrclass_max;
- static const uint8_t wiredata[10];
+ static const uint8_t wiredata[];
};
const RRClass RRClassTest::rrclass_1(1);
@@ -47,8 +47,8 @@
const RRClass RRClassTest::rrclass_max(0xffff);
// This is wire-format data for the above sample RRClasss rendered in the
// appearing order.
-const uint8_t RRClassTest::wiredata[10] = { 0x00, 0x01, 0x00, 0x80, 0x08,
- 0x00, 0x80, 0x00, 0xff, 0xff };
+const uint8_t RRClassTest::wiredata[] = { 0x00, 0x01, 0x00, 0x80, 0x08,
+ 0x00, 0x80, 0x00, 0xff, 0xff };
RRClass
RRClassTest::rrclassFactoryFromWire(const char* datafile)
Modified: branches/jinmei-dnsrdata/src/lib/dns/cpp/rrtype_unittest.cc
==============================================================================
--- branches/jinmei-dnsrdata/src/lib/dns/cpp/rrtype_unittest.cc (original)
+++ branches/jinmei-dnsrdata/src/lib/dns/cpp/rrtype_unittest.cc Mon Jan 25 09:40:57 2010
@@ -37,7 +37,7 @@
static RRType rrtypeFactoryFromWire(const char* datafile);
static const RRType rrtype_1, rrtype_0x80, rrtype_0x800, rrtype_0x8000,
rrtype_max;
- static const uint8_t wiredata[10];
+ static const uint8_t wiredata[];
};
const RRType RRTypeTest::rrtype_1(1);
@@ -47,8 +47,8 @@
const RRType RRTypeTest::rrtype_max(0xffff);
// This is wire-format data for the above sample RRTypes rendered in the
// appearing order.
-const uint8_t RRTypeTest::wiredata[10] = { 0x00, 0x01, 0x00, 0x80, 0x08,
- 0x00, 0x80, 0x00, 0xff, 0xff };
+const uint8_t RRTypeTest::wiredata[] = { 0x00, 0x01, 0x00, 0x80, 0x08,
+ 0x00, 0x80, 0x00, 0xff, 0xff };
RRType
RRTypeTest::rrtypeFactoryFromWire(const char* datafile)
More information about the bind10-changes
mailing list