diff options
author | Dima Volodin <dvv@isc.org> | 2011-08-10 14:59:43 +0200 |
---|---|---|
committer | Dima Volodin <dvv@isc.org> | 2011-08-10 14:59:43 +0200 |
commit | a36be891057f7a2505db032768264c79f37f05e7 (patch) | |
tree | 455f14fa2885b0a5c10004510196783fcd1cfa92 | |
parent | Merge branch 'master' into trac1140 (diff) | |
download | kea-a36be891057f7a2505db032768264c79f37f05e7.tar.xz kea-a36be891057f7a2505db032768264c79f37f05e7.zip |
[1140] cleanup along the lines of [1144]
-rw-r--r-- | src/lib/dns/Makefile.am | 4 | ||||
-rw-r--r-- | src/lib/dns/rdata/generic/detail/txt_like.h | 22 | ||||
-rw-r--r-- | src/lib/dns/rdata/generic/spf_99.cc | 19 | ||||
-rw-r--r-- | src/lib/dns/rdata/generic/spf_99.h | 43 | ||||
-rw-r--r-- | src/lib/dns/rdata/generic/txt_16.cc | 19 | ||||
-rw-r--r-- | src/lib/dns/rdata/generic/txt_16.h | 43 |
6 files changed, 16 insertions, 134 deletions
diff --git a/src/lib/dns/Makefile.am b/src/lib/dns/Makefile.am index 4a0173cb17..56444bda4b 100644 --- a/src/lib/dns/Makefile.am +++ b/src/lib/dns/Makefile.am @@ -23,6 +23,7 @@ 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 @@ -49,7 +50,7 @@ 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/txt_16.cc +EXTRA_DIST += rdata/generic/spf_99.h EXTRA_DIST += rdata/generic/txt_16.h EXTRA_DIST += rdata/hs_4/a_1.cc EXTRA_DIST += rdata/hs_4/a_1.h @@ -92,6 +93,7 @@ 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 index 3e117f0371..0f18c8add4 100644 --- a/src/lib/dns/rdata/generic/detail/txt_like.h +++ b/src/lib/dns/rdata/generic/detail/txt_like.h @@ -23,7 +23,7 @@ using namespace std; using namespace isc::util; -template<class RTYPE, uint16_t typeCode>class TXT_LIKE : public Rdata { +template<uint16_t typeCode>class TXT_LIKE : public Rdata { public: TXT_LIKE(InputBuffer& buffer, size_t rdata_len) { if (rdata_len > MAX_RDLENGTH) { @@ -31,17 +31,17 @@ public: } if (rdata_len == 0) { // note that this couldn't happen in the loop. - isc_throw(DNSMessageFORMERR, - "Error in parsing " + RRParamRegistry::getRegistry().codeToTypeText(typeCode) - + " RDATA: 0-length character string"); + isc_throw(DNSMessageFORMERR, "Error in parsing " + + RRParamRegistry::getRegistry().codeToTypeText(typeCode) + + " RDATA: 0-length character string"); } do { const uint8_t len = buffer.readUint8(); if (rdata_len < len + 1) { - isc_throw(DNSMessageFORMERR, - "Error in parsing " + RRParamRegistry::getRegistry().codeToTypeText(typeCode) - + " RDATA: character string length is too large: " << static_cast<int>(len)); + isc_throw(DNSMessageFORMERR, "Error in parsing " + + RRParamRegistry::getRegistry().codeToTypeText(typeCode) + + " RDATA: character string length is too large: " << static_cast<int>(len)); } vector<uint8_t> data(len + 1); data[0] = len; @@ -71,8 +71,8 @@ public: // TBD: right now, we don't support escaped characters if (txtstr.find('\\') != string::npos) { - isc_throw(InvalidRdataText, RRParamRegistry::getRegistry().codeToTypeText(typeCode) - + " RDATA from text: escaped character is currently not supported: " << txtstr); + isc_throw(InvalidRdataText, RRParamRegistry::getRegistry().codeToTypeText(typeCode) + + " RDATA from text: escaped character is currently not supported: " << txtstr); } vector<uint8_t> data; @@ -83,7 +83,7 @@ public: string_list_.push_back(data); } - TXT_LIKE(const RTYPE& other) : + TXT_LIKE(const TXT_LIKE& other) : Rdata(), string_list_(other.string_list_) {} @@ -130,7 +130,7 @@ public: int compare(const Rdata& other) const { - const RTYPE& other_txt = dynamic_cast<const RTYPE&>(other); + const TXT_LIKE& other_txt = dynamic_cast<const TXT_LIKE&>(other); // This implementation is not efficient. Revisit this (TBD). OutputBuffer this_buffer(0); 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 cf72d76882..0000000000 --- a/src/lib/dns/rdata/generic/spf_99.cc +++ /dev/null @@ -1,19 +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_ISC_NAMESPACE -// BEGIN_RDATA_NAMESPACE - -// 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 index 7556b4bd72..dfccec2b2c 100644 --- a/src/lib/dns/rdata/generic/spf_99.h +++ b/src/lib/dns/rdata/generic/spf_99.h @@ -33,48 +33,7 @@ #include <dns/rdata/generic/detail/txt_like.h> -class SPF : public TXT_LIKE<SPF, 99> { - friend class TXT_LIKE<SPF, 99>; - static string const id; - -public: - // BEGIN_COMMON_MEMBERS - // END_COMMON_MEMBERS - -}; - -/// explicit SPF(const std::string& type_str); -inline SPF::SPF(const std::string& type_str) : TXT_LIKE<SPF, 99>(type_str) {} - -/// SPF(isc::util::InputBuffer& buffer, size_t rdata_len); -inline SPF::SPF(isc::util::InputBuffer& buffer, size_t rdata_len) : TXT_LIKE<SPF, 99>(buffer, rdata_len) {} - -/// SPF(const SPF& other); -inline SPF::SPF(const SPF& other) : TXT_LIKE<SPF, 99>(other) {} - -/// virtual std::string toText() const; -inline std::string SPF::toText() const -{ - return TXT_LIKE<SPF, 99>::toText(); -} - -/// virtual void toWire(isc::util::OutputBuffer& buffer) const; -inline void SPF::toWire(isc::util::OutputBuffer& buffer) const -{ - TXT_LIKE<SPF, 99>::toWire(buffer); -} - -/// virtual void toWire(AbstractMessageRenderer& renderer) const; -inline void SPF::toWire(AbstractMessageRenderer& renderer) const -{ - TXT_LIKE<SPF, 99>::toWire(renderer); -} - -/// virtual int compare(const Rdata& other) const; -inline int SPF::compare(const Rdata& other) const -{ - return TXT_LIKE<SPF, 99>::compare(other); -} +typedef TXT_LIKE<99> SPF; // END_RDATA_NAMESPACE // END_ISC_NAMESPACE diff --git a/src/lib/dns/rdata/generic/txt_16.cc b/src/lib/dns/rdata/generic/txt_16.cc deleted file mode 100644 index cf72d76882..0000000000 --- a/src/lib/dns/rdata/generic/txt_16.cc +++ /dev/null @@ -1,19 +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_ISC_NAMESPACE -// BEGIN_RDATA_NAMESPACE - -// END_RDATA_NAMESPACE -// END_ISC_NAMESPACE diff --git a/src/lib/dns/rdata/generic/txt_16.h b/src/lib/dns/rdata/generic/txt_16.h index 84ac143b16..7075837e17 100644 --- a/src/lib/dns/rdata/generic/txt_16.h +++ b/src/lib/dns/rdata/generic/txt_16.h @@ -33,48 +33,7 @@ #include <dns/rdata/generic/detail/txt_like.h> -class TXT : public TXT_LIKE<TXT, 16> { - friend class TXT_LIKE<TXT, 16>; - static string const id; - -public: - // BEGIN_COMMON_MEMBERS - // END_COMMON_MEMBERS - -}; - -/// explicit TXT(const std::string& type_str); -inline TXT::TXT(const std::string& type_str) : TXT_LIKE<TXT, 16>(type_str) {} - -/// TXT(isc::util::InputBuffer& buffer, size_t rdata_len); -inline TXT::TXT(isc::util::InputBuffer& buffer, size_t rdata_len) : TXT_LIKE<TXT, 16>(buffer, rdata_len) {} - -/// TXT(const TXT& other); -inline TXT::TXT(const TXT& other) : TXT_LIKE<TXT, 16>(other) {} - -/// virtual std::string toText() const; -inline std::string TXT::toText() const -{ - return TXT_LIKE<TXT, 16>::toText(); -} - -/// virtual void toWire(isc::util::OutputBuffer& buffer) const; -inline void TXT::toWire(isc::util::OutputBuffer& buffer) const -{ - TXT_LIKE<TXT, 16>::toWire(buffer); -} - -/// virtual void toWire(AbstractMessageRenderer& renderer) const; -inline void TXT::toWire(AbstractMessageRenderer& renderer) const -{ - TXT_LIKE<TXT, 16>::toWire(renderer); -} - -/// virtual int compare(const Rdata& other) const; -inline int TXT::compare(const Rdata& other) const -{ - return TXT_LIKE<TXT, 16>::compare(other); -} +typedef TXT_LIKE<16> TXT; // END_RDATA_NAMESPACE // END_ISC_NAMESPACE |