bool req_is_sig0_; // signed with valid SIG(0)
bool req_is_badsig_; // signed but bad signature
// response attributes
- bool answer_sent_; // DNS message has sent
bool res_is_truncated_; // DNS message is truncated
public:
/// \brief The constructor.
/// This constructor is mostly exception free. But it may still throw
/// a standard exception if memory allocation fails inside the method.
///
- inline QRAttributes();
+ inline QRAttributes() :
+ req_ip_version_(0), req_transport_protocol_(0),
+ req_opcode_(0),
+ req_is_edns_0_(false), req_is_edns_badver_(false),
+ req_is_dnssec_ok_(false),
+ req_is_tsig_(false), req_is_sig0_(false), req_is_badsig_(false),
+ res_is_truncated_(false)
+ {};
/// \brief The destructor.
///
/// This method never throws an exception.
///
- inline ~QRAttributes();
-
+ inline ~QRAttributes() {};
/// \brief Set query opcode.
/// \throw None
- inline void setQueryOpCode(const int opcode);
-
+ inline void setQueryOpCode(const int opcode) {
+ req_opcode_ = opcode;
+ };
/// \brief Set IP version carrying a query.
/// \throw None
- inline void setQueryIPVersion(const int ip_version);
-
+ inline void setQueryIPVersion(const int ip_version) {
+ req_ip_version_ = ip_version;
+ };
/// \brief Set transport protocol carrying a query.
/// \throw None
- inline void setQueryTransportProtocol(const int transport_protocol);
-
+ inline void setQueryTransportProtocol(const int transport_protocol) {
+ req_transport_protocol_ = transport_protocol;
+ };
/// \brief Set query EDNS attributes.
/// \throw None
- inline void setQueryEDNS(const bool is_edns_0, const bool is_edns_badver);
-
+ inline void setQueryEDNS(const bool is_edns_0, const bool is_edns_badver) {
+ req_is_edns_0_ = is_edns_0;
+ req_is_edns_badver_ = is_edns_badver;
+ };
/// \brief Set query DO bit.
/// \throw None
- inline void setQueryDO(const bool is_dnssec_ok);
-
+ inline void setQueryDO(const bool is_dnssec_ok) {
+ req_is_dnssec_ok_ = is_dnssec_ok;
+ };
/// \brief Set query TSIG attributes.
/// \throw None
inline void setQuerySig(const bool is_tsig, const bool is_sig0,
- const bool is_badsig);
-
- /// \brief Set zone origin.
- /// \throw None
- inline void setOrigin(const std::string& origin);
-
+ const bool is_badsig)
+ {
+ req_is_tsig_ = is_tsig;
+ req_is_sig0_ = is_sig0;
+ req_is_badsig_ = is_badsig;
+ };
/// \brief Set if the response is truncated.
/// \throw None
- inline void setResponseTruncated(const bool is_truncated);
-
+ inline void setResponseTruncated(const bool is_truncated) {
+ res_is_truncated_ = is_truncated;
+ };
/// \brief Reset attributes.
/// \throw None
- inline void reset();
+ inline void reset() {
+ req_ip_version_ = 0;
+ req_transport_protocol_ = 0;
+ req_opcode_ = 0;
+ req_is_edns_0_ = false;
+ req_is_edns_badver_ = false;
+ req_is_dnssec_ok_ = false;
+ req_is_tsig_ = false;
+ req_is_sig0_ = false;
+ req_is_badsig_ = false;
+ res_is_truncated_ = false;
+ };
};
-inline QRAttributes::QRAttributes() :
- req_ip_version_(0), req_transport_protocol_(0),
- req_opcode_(0),
- req_is_edns_0_(false), req_is_edns_badver_(false),
- req_is_dnssec_ok_(false),
- req_is_tsig_(false), req_is_sig0_(false), req_is_badsig_(false),
- answer_sent_(false),
- res_is_truncated_(false)
-{}
-
-inline QRAttributes::~QRAttributes()
-{}
-
-inline void
-QRAttributes::setQueryIPVersion(const int ip_version) {
- req_ip_version_ = ip_version;
-}
-
-inline void
-QRAttributes::setQueryTransportProtocol(const int transport_protocol) {
- req_transport_protocol_ = transport_protocol;
-}
-
-inline void
-QRAttributes::setQueryOpCode(const int opcode) {
- req_opcode_ = opcode;
-}
-
-inline void
-QRAttributes::setQueryEDNS(const bool is_edns_0, const bool is_edns_badver) {
- req_is_edns_0_ = is_edns_0;
- req_is_edns_badver_ = is_edns_badver;
-}
-
-inline void
-QRAttributes::setQueryDO(const bool is_dnssec_ok) {
- req_is_dnssec_ok_ = is_dnssec_ok;
-}
-
-inline void
-QRAttributes::setQuerySig(const bool is_tsig, const bool is_sig0,
- const bool is_badsig)
-{
- req_is_tsig_ = is_tsig;
- req_is_sig0_ = is_sig0;
- req_is_badsig_ = is_badsig;
-}
-
-inline void
-QRAttributes::setResponseTruncated(const bool is_truncated) {
- res_is_truncated_ = is_truncated;
-}
-
-inline void
-QRAttributes::reset() {
- req_ip_version_ = 0;
- req_transport_protocol_ = 0;
- req_opcode_ = 0;
- req_is_edns_0_ = false;
- req_is_edns_badver_ = false;
- req_is_dnssec_ok_ = false;
- req_is_tsig_ = false;
- req_is_sig0_ = false;
- req_is_badsig_ = false;
- answer_sent_ = false;
- res_is_truncated_ = false;
-}
-
/// \brief Set of query counters.
///
/// \c Counters is set of query counters class. It holds query counters
/// \param items A number of counter items to hold (greater than 0)
///
/// \throw isc::InvalidParameter \a items is 0
- explicit inline Counter(const size_t items);
+ explicit inline Counter(const size_t items) :
+ counters_(items, InitialValue)
+ {
+ if (items == 0) {
+ isc_throw(isc::InvalidParameter, "Items must not be 0");
+ }
+ };
/// The destructor.
///
/// This method never throws an exception.
- inline ~Counter();
+ inline ~Counter() {};
/// \brief Increment a counter item specified with \a type.
///
/// \param type %Counter item to increment
///
/// \throw isc::OutOfRange \a type is invalid
- inline void inc(const Counter::Type);
+ inline void inc(const Counter::Type type) {
+ if (type >= counters_.size()) {
+ isc_throw(isc::OutOfRange, "Counter type is out of range");
+ }
+ ++counters_.at(type);
+ return;
+ };
/// \brief Get the value of a counter item specified with \a type.
///
/// \param type %Counter item to get the value of
///
/// \throw isc::OutOfRange \a type is invalid
- inline const Counter::Value& get(const Counter::Type) const;
+ inline const Counter::Value& get(const Counter::Type type) const {
+ if (type >= counters_.size()) {
+ isc_throw(isc::OutOfRange, "Counter type is out of range");
+ }
+ return (counters_.at(type));
+ };
};
-inline Counter::Counter(const size_t items) :
- counters_(items, InitialValue)
-{
- if (items == 0) {
- isc_throw(isc::InvalidParameter, "Items must not be 0");
- }
-}
-
-inline Counter::~Counter() {}
-
-inline void
-Counter::inc(const Counter::Type type) {
- if(type >= counters_.size()) {
- isc_throw(isc::OutOfRange, "Counter type is out of range");
- }
- ++counters_.at(type);
- return;
-}
-
-inline const Counter::Value&
-Counter::get(const Counter::Type type) const {
- if(type >= counters_.size()) {
- isc_throw(isc::OutOfRange, "Counter type is out of range");
- }
- return (counters_.at(type));
-}
-
} // namespace statistics
} // namespace isc
// specified at the construction of this class.
CounterDictionary();
public:
- explicit inline CounterDictionary(const size_t items);
- inline ~CounterDictionary();
- inline void addElement(const std::string& name);
- inline void deleteElement(const std::string& name);
- inline Counter& getElement(const std::string& name);
- inline Counter& operator[](const std::string& name);
+ explicit inline CounterDictionary(const size_t items) :
+ items_(items)
+ {
+ // The number of items must not be 0
+ if (items == 0) {
+ isc_throw(isc::InvalidParameter, "Items must not be 0");
+ }
+ };
+ inline ~CounterDictionary() {};
+ inline void addElement(const std::string& name) {
+ // throw if the element already exists
+ if (dictionary_.count(name) != 0) {
+ isc_throw(isc::InvalidParameter,
+ "Element " << name << " already exists");
+ }
+ assert(items_ != 0);
+ // Create a new Counter and add to the map
+ dictionary_.insert(
+ DictionaryMap::value_type(name, CounterPtr(new Counter(items_))));
+ };
+ inline void deleteElement(const std::string& name) {
+ size_t result = dictionary_.erase(name);
+ if (result != 1) {
+ // If an element with specified name does not exist, throw
+ // isc::OutOfRange.
+ isc_throw(isc::OutOfRange,
+ "Element " << name << " does not exist");
+ }
+ };
+ inline Counter& getElement(const std::string& name) {
+ DictionaryMap::const_iterator i = dictionary_.find(name);
+ if (i != dictionary_.end()) {
+ // the key was found. return the element.
+ return (*(i->second));
+ } else {
+ // If an element with specified name does not exist, throw
+ // isc::OutOfRange.
+ isc_throw(isc::OutOfRange,
+ "Element " << name << " does not exist");
+ }
+ };
+ inline Counter& operator[](const std::string& name) {
+ return (getElement(name));
+ };
/// \brief \c ConstIterator is a constant iterator that provides an
/// interface for enumerating name of zones stored in CounterDictionary.
///
DictionaryMap::const_iterator iterator_;
};
- inline ConstIterator begin() const;
- inline ConstIterator end() const;
+ inline ConstIterator begin() const {
+ return (CounterDictionary::ConstIterator(dictionary_.begin()));
+ };
+ inline ConstIterator end() const {
+ return (CounterDictionary::ConstIterator(dictionary_.end()));
+ };
typedef ConstIterator const_iterator;
};
-
-inline CounterDictionary::ConstIterator
-CounterDictionary::begin() const {
- return (CounterDictionary::ConstIterator(dictionary_.begin()));
-}
-
-inline CounterDictionary::ConstIterator
-CounterDictionary::end() const {
- return (CounterDictionary::ConstIterator(dictionary_.end()));
-}
-
-// Constructor with number of items
-inline CounterDictionary::CounterDictionary(const size_t items) :
- items_(items)
-{
- // The number of items must not be 0
- if (items == 0) {
- isc_throw(isc::InvalidParameter, "Items must not be 0");
- }
-}
-
-// Destructor
-inline CounterDictionary::~CounterDictionary() {}
-
-inline void
-CounterDictionary::addElement(const std::string& name) {
- // throw if the element already exists
- if (dictionary_.count(name) != 0) {
- isc_throw(isc::InvalidParameter,
- "Element " << name << " already exists");
- }
- assert(items_ != 0);
- // Create a new Counter and add to the map
- dictionary_.insert(
- DictionaryMap::value_type(name, CounterPtr(new Counter(items_))));
-}
-
-inline void
-CounterDictionary::deleteElement(const std::string& name) {
- size_t result = dictionary_.erase(name);
- if (result != 1) {
- // If an element with specified name does not exist, throw
- // isc::OutOfRange.
- isc_throw(isc::OutOfRange, "Element " << name << " does not exist");
- }
-}
-
-inline Counter&
-CounterDictionary::getElement(const std::string& name) {
- DictionaryMap::const_iterator i = dictionary_.find(name);
- if (i != dictionary_.end()) {
- // the key was found. return the element.
- return (*(i->second));
- } else {
- // If an element with specified name does not exist, throw
- // isc::OutOfRange.
- isc_throw(isc::OutOfRange, "Element " << name << " does not exist");
- }
-}
-
-inline Counter&
-CounterDictionary::operator[](const std::string& name) {
- return (getElement(name));
-}
-
} // namespace statistics
} // namespace isc