Commit d8a28660 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

hide UNUSED_PARAM attributes in .cc, not .h as it wouldn't be good to

include "config.h" in public header files.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1610 e5f2f494-b856-4b98-b285-d166d9295462
parent c9342985
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
// $Id$ // $Id$
#include "config.h"
#include <cassert> #include <cassert>
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
...@@ -893,29 +895,90 @@ Nsec3Param::getHash(const Name& name) const { ...@@ -893,29 +895,90 @@ Nsec3Param::getHash(const Name& name) const {
uint8_t digest[SHA1_HASHSIZE]; uint8_t digest[SHA1_HASHSIZE];
uint8_t* input = (uint8_t*) buf.getData(); uint8_t* input = (uint8_t*) buf.getData();
size_t inlength = buf.getLength(); size_t inlength = buf.getLength();
uint8_t saltlen = salt_.size(); const uint8_t saltlen = salt_.size();
uint8_t salt[saltlen];
for (int i = 0; i < saltlen; ++i) {
salt[i] = salt_[i];
}
int n = 0; int n = 0;
SHA1Context sha; SHA1Context sha;
do { do {
SHA1Reset(&sha); SHA1Reset(&sha);
SHA1Input(&sha, input, inlength); SHA1Input(&sha, input, inlength);
SHA1Input(&sha, salt, saltlen); SHA1Input(&sha, &salt_[0], saltlen);
SHA1Result(&sha, digest); SHA1Result(&sha, digest);
input = digest; input = digest;
inlength = SHA1_HASHSIZE; inlength = SHA1_HASHSIZE;
} while (n++ < iterations_); } while (n++ < iterations_);
vector<uint8_t> result; return (encodeBase32(vector<uint8_t>(digest, digest + SHA1_HASHSIZE)));
for (int i = 0; i < SHA1_HASHSIZE; ++i) { }
result.push_back(digest[i]);
} //
// 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);
}
return (encodeBase32(result)); 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);
} }
} }
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
#ifndef __DATA_SOURCE_H #ifndef __DATA_SOURCE_H
#define __DATA_SOURCE_H #define __DATA_SOURCE_H
#include "config.h"
#include <stdint.h> #include <stdint.h>
#include <vector> #include <vector>
...@@ -190,8 +188,7 @@ public: ...@@ -190,8 +188,7 @@ public:
void setClass(const isc::dns::RRClass& c) { rrclass = c; } void setClass(const isc::dns::RRClass& c) { rrclass = c; }
Result init() { return NOT_IMPLEMENTED; } Result init() { return NOT_IMPLEMENTED; }
Result init(const isc::data::ElementPtr config UNUSED_PARAM) Result init(const isc::data::ElementPtr config);
{ return NOT_IMPLEMENTED; }
Result close() { return NOT_IMPLEMENTED; } Result close() { return NOT_IMPLEMENTED; }
virtual Result findRRset(const isc::dns::Name& qname, virtual Result findRRset(const isc::dns::Name& qname,
...@@ -263,59 +260,39 @@ public: ...@@ -263,59 +260,39 @@ public:
// to get a pointer to the best concrete data source for the specified // to get a pointer to the best concrete data source for the specified
// zone, then send all queries directly to that data source. // zone, then send all queries directly to that data source.
Result findRRset(const isc::dns::Name& qname UNUSED_PARAM, Result findRRset(const isc::dns::Name& qname,
const isc::dns::RRClass& qclass UNUSED_PARAM, const isc::dns::RRClass& qclass,
const isc::dns::RRType& qtype UNUSED_PARAM, const isc::dns::RRType& qtype,
isc::dns::RRsetList& target UNUSED_PARAM, isc::dns::RRsetList& target,
uint32_t& flags UNUSED_PARAM, uint32_t& flags,
const isc::dns::Name* zonename UNUSED_PARAM) const const isc::dns::Name* zonename) const;
{
return (NOT_IMPLEMENTED); Result findExactRRset(const isc::dns::Name& qname,
} const isc::dns::RRClass& qclass,
const isc::dns::RRType& qtype,
Result findExactRRset(const isc::dns::Name& qname UNUSED_PARAM, isc::dns::RRsetList& target,
const isc::dns::RRClass& qclass UNUSED_PARAM, uint32_t& flags,
const isc::dns::RRType& qtype UNUSED_PARAM, const isc::dns::Name* zonename) const;
isc::dns::RRsetList& target UNUSED_PARAM,
uint32_t& flags UNUSED_PARAM, Result findAddrs(const isc::dns::Name& qname,
const isc::dns::Name* zonename UNUSED_PARAM) const const isc::dns::RRClass& qclass,
{ isc::dns::RRsetList& target,
return (NOT_IMPLEMENTED); uint32_t& flags,
} const isc::dns::Name* zonename) const;
Result findAddrs(const isc::dns::Name& qname UNUSED_PARAM, Result findReferral(const isc::dns::Name& qname,
const isc::dns::RRClass& qclass UNUSED_PARAM, const isc::dns::RRClass& qclass,
isc::dns::RRsetList& target UNUSED_PARAM, isc::dns::RRsetList& target,
uint32_t& flags UNUSED_PARAM, uint32_t& flags,
const isc::dns::Name* zonename UNUSED_PARAM) const const isc::dns::Name* zonename) const;
{
return (NOT_IMPLEMENTED); virtual Result findPreviousName(const isc::dns::Name& qname,
} isc::dns::Name& target,
const isc::dns::Name* zonename) const;
Result findReferral(const isc::dns::Name& qname UNUSED_PARAM,
const isc::dns::RRClass& qclass UNUSED_PARAM, virtual Result findCoveringNSEC3(const isc::dns::Name& zonename,
isc::dns::RRsetList& target UNUSED_PARAM, std::string& hash,
uint32_t& flags UNUSED_PARAM, isc::dns::RRsetList& target) const;
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);
}
private: private:
std::vector<ConstDataSrcPtr> data_sources; std::vector<ConstDataSrcPtr> data_sources;
......
...@@ -251,14 +251,19 @@ StaticDataSrc::findCoveringNSEC3(const Name& zonename UNUSED_PARAM, ...@@ -251,14 +251,19 @@ StaticDataSrc::findCoveringNSEC3(const Name& zonename UNUSED_PARAM,
} }
DataSrc::Result DataSrc::Result
StaticDataSrc::init() StaticDataSrc::init() {
{
return (SUCCESS); return (SUCCESS);
} }
// Static data source is "configuration less", so the \c config parameter
// is intentionally ignored.
DataSrc::Result DataSrc::Result
StaticDataSrc::close() StaticDataSrc::init(const isc::data::ElementPtr config UNUSED_PARAM) {
{ return init();
}
DataSrc::Result
StaticDataSrc::close() {
return (SUCCESS); return (SUCCESS);
} }
......
...@@ -84,10 +84,7 @@ public: ...@@ -84,10 +84,7 @@ public:
isc::dns::RRsetList& target) const; isc::dns::RRsetList& target) const;
Result init(); Result init();
// Static data source is "configuration less", so the \c config parameter Result init(const isc::data::ElementPtr config);
// is intentionally ignored.
Result init(const isc::data::ElementPtr config UNUSED_PARAM)
{ return init(); };
Result close(); Result close();
private: private:
StaticDataSrcImpl* impl_; StaticDataSrcImpl* impl_;
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
// $Id$ // $Id$
#include "config.h"
#include "data.h" #include "data.h"
#include <cstdio> #include <cstdio>
...@@ -24,8 +26,8 @@ ...@@ -24,8 +26,8 @@
#include <boost/algorithm/string.hpp> // for iequals #include <boost/algorithm/string.hpp> // for iequals
using namespace std; using namespace std;
using namespace isc::data;
namespace {
const unsigned char PROTOCOL_VERSION[4] = { 0x53, 0x6b, 0x61, 0x6e }; const unsigned char PROTOCOL_VERSION[4] = { 0x53, 0x6b, 0x61, 0x6e };
const unsigned char ITEM_BLOB = 0x01; const unsigned char ITEM_BLOB = 0x01;
...@@ -42,10 +44,138 @@ const unsigned char ITEM_LENGTH_32 = 0x00; ...@@ -42,10 +44,138 @@ const unsigned char ITEM_LENGTH_32 = 0x00;
const unsigned char ITEM_LENGTH_16 = 0x10; const unsigned char ITEM_LENGTH_16 = 0x10;
const unsigned char ITEM_LENGTH_8 = 0x20; const unsigned char ITEM_LENGTH_8 = 0x20;
const unsigned char ITEM_LENGTH_MASK = 0x30; const unsigned char ITEM_LENGTH_MASK = 0x30;
}
namespace isc { namespace isc {
namespace data { 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 { namespace {
inline void inline void
throwParseError(const std::string& error, const std::string& file, int line = 0, int pos = 0) throwParseError(const std::string& error, const std::string& file, int line = 0, int pos = 0)
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
#ifndef _ISC_DATA_H #ifndef _ISC_DATA_H
#define _ISC_DATA_H 1 #define _ISC_DATA_H 1
#include "config.h"
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
...@@ -157,14 +155,12 @@ public: ...@@ -157,14 +155,12 @@ public:
/// data to the given reference and returning true /// data to the given reference and returning true
/// ///
//@{ //@{
virtual bool getValue(int& t UNUSED_PARAM) { return false; }; virtual bool getValue(int& t);
virtual bool getValue(double& t UNUSED_PARAM) { return false; }; virtual bool getValue(double& t);
virtual bool getValue(bool& t UNUSED_PARAM) { return false; }; virtual bool getValue(bool& t);
virtual bool getValue(std::string& t UNUSED_PARAM) { return false; }; virtual bool getValue(std::string& t);
virtual bool getValue(std::vector<ElementPtr>& t UNUSED_PARAM) virtual bool getValue(std::vector<ElementPtr>& t);
{ return false; }; virtual bool getValue(std::map<std::string, ElementPtr>& t);
virtual bool getValue(std::map<std::string, ElementPtr>& t UNUSED_PARAM)
{ return false; };
//@} //@}
/// ///
/// \name Exception-safe setters. /// \name Exception-safe setters.
...@@ -174,15 +170,12 @@ public: ...@@ -174,15 +170,12 @@ public:
/// is of the correct type /// is of the correct type
/// ///
//@{ //@{
virtual bool setValue(const int v UNUSED_PARAM) { return false; }; virtual bool setValue(const int v);
virtual bool setValue(const double v UNUSED_PARAM) { return false; }; virtual bool setValue(const double v);
virtual bool setValue(const bool t UNUSED_PARAM) { return false; }; virtual bool setValue(const bool t);
virtual bool setValue(const std::string& v UNUSED_PARAM) { return false; }; virtual bool setValue(const std::string& v);
virtual bool setValue(const std::vector<ElementPtr>& v UNUSED_PARAM) virtual bool setValue(const std::vector<ElementPtr>& v);
{ return false; }; virtual bool setValue(const std::map<std::string, ElementPtr>& v);
virtual bool setValue(const std::map<std::string,
ElementPtr>& v UNUSED_PARAM)
{ return false; };
//@} //@}
...@@ -197,26 +190,21 @@ public: ...@@ -197,26 +190,21 @@ public:
/// Returns the ElementPtr at the given index. If the index is out /// Returns the ElementPtr at the given index. If the index is out
/// of bounds, this function throws an std::out_of_range exception. /// of bounds, this function throws an std::out_of_range exception.
/// \param i The position of the ElementPtr to return /// \param i The position of the ElementPtr to return
virtual ElementPtr get(const int i UNUSED_PARAM) virtual ElementPtr get(const int i);
{ isc_throw(TypeError, "get(int) called on a non-list Element"); };
/// Sets the ElementPtr at the given index. If the index is out /// Sets the ElementPtr at the given index. If the index is out
/// of bounds, this function throws an std::out_of_range exception. /// of bounds, this function throws an std::out_of_range exception.
/// \param i The position of the ElementPtr to set /// \param i The position of the ElementPtr to set
/// \param element The ElementPtr to set at the position /// \param element The ElementPtr to set at the position
virtual void set(const size_t i UNUSED_PARAM, virtual void set(const size_t i, ElementPtr element);
ElementPtr element UNUSED_PARAM)
{ isc_throw(TypeError, "set(int, element) called on a non-list Element"); };
/// Adds an ElementPtr to the list /// Adds an ElementPtr to the list
/// \param element The ElementPtr to add /// \param element The ElementPtr to add
virtual void add(ElementPtr element UNUSED_PARAM) virtual void add(ElementPtr element);
{ isc_throw(TypeError, "add() called on a non-list Element"); };
/// Removes the element at the given position. If the index is out /// Removes the element at the given position. If the index is out
/// of nothing happens. /// of nothing happens.
/// \param i The index of the element to remove. /// \param i The index of the element to remove.
virtual void remove(const int i UNUSED_PARAM) virtual void remove(const int i);
{ isc_throw(TypeError, "remove(int) called on a non-list Element"); };
/// Returns the number of elements in the list. /// 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 /// \name MapElement functions
...@@ -227,22 +215,17 @@ public: ...@@ -227,22 +215,17 @@ public:
/// Returns the ElementPtr at the given key /// Returns the ElementPtr at the given key
/// \param name The key of the Element to return /// \param name The key of the Element to return
/// \return The ElementPtr at the given key /// \return The ElementPtr at the given key
virtual ElementPtr get(const std::string& name UNUSED_PARAM) virtual ElementPtr get(const std::string& name);
{ isc_throw(TypeError, "get(string) called on a non-map Element"); } ;
/// Sets the ElementPtr at the given key /// Sets the ElementPtr at the given key
/// \param name The key of the Element to set /// \param name The key of the Element to set
virtual void set(const std::string& name UNUSED_PARAM, virtual void set(const std::string& name, ElementPtr element);
ElementPtr element UNUSED_PARAM)
{ isc_throw(TypeError, "set(name, element) called on a non-map Element"); };
/// Remove the ElementPtr at the given key /// Remove the ElementPtr at the given key
/// \param name The key of the Element to remove /// \param name The key of the Element to remove
virtual void remove(const std::string& name UNUSED_PARAM) virtual void remove(const std::string& name);
{ isc_throw(TypeError, "remove(string) called on a non-map Element"); };
/// Checks if there is data at the given key /// Checks if there is data at the given key
/// \param name The key of the Element to remove /// \param name The key of the Element to remove
/// \return true if there is data at the key, false if not. /// \return true if there is data at the key, false if not.
virtual bool contains(const std::string& name UNUSED_PARAM) virtual bool contains(const std::string& name);
{ isc_throw(TypeError, "contains(string) called on a non-map Element"); }
/// Recursively finds any data at the given identifier. The /// Recursively finds any data at the given identifier. The
/// identifier is a /-separated list of names of nested maps, with /// identifier is a /-separated list of names of nested maps, with
/// the last name being the leaf that is returned. /// the last name being the leaf that is returned.
...@@ -256,15 +239,12 @@ public: ...@@ -256,15 +239,12 @@ public:
/// \return The ElementPtr at the given identifier. Returns a /// \return The ElementPtr at the given identifier. Returns a