BIND 10 trac1138, updated. 2e60562cfda15fad37550ce5996e942084131d1c Merge branch 'creatorapi'
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Aug 15 11:54:58 UTC 2011
The branch, trac1138 has been updated
discards e0215095818d30e80b59e99689f2cf0dfbbae841 (commit)
discards 10cfb9ccd5b2eb489b14804e0ea9a73c80e697e6 (commit)
discards acb5dff4449286422f23a7d5867b3bd792c888e5 (commit)
discards 69eb1a250699f481427c2d12abf14314fee9e6eb (commit)
discards a36be891057f7a2505db032768264c79f37f05e7 (commit)
discards 23b1e8bb169e058dfb11b826b1b59d606d64ce20 (commit)
discards c759e90e162192eda89c5046fa446891aac259c7 (commit)
discards 21850ab947dbdf98b1d89afc36d8bcfc6001592e (commit)
This update discarded existing revisions and left the branch pointing at
a previous point in the repository history.
* -- * -- N (2e60562cfda15fad37550ce5996e942084131d1c)
\
O -- O -- O (e0215095818d30e80b59e99689f2cf0dfbbae841)
The removed revisions are not necessarilly gone - if another reference
still refers to them they will stay in the repository.
No new revisions were added by this update.
Summary of changes:
src/lib/dns/Makefile.am | 4 -
src/lib/dns/rdata/generic/detail/txt_like.h | 164 ---------------------------
src/lib/dns/rdata/generic/spf_99.cc | 87 --------------
src/lib/dns/rdata/generic/spf_99.h | 52 ---------
src/lib/dns/rdata/generic/txt_16.cc | 121 ++++++++++++++++----
src/lib/dns/rdata/generic/txt_16.h | 11 +--
6 files changed, 100 insertions(+), 339 deletions(-)
delete mode 100644 src/lib/dns/rdata/generic/detail/txt_like.h
delete mode 100644 src/lib/dns/rdata/generic/spf_99.cc
delete mode 100644 src/lib/dns/rdata/generic/spf_99.h
-----------------------------------------------------------------------
diff --git a/src/lib/dns/Makefile.am b/src/lib/dns/Makefile.am
index 10a731f..4a0173c 100644
--- a/src/lib/dns/Makefile.am
+++ b/src/lib/dns/Makefile.am
@@ -23,7 +23,6 @@ EXTRA_DIST += rdata/generic/cname_5.cc
EXTRA_DIST += rdata/generic/cname_5.h
EXTRA_DIST += rdata/generic/detail/nsec_bitmap.cc
EXTRA_DIST += rdata/generic/detail/nsec_bitmap.h
-EXTRA_DIST += rdata/generic/detail/txt_like.h
EXTRA_DIST += rdata/generic/dname_39.cc
EXTRA_DIST += rdata/generic/dname_39.h
EXTRA_DIST += rdata/generic/dnskey_48.cc
@@ -50,8 +49,6 @@ EXTRA_DIST += rdata/generic/rrsig_46.cc
EXTRA_DIST += rdata/generic/rrsig_46.h
EXTRA_DIST += rdata/generic/soa_6.cc
EXTRA_DIST += rdata/generic/soa_6.h
-EXTRA_DIST += rdata/generic/spf_99.cc
-EXTRA_DIST += rdata/generic/spf_99.h
EXTRA_DIST += rdata/generic/txt_16.cc
EXTRA_DIST += rdata/generic/txt_16.h
EXTRA_DIST += rdata/hs_4/a_1.cc
@@ -95,7 +92,6 @@ libdns___la_SOURCES += tsigkey.h tsigkey.cc
libdns___la_SOURCES += tsigrecord.h tsigrecord.cc
libdns___la_SOURCES += rdata/generic/detail/nsec_bitmap.h
libdns___la_SOURCES += rdata/generic/detail/nsec_bitmap.cc
-libdns___la_SOURCES += rdata/generic/detail/txt_like.h
libdns___la_CPPFLAGS = $(AM_CPPFLAGS)
# Most applications of libdns++ will only implicitly rely on libcryptolink,
diff --git a/src/lib/dns/rdata/generic/detail/txt_like.h b/src/lib/dns/rdata/generic/detail/txt_like.h
deleted file mode 100644
index f740cbc..0000000
--- a/src/lib/dns/rdata/generic/detail/txt_like.h
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-#ifndef __TXT_LIKE_H
-#define __TXT_LIKE_H 1
-
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-
-using namespace std;
-using namespace isc::util;
-
-template<class Type, uint16_t typeCode>class TXTLikeImpl {
-public:
- TXTLikeImpl(InputBuffer& buffer, size_t rdata_len) {
- if (rdata_len > MAX_RDLENGTH) {
- isc_throw(InvalidRdataLength, "RDLENGTH too large: " << rdata_len);
- }
-
- if (rdata_len == 0) { // note that this couldn't happen in the loop.
- isc_throw(DNSMessageFORMERR, "Error in parsing " << RRType(typeCode) <<
- " RDATA: 0-length character string");
- }
-
- do {
- const uint8_t len = buffer.readUint8();
- if (rdata_len < len + 1) {
- isc_throw(DNSMessageFORMERR, "Error in parsing " << RRType(typeCode) <<
- " RDATA: character string length is too large: " << static_cast<int>(len));
- }
- vector<uint8_t> data(len + 1);
- data[0] = len;
- buffer.readData(&data[0] + 1, len);
- string_list_.push_back(data);
-
- rdata_len -= (len + 1);
- } while (rdata_len > 0);
- }
-
- explicit TXTLikeImpl(const std::string& txtstr) {
- // TBD: this is a simple, incomplete implementation that only supports
- // a single character-string.
-
- size_t length = txtstr.size();
- size_t pos_begin = 0;
-
- if (length > 1 && txtstr[0] == '"' && txtstr[length - 1] == '"') {
- pos_begin = 1;
- length -= 2;
- }
-
- if (length > MAX_CHARSTRING_LEN) {
- isc_throw(CharStringTooLong, RRType(typeCode) <<
- " RDATA construction from text: string length is too long: " << length);
- }
-
- // TBD: right now, we don't support escaped characters
- if (txtstr.find('\\') != string::npos) {
- isc_throw(InvalidRdataText, RRType(typeCode) <<
- " RDATA from text: escaped character is currently not supported: " << txtstr);
- }
-
- vector<uint8_t> data;
- data.reserve(length + 1);
- data.push_back(length);
- data.insert(data.end(), txtstr.begin() + pos_begin,
- txtstr.begin() + pos_begin + length);
- string_list_.push_back(data);
- }
-
- TXTLikeImpl(const TXTLikeImpl& other) :
- string_list_(other.string_list_)
- {}
-
- void
- toWire(OutputBuffer& buffer) const {
- for (vector<vector<uint8_t> >::const_iterator it = string_list_.begin();
- it != string_list_.end();
- ++it)
- {
- buffer.writeData(&(*it)[0], (*it).size());
- }
- }
-
- void
- toWire(AbstractMessageRenderer& renderer) const {
- for (vector<vector<uint8_t> >::const_iterator it = string_list_.begin();
- it != string_list_.end();
- ++it)
- {
- renderer.writeData(&(*it)[0], (*it).size());
- }
- }
-
- string
- toText() const {
- string s;
-
- // XXX: this implementation is not entirely correct. for example, it
- // should escape double-quotes if they appear in the character string.
- for (vector<vector<uint8_t> >::const_iterator it = string_list_.begin();
- it != string_list_.end();
- ++it)
- {
- if (!s.empty()) {
- s.push_back(' ');
- }
- s.push_back('"');
- s.insert(s.end(), (*it).begin() + 1, (*it).end());
- s.push_back('"');
- }
-
- return (s);
- }
-
- int
- compare(const TXTLikeImpl& other) const {
- // This implementation is not efficient. Revisit this (TBD).
- OutputBuffer this_buffer(0);
- toWire(this_buffer);
- size_t this_len = this_buffer.getLength();
-
- OutputBuffer other_buffer(0);
- other.toWire(other_buffer);
- const size_t other_len = other_buffer.getLength();
-
- const size_t cmplen = min(this_len, other_len);
- const int cmp = memcmp(this_buffer.getData(), other_buffer.getData(),
- cmplen);
- if (cmp != 0) {
- return (cmp);
- } else {
- return ((this_len == other_len) ? 0 :
- (this_len < other_len) ? -1 : 1);
- }
- }
-
-private:
- /// Note: this is a prototype version; we may reconsider
- /// this representation later.
- std::vector<std::vector<uint8_t> > string_list_;
-};
-
-// END_RDATA_NAMESPACE
-// END_ISC_NAMESPACE
-
-#endif // __TXT_LIKE_H
-
-// Local Variables:
-// mode: c++
-// End:
diff --git a/src/lib/dns/rdata/generic/spf_99.cc b/src/lib/dns/rdata/generic/spf_99.cc
deleted file mode 100644
index 492de98..0000000
--- a/src/lib/dns/rdata/generic/spf_99.cc
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-#include <stdint.h>
-#include <string.h>
-
-#include <string>
-#include <vector>
-
-#include <util/buffer.h>
-#include <dns/exceptions.h>
-#include <dns/messagerenderer.h>
-#include <dns/rdata.h>
-#include <dns/rdataclass.h>
-
-using namespace std;
-using namespace isc::util;
-
-// BEGIN_ISC_NAMESPACE
-// BEGIN_RDATA_NAMESPACE
-
-#include <dns/rdata/generic/detail/txt_like.h>
-
-SPF&
-SPF::operator=(const SPF& source) {
- if (impl_ == source.impl_) {
- return (*this);
- }
-
- SPFImpl* newimpl = new SPFImpl(*source.impl_);
- delete impl_;
- impl_ = newimpl;
-
- return (*this);
-}
-
-SPF::~SPF() {
- delete impl_;
-}
-
-SPF::SPF(InputBuffer& buffer, size_t rdata_len) :
- impl_(new SPFImpl(buffer, rdata_len))
-{}
-
-SPF::SPF(const std::string& txtstr) :
- impl_(new SPFImpl(txtstr))
-{}
-
-SPF::SPF(const SPF& other) :
- Rdata(), impl_(new SPFImpl(*other.impl_))
-{}
-
-void
-SPF::toWire(OutputBuffer& buffer) const {
- impl_->toWire(buffer);
-}
-
-void
-SPF::toWire(AbstractMessageRenderer& renderer) const {
- impl_->toWire(renderer);
-}
-
-string
-SPF::toText() const {
- return (impl_->toText());
-}
-
-int
-SPF::compare(const Rdata& other) const {
- const SPF& other_txt = dynamic_cast<const SPF&>(other);
-
- return (impl_->compare(*other_txt.impl_));
-}
-
-// END_RDATA_NAMESPACE
-// END_ISC_NAMESPACE
diff --git a/src/lib/dns/rdata/generic/spf_99.h b/src/lib/dns/rdata/generic/spf_99.h
deleted file mode 100644
index 956adb9..0000000
--- a/src/lib/dns/rdata/generic/spf_99.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-// BEGIN_HEADER_GUARD
-
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-
-#include <dns/rdata.h>
-
-// BEGIN_ISC_NAMESPACE
-
-// BEGIN_COMMON_DECLARATIONS
-// END_COMMON_DECLARATIONS
-
-// BEGIN_RDATA_NAMESPACE
-
-template<class Type, uint16_t typeCode> class TXTLikeImpl;
-
-class SPF : public Rdata {
-public:
- // BEGIN_COMMON_MEMBERS
- // END_COMMON_MEMBERS
-
- SPF& operator=(const SPF& source);
- ~SPF();
-
-private:
- typedef TXTLikeImpl<SPF, 99> SPFImpl;
- SPFImpl* impl_;
-};
-
-// END_RDATA_NAMESPACE
-// END_ISC_NAMESPACE
-// END_HEADER_GUARD
-
-// Local Variables:
-// mode: c++
-// End:
diff --git a/src/lib/dns/rdata/generic/txt_16.cc b/src/lib/dns/rdata/generic/txt_16.cc
index 418bc05..ac2ba8a 100644
--- a/src/lib/dns/rdata/generic/txt_16.cc
+++ b/src/lib/dns/rdata/generic/txt_16.cc
@@ -30,57 +30,130 @@ using namespace isc::util;
// BEGIN_ISC_NAMESPACE
// BEGIN_RDATA_NAMESPACE
-#include <dns/rdata/generic/detail/txt_like.h>
-
-TXT&
-TXT::operator=(const TXT& source) {
- if (impl_ == source.impl_) {
- return (*this);
+TXT::TXT(InputBuffer& buffer, size_t rdata_len) {
+ if (rdata_len > MAX_RDLENGTH) {
+ isc_throw(InvalidRdataLength, "RDLENGTH too large: " << rdata_len);
}
- TXTImpl* newimpl = new TXTImpl(*source.impl_);
- delete impl_;
- impl_ = newimpl;
+ if (rdata_len == 0) { // note that this couldn't happen in the loop.
+ isc_throw(DNSMessageFORMERR,
+ "Error in parsing TXT RDATA: 0-length character string");
+ }
- return (*this);
+ do {
+ const uint8_t len = buffer.readUint8();
+ if (rdata_len < len + 1) {
+ isc_throw(DNSMessageFORMERR,
+ "Error in parsing TXT RDATA: character string length "
+ "is too large: " << static_cast<int>(len));
+ }
+ vector<uint8_t> data(len + 1);
+ data[0] = len;
+ buffer.readData(&data[0] + 1, len);
+ string_list_.push_back(data);
+
+ rdata_len -= (len + 1);
+ } while (rdata_len > 0);
}
-TXT::~TXT() {
- delete impl_;
-}
+TXT::TXT(const std::string& txtstr) {
+ // TBD: this is a simple, incomplete implementation that only supports
+ // a single character-string.
-TXT::TXT(InputBuffer& buffer, size_t rdata_len) :
- impl_(new TXTImpl(buffer, rdata_len))
-{}
+ size_t length = txtstr.size();
+ size_t pos_begin = 0;
-TXT::TXT(const std::string& txtstr) :
- impl_(new TXTImpl(txtstr))
-{}
+ if (length > 1 && txtstr[0] == '"' && txtstr[length - 1] == '"') {
+ pos_begin = 1;
+ length -= 2;
+ }
+
+ if (length > MAX_CHARSTRING_LEN) {
+ isc_throw(CharStringTooLong, "TXT RDATA construction from text: "
+ "string length is too long: " << length);
+ }
+
+ // TBD: right now, we don't support escaped characters
+ if (txtstr.find('\\') != string::npos) {
+ isc_throw(InvalidRdataText, "TXT RDATA from text: "
+ "escaped character is currently not supported: " << txtstr);
+ }
+
+ vector<uint8_t> data;
+ data.reserve(length + 1);
+ data.push_back(length);
+ data.insert(data.end(), txtstr.begin() + pos_begin,
+ txtstr.begin() + pos_begin + length);
+ string_list_.push_back(data);
+}
TXT::TXT(const TXT& other) :
- Rdata(), impl_(new TXTImpl(*other.impl_))
+ Rdata(), string_list_(other.string_list_)
{}
void
TXT::toWire(OutputBuffer& buffer) const {
- impl_->toWire(buffer);
+ for (vector<vector<uint8_t> >::const_iterator it = string_list_.begin();
+ it != string_list_.end();
+ ++it)
+ {
+ buffer.writeData(&(*it)[0], (*it).size());
+ }
}
void
TXT::toWire(AbstractMessageRenderer& renderer) const {
- impl_->toWire(renderer);
+ for (vector<vector<uint8_t> >::const_iterator it = string_list_.begin();
+ it != string_list_.end();
+ ++it)
+ {
+ renderer.writeData(&(*it)[0], (*it).size());
+ }
}
string
TXT::toText() const {
- return (impl_->toText());
+ string s;
+
+ // XXX: this implementation is not entirely correct. for example, it
+ // should escape double-quotes if they appear in the character string.
+ for (vector<vector<uint8_t> >::const_iterator it = string_list_.begin();
+ it != string_list_.end();
+ ++it)
+ {
+ if (!s.empty()) {
+ s.push_back(' ');
+ }
+ s.push_back('"');
+ s.insert(s.end(), (*it).begin() + 1, (*it).end());
+ s.push_back('"');
+ }
+
+ return (s);
}
int
TXT::compare(const Rdata& other) const {
const TXT& other_txt = dynamic_cast<const TXT&>(other);
- return (impl_->compare(*other_txt.impl_));
+ // This implementation is not efficient. Revisit this (TBD).
+ OutputBuffer this_buffer(0);
+ toWire(this_buffer);
+ size_t this_len = this_buffer.getLength();
+
+ OutputBuffer other_buffer(0);
+ other_txt.toWire(other_buffer);
+ const size_t other_len = other_buffer.getLength();
+
+ const size_t cmplen = min(this_len, other_len);
+ const int cmp = memcmp(this_buffer.getData(), other_buffer.getData(),
+ cmplen);
+ if (cmp != 0) {
+ return (cmp);
+ } else {
+ return ((this_len == other_len) ? 0 :
+ (this_len < other_len) ? -1 : 1);
+ }
}
// END_RDATA_NAMESPACE
diff --git a/src/lib/dns/rdata/generic/txt_16.h b/src/lib/dns/rdata/generic/txt_16.h
index d99d69b..b4c791f 100644
--- a/src/lib/dns/rdata/generic/txt_16.h
+++ b/src/lib/dns/rdata/generic/txt_16.h
@@ -28,19 +28,14 @@
// BEGIN_RDATA_NAMESPACE
-template<class Type, uint16_t typeCode> class TXTLikeImpl;
-
class TXT : public Rdata {
public:
// BEGIN_COMMON_MEMBERS
// END_COMMON_MEMBERS
-
- TXT& operator=(const TXT& source);
- ~TXT();
-
private:
- typedef TXTLikeImpl<TXT, 16> TXTImpl;
- TXTImpl* impl_;
+ /// Note: this is a prototype version; we may reconsider
+ /// this representation later.
+ std::vector<std::vector<uint8_t> > string_list_;
};
// END_RDATA_NAMESPACE
More information about the bind10-changes
mailing list