[svn] commit: r1610 - in /trunk/src/lib: auth/data_source.cc auth/data_source.h auth/static_datasrc.cc auth/static_datasrc.h cc/data.cc cc/data.h config/tests/ccsession_unittests.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Mar 19 19:58:38 UTC 2010
Author: jinmei
Date: Fri Mar 19 19:58:38 2010
New Revision: 1610
Log:
hide UNUSED_PARAM attributes in .cc, not .h as it wouldn't be good to
include "config.h" in public header files.
Modified:
trunk/src/lib/auth/data_source.cc
trunk/src/lib/auth/data_source.h
trunk/src/lib/auth/static_datasrc.cc
trunk/src/lib/auth/static_datasrc.h
trunk/src/lib/cc/data.cc
trunk/src/lib/cc/data.h
trunk/src/lib/config/tests/ccsession_unittests.cc
Modified: trunk/src/lib/auth/data_source.cc
==============================================================================
--- trunk/src/lib/auth/data_source.cc (original)
+++ trunk/src/lib/auth/data_source.cc Fri Mar 19 19:58:38 2010
@@ -13,6 +13,8 @@
// PERFORMANCE OF THIS SOFTWARE.
// $Id$
+
+#include "config.h"
#include <cassert>
#include <iomanip>
@@ -893,30 +895,91 @@
uint8_t digest[SHA1_HASHSIZE];
uint8_t* input = (uint8_t*) buf.getData();
size_t inlength = buf.getLength();
- uint8_t saltlen = salt_.size();
- uint8_t salt[saltlen];
- for (int i = 0; i < saltlen; ++i) {
- salt[i] = salt_[i];
- }
+ const uint8_t saltlen = salt_.size();
int n = 0;
SHA1Context sha;
do {
SHA1Reset(&sha);
SHA1Input(&sha, input, inlength);
- SHA1Input(&sha, salt, saltlen);
+ SHA1Input(&sha, &salt_[0], saltlen);
SHA1Result(&sha, digest);
input = digest;
inlength = SHA1_HASHSIZE;
} while (n++ < iterations_);
- vector<uint8_t> result;
- for (int i = 0; i < SHA1_HASHSIZE; ++i) {
- result.push_back(digest[i]);
- }
-
- return (encodeBase32(result));
-}
-
-}
-}
+ return (encodeBase32(vector<uint8_t>(digest, digest + SHA1_HASHSIZE)));
+}
+
+//
+// The following methods are effectively empty, and their parameters are
+// unused. To silence compilers that warn unused function parameters,
+// we specify a (compiler dependent) special keyword when available.
+// It's defined in config.h, and to avoid including this header file from
+// installed files we define the methods here.
+//
+DataSrc::Result
+DataSrc::init(const isc::data::ElementPtr config UNUSED_PARAM) {
+ return NOT_IMPLEMENTED;
+}
+
+DataSrc::Result
+MetaDataSrc::findRRset(const isc::dns::Name& qname UNUSED_PARAM,
+ const isc::dns::RRClass& qclass UNUSED_PARAM,
+ const isc::dns::RRType& qtype UNUSED_PARAM,
+ isc::dns::RRsetList& target UNUSED_PARAM,
+ uint32_t& flags UNUSED_PARAM,
+ const isc::dns::Name* zonename UNUSED_PARAM) const
+{
+ return (NOT_IMPLEMENTED);
+}
+
+DataSrc::Result
+MetaDataSrc::findExactRRset(const isc::dns::Name& qname UNUSED_PARAM,
+ const isc::dns::RRClass& qclass UNUSED_PARAM,
+ const isc::dns::RRType& qtype UNUSED_PARAM,
+ isc::dns::RRsetList& target UNUSED_PARAM,
+ uint32_t& flags UNUSED_PARAM,
+ const isc::dns::Name* zonename UNUSED_PARAM) const
+{
+ return (NOT_IMPLEMENTED);
+}
+
+DataSrc::Result
+MetaDataSrc::findAddrs(const isc::dns::Name& qname UNUSED_PARAM,
+ const isc::dns::RRClass& qclass UNUSED_PARAM,
+ isc::dns::RRsetList& target UNUSED_PARAM,
+ uint32_t& flags UNUSED_PARAM,
+ const isc::dns::Name* zonename UNUSED_PARAM) const
+{
+ return (NOT_IMPLEMENTED);
+}
+
+DataSrc::Result
+MetaDataSrc::findReferral(const isc::dns::Name& qname UNUSED_PARAM,
+ const isc::dns::RRClass& qclass UNUSED_PARAM,
+ isc::dns::RRsetList& target UNUSED_PARAM,
+ uint32_t& flags UNUSED_PARAM,
+ const isc::dns::Name* zonename UNUSED_PARAM) const
+{
+ return (NOT_IMPLEMENTED);
+}
+
+DataSrc::Result
+MetaDataSrc::findPreviousName(const isc::dns::Name& qname UNUSED_PARAM,
+ isc::dns::Name& target UNUSED_PARAM,
+ const isc::dns::Name* zonename UNUSED_PARAM) const
+{
+ return (NOT_IMPLEMENTED);
+}
+
+DataSrc::Result
+MetaDataSrc::findCoveringNSEC3(const isc::dns::Name& zonename UNUSED_PARAM,
+ std::string& hash UNUSED_PARAM,
+ isc::dns::RRsetList& target UNUSED_PARAM) const
+{
+ return (NOT_IMPLEMENTED);
+}
+
+}
+}
Modified: trunk/src/lib/auth/data_source.h
==============================================================================
--- trunk/src/lib/auth/data_source.h (original)
+++ trunk/src/lib/auth/data_source.h Fri Mar 19 19:58:38 2010
@@ -16,8 +16,6 @@
#ifndef __DATA_SOURCE_H
#define __DATA_SOURCE_H
-
-#include "config.h"
#include <stdint.h>
@@ -190,8 +188,7 @@
void setClass(const isc::dns::RRClass& c) { rrclass = c; }
Result init() { return NOT_IMPLEMENTED; }
- Result init(const isc::data::ElementPtr config UNUSED_PARAM)
- { return NOT_IMPLEMENTED; }
+ Result init(const isc::data::ElementPtr config);
Result close() { return NOT_IMPLEMENTED; }
virtual Result findRRset(const isc::dns::Name& qname,
@@ -263,59 +260,39 @@
// to get a pointer to the best concrete data source for the specified
// zone, then send all queries directly to that data source.
- Result findRRset(const isc::dns::Name& qname UNUSED_PARAM,
- const isc::dns::RRClass& qclass UNUSED_PARAM,
- const isc::dns::RRType& qtype UNUSED_PARAM,
- isc::dns::RRsetList& target UNUSED_PARAM,
- uint32_t& flags UNUSED_PARAM,
- const isc::dns::Name* zonename UNUSED_PARAM) const
- {
- return (NOT_IMPLEMENTED);
- }
-
- Result findExactRRset(const isc::dns::Name& qname UNUSED_PARAM,
- const isc::dns::RRClass& qclass UNUSED_PARAM,
- const isc::dns::RRType& qtype UNUSED_PARAM,
- isc::dns::RRsetList& target UNUSED_PARAM,
- uint32_t& flags UNUSED_PARAM,
- const isc::dns::Name* zonename UNUSED_PARAM) const
- {
- return (NOT_IMPLEMENTED);
- }
-
- Result findAddrs(const isc::dns::Name& qname UNUSED_PARAM,
- const isc::dns::RRClass& qclass UNUSED_PARAM,
- isc::dns::RRsetList& target UNUSED_PARAM,
- uint32_t& flags UNUSED_PARAM,
- const isc::dns::Name* zonename UNUSED_PARAM) const
- {
- return (NOT_IMPLEMENTED);
- }
-
- Result findReferral(const isc::dns::Name& qname UNUSED_PARAM,
- const isc::dns::RRClass& qclass UNUSED_PARAM,
- isc::dns::RRsetList& target UNUSED_PARAM,
- uint32_t& flags UNUSED_PARAM,
- const isc::dns::Name* zonename UNUSED_PARAM) const
- {
- return (NOT_IMPLEMENTED);
- }
-
- virtual Result findPreviousName(
- const isc::dns::Name& qname UNUSED_PARAM,
- isc::dns::Name& target UNUSED_PARAM,
- const isc::dns::Name* zonename UNUSED_PARAM) const
- {
- return (NOT_IMPLEMENTED);
- }
-
- virtual Result findCoveringNSEC3(
- const isc::dns::Name& zonename UNUSED_PARAM,
- std::string& hash UNUSED_PARAM,
- isc::dns::RRsetList& target UNUSED_PARAM) const
- {
- return (NOT_IMPLEMENTED);
- }
+ Result findRRset(const isc::dns::Name& qname,
+ const isc::dns::RRClass& qclass,
+ const isc::dns::RRType& qtype,
+ isc::dns::RRsetList& target,
+ uint32_t& flags,
+ const isc::dns::Name* zonename) const;
+
+ Result findExactRRset(const isc::dns::Name& qname,
+ const isc::dns::RRClass& qclass,
+ const isc::dns::RRType& qtype,
+ isc::dns::RRsetList& target,
+ uint32_t& flags,
+ const isc::dns::Name* zonename) const;
+
+ Result findAddrs(const isc::dns::Name& qname,
+ const isc::dns::RRClass& qclass,
+ isc::dns::RRsetList& target,
+ uint32_t& flags,
+ const isc::dns::Name* zonename) const;
+
+ Result findReferral(const isc::dns::Name& qname,
+ const isc::dns::RRClass& qclass,
+ isc::dns::RRsetList& target,
+ uint32_t& flags,
+ const isc::dns::Name* zonename) const;
+
+ virtual Result findPreviousName(const isc::dns::Name& qname,
+ isc::dns::Name& target,
+ const isc::dns::Name* zonename) const;
+
+ virtual Result findCoveringNSEC3(const isc::dns::Name& zonename,
+ std::string& hash,
+ isc::dns::RRsetList& target) const;
private:
std::vector<ConstDataSrcPtr> data_sources;
Modified: trunk/src/lib/auth/static_datasrc.cc
==============================================================================
--- trunk/src/lib/auth/static_datasrc.cc (original)
+++ trunk/src/lib/auth/static_datasrc.cc Fri Mar 19 19:58:38 2010
@@ -251,14 +251,19 @@
}
DataSrc::Result
-StaticDataSrc::init()
-{
+StaticDataSrc::init() {
return (SUCCESS);
}
-DataSrc::Result
-StaticDataSrc::close()
-{
+// Static data source is "configuration less", so the \c config parameter
+// is intentionally ignored.
+DataSrc::Result
+StaticDataSrc::init(const isc::data::ElementPtr config UNUSED_PARAM) {
+ return init();
+}
+
+DataSrc::Result
+StaticDataSrc::close() {
return (SUCCESS);
}
Modified: trunk/src/lib/auth/static_datasrc.h
==============================================================================
--- trunk/src/lib/auth/static_datasrc.h (original)
+++ trunk/src/lib/auth/static_datasrc.h Fri Mar 19 19:58:38 2010
@@ -84,10 +84,7 @@
isc::dns::RRsetList& target) const;
Result init();
- // Static data source is "configuration less", so the \c config parameter
- // is intentionally ignored.
- Result init(const isc::data::ElementPtr config UNUSED_PARAM)
- { return init(); };
+ Result init(const isc::data::ElementPtr config);
Result close();
private:
StaticDataSrcImpl* impl_;
Modified: trunk/src/lib/cc/data.cc
==============================================================================
--- trunk/src/lib/cc/data.cc (original)
+++ trunk/src/lib/cc/data.cc Fri Mar 19 19:58:38 2010
@@ -14,6 +14,8 @@
// $Id$
+#include "config.h"
+
#include "data.h"
#include <cstdio>
@@ -24,8 +26,8 @@
#include <boost/algorithm/string.hpp> // for iequals
using namespace std;
-using namespace isc::data;
-
+
+namespace {
const unsigned char PROTOCOL_VERSION[4] = { 0x53, 0x6b, 0x61, 0x6e };
const unsigned char ITEM_BLOB = 0x01;
@@ -42,9 +44,137 @@
const unsigned char ITEM_LENGTH_16 = 0x10;
const unsigned char ITEM_LENGTH_8 = 0x20;
const unsigned char ITEM_LENGTH_MASK = 0x30;
+}
namespace isc {
namespace data {
+
+//
+// The following methods are effectively empty, and their parameters are
+// unused. To silence compilers that warn unused function parameters,
+// we specify a (compiler dependent) special keyword when available.
+// It's defined in config.h, and to avoid including this header file from
+// installed files we define the methods here.
+//
+bool
+Element::getValue(int& t UNUSED_PARAM) {
+ return false;
+}
+
+bool
+Element::getValue(double& t UNUSED_PARAM) {
+ return false;
+}
+
+bool
+Element::getValue(bool& t UNUSED_PARAM) {
+ return false;
+}
+
+bool
+Element::getValue(std::string& t UNUSED_PARAM) {
+ return false;
+}
+
+bool
+Element::getValue(std::vector<ElementPtr>& t UNUSED_PARAM) {
+ return false;
+}
+
+bool
+Element::getValue(std::map<std::string, ElementPtr>& t UNUSED_PARAM) {
+ return false;
+}
+
+bool
+Element::setValue(const int v UNUSED_PARAM) {
+ return false;
+}
+
+bool
+Element::setValue(const double v UNUSED_PARAM) {
+ return false;
+}
+
+bool
+Element::setValue(const bool t UNUSED_PARAM) {
+ return false;
+}
+
+bool
+Element::setValue(const std::string& v UNUSED_PARAM) {
+ return false;
+}
+
+bool
+Element::setValue(const std::vector<ElementPtr>& v UNUSED_PARAM) {
+ return false;
+}
+
+bool
+Element::setValue(const std::map<std::string, ElementPtr>& v UNUSED_PARAM)
+{
+ return false;
+}
+
+ElementPtr
+Element::get(const int i UNUSED_PARAM) {
+ isc_throw(TypeError, "get(int) called on a non-list Element");
+}
+
+void
+Element::set(const size_t i UNUSED_PARAM, ElementPtr element UNUSED_PARAM) {
+ isc_throw(TypeError, "set(int, element) called on a non-list Element");
+}
+
+void
+Element::add(ElementPtr element UNUSED_PARAM) {
+ isc_throw(TypeError, "add() called on a non-list Element");
+}
+
+void
+Element::remove(const int i UNUSED_PARAM) {
+ isc_throw(TypeError, "remove(int) called on a non-list Element");
+}
+
+size_t
+Element::size() {
+ isc_throw(TypeError, "size() called on a non-list Element");
+}
+
+ElementPtr
+Element::get(const std::string& name UNUSED_PARAM) {
+ isc_throw(TypeError, "get(string) called on a non-map Element");
+}
+
+void
+Element::set(const std::string& name UNUSED_PARAM,
+ ElementPtr element UNUSED_PARAM)
+{
+ isc_throw(TypeError, "set(name, element) called on a non-map Element");
+}
+
+void
+Element::remove(const std::string& name UNUSED_PARAM) {
+ isc_throw(TypeError, "remove(string) called on a non-map Element");
+}
+
+bool
+Element::contains(const std::string& name UNUSED_PARAM) {
+ isc_throw(TypeError, "contains(string) called on a non-map Element");
+}
+
+ElementPtr
+Element::find(const std::string& identifier UNUSED_PARAM) {
+ isc_throw(TypeError, "find(string) called on a non-map Element");
+}
+
+bool
+Element::find(const std::string& identifier UNUSED_PARAM,
+ ElementPtr& t UNUSED_PARAM)
+{
+ return false;
+}
namespace {
inline void
Modified: trunk/src/lib/cc/data.h
==============================================================================
--- trunk/src/lib/cc/data.h (original)
+++ trunk/src/lib/cc/data.h Fri Mar 19 19:58:38 2010
@@ -17,8 +17,6 @@
#ifndef _ISC_DATA_H
#define _ISC_DATA_H 1
-#include "config.h"
-
#include <string>
#include <vector>
#include <map>
@@ -157,14 +155,12 @@
/// data to the given reference and returning true
///
//@{
- virtual bool getValue(int& t UNUSED_PARAM) { return false; };
- virtual bool getValue(double& t UNUSED_PARAM) { return false; };
- virtual bool getValue(bool& t UNUSED_PARAM) { return false; };
- virtual bool getValue(std::string& t UNUSED_PARAM) { return false; };
- virtual bool getValue(std::vector<ElementPtr>& t UNUSED_PARAM)
- { return false; };
- virtual bool getValue(std::map<std::string, ElementPtr>& t UNUSED_PARAM)
- { return false; };
+ virtual bool getValue(int& t);
+ virtual bool getValue(double& t);
+ virtual bool getValue(bool& t);
+ virtual bool getValue(std::string& t);
+ virtual bool getValue(std::vector<ElementPtr>& t);
+ virtual bool getValue(std::map<std::string, ElementPtr>& t);
//@}
///
/// \name Exception-safe setters.
@@ -174,15 +170,12 @@
/// is of the correct type
///
//@{
- virtual bool setValue(const int v UNUSED_PARAM) { return false; };
- virtual bool setValue(const double v UNUSED_PARAM) { return false; };
- virtual bool setValue(const bool t UNUSED_PARAM) { return false; };
- virtual bool setValue(const std::string& v UNUSED_PARAM) { return false; };
- virtual bool setValue(const std::vector<ElementPtr>& v UNUSED_PARAM)
- { return false; };
- virtual bool setValue(const std::map<std::string,
- ElementPtr>& v UNUSED_PARAM)
- { return false; };
+ virtual bool setValue(const int v);
+ virtual bool setValue(const double v);
+ virtual bool setValue(const bool t);
+ virtual bool setValue(const std::string& v);
+ virtual bool setValue(const std::vector<ElementPtr>& v);
+ virtual bool setValue(const std::map<std::string, ElementPtr>& v);
//@}
@@ -197,26 +190,21 @@
/// Returns the ElementPtr at the given index. If the index is out
/// of bounds, this function throws an std::out_of_range exception.
/// \param i The position of the ElementPtr to return
- virtual ElementPtr get(const int i UNUSED_PARAM)
- { isc_throw(TypeError, "get(int) called on a non-list Element"); };
+ virtual ElementPtr get(const int i);
/// Sets the ElementPtr at the given index. If the index is out
/// of bounds, this function throws an std::out_of_range exception.
/// \param i The position of the ElementPtr to set
/// \param element The ElementPtr to set at the position
- virtual void set(const size_t i UNUSED_PARAM,
- ElementPtr element UNUSED_PARAM)
- { isc_throw(TypeError, "set(int, element) called on a non-list Element"); };
+ virtual void set(const size_t i, ElementPtr element);
/// Adds an ElementPtr to the list
/// \param element The ElementPtr to add
- virtual void add(ElementPtr element UNUSED_PARAM)
- { isc_throw(TypeError, "add() called on a non-list Element"); };
+ virtual void add(ElementPtr element);
/// Removes the element at the given position. If the index is out
/// of nothing happens.
/// \param i The index of the element to remove.
- virtual void remove(const int i UNUSED_PARAM)
- { isc_throw(TypeError, "remove(int) called on a non-list Element"); };
+ virtual void remove(const int i);
/// Returns the number of elements in the list.
- virtual size_t size() { isc_throw(TypeError, "size() called on a non-list Element"); };
+ virtual size_t size();
//@}
/// \name MapElement functions
@@ -227,22 +215,17 @@
/// Returns the ElementPtr at the given key
/// \param name The key of the Element to return
/// \return The ElementPtr at the given key
- virtual ElementPtr get(const std::string& name UNUSED_PARAM)
- { isc_throw(TypeError, "get(string) called on a non-map Element"); } ;
+ virtual ElementPtr get(const std::string& name);
/// Sets the ElementPtr at the given key
/// \param name The key of the Element to set
- virtual void set(const std::string& name UNUSED_PARAM,
- ElementPtr element UNUSED_PARAM)
- { isc_throw(TypeError, "set(name, element) called on a non-map Element"); };
+ virtual void set(const std::string& name, ElementPtr element);
/// Remove the ElementPtr at the given key
/// \param name The key of the Element to remove
- virtual void remove(const std::string& name UNUSED_PARAM)
- { isc_throw(TypeError, "remove(string) called on a non-map Element"); };
+ virtual void remove(const std::string& name);
/// Checks if there is data at the given key
/// \param name The key of the Element to remove
/// \return true if there is data at the key, false if not.
- virtual bool contains(const std::string& name UNUSED_PARAM)
- { isc_throw(TypeError, "contains(string) called on a non-map Element"); }
+ virtual bool contains(const std::string& name);
/// Recursively finds any data at the given identifier. The
/// identifier is a /-separated list of names of nested maps, with
/// the last name being the leaf that is returned.
@@ -256,15 +239,12 @@
/// \return The ElementPtr at the given identifier. Returns a
/// null ElementPtr if it is not found, which can be checked with
/// Element::is_null(ElementPtr e).
- virtual ElementPtr find(const std::string& identifier UNUSED_PARAM)
- { isc_throw(TypeError, "find(string) called on a non-map Element"); };
+ virtual ElementPtr find(const std::string& identifier);
/// See \c Element::find()
/// \param identifier The identifier of the element to find
/// \param t Reference to store the resulting ElementPtr, if found.
/// \return true if the element was found, false if not.
- virtual bool find(const std::string& identifier UNUSED_PARAM,
- ElementPtr& t UNUSED_PARAM)
- { return false; };
+ virtual bool find(const std::string& identifier, ElementPtr& t);
//@}
/// \name Factory functions
Modified: trunk/src/lib/config/tests/ccsession_unittests.cc
==============================================================================
--- trunk/src/lib/config/tests/ccsession_unittests.cc (original)
+++ trunk/src/lib/config/tests/ccsession_unittests.cc Fri Mar 19 19:58:38 2010
@@ -13,6 +13,8 @@
// PERFORMANCE OF THIS SOFTWARE.
// $Id: module_spec_unittests.cc 1321 2010-03-11 10:17:03Z jelte $
+
+#include "config.h"
#include <gtest/gtest.h>
More information about the bind10-changes
mailing list