BIND 10 trac2157_2, updated. 7a821cf7fe79d72a294053865a65fe52b29394ee [2157] update item definitions

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Nov 15 10:14:31 UTC 2012


The branch, trac2157_2 has been updated
       via  7a821cf7fe79d72a294053865a65fe52b29394ee (commit)
       via  24cecc6e6249e1805160c7c6d1ed121ae57a451f (commit)
       via  0e784ad2b33879f2cfcb40921a891fb73714be68 (commit)
       via  c30ebf9ecc8b18a7b2e6ae57f6e8db582acb00c7 (commit)
       via  7dd1d39f9711ec039988a527eff33dc5912b4721 (commit)
       via  0382951b17dfa9647f4f1b4c55d021f51138aa1e (commit)
       via  d24fcdc5998f904c5b81de311066935906566ff2 (commit)
       via  01cec039d9326d4d29e501109aa3bf5b28896786 (commit)
       via  16a7ef79d27c65f25a72908244b088fd8488c729 (commit)
       via  7791af176bda3e99caffe8ca2aa2fc69d92a95dc (commit)
       via  1603af4c983f4fbebc4731177680c8c9549b4c60 (commit)
       via  fb246fec83de75f41171b48f48c314b985a985de (commit)
       via  081f73d83d9afee393283514afc4398b8515f6a3 (commit)
       via  5b92e04d29ae21a217b8ce01fe3487ccd4ca180b (commit)
       via  eeb6dd5d64907846387b886cd2aa20e018e4234e (commit)
       via  52598eb44e5c7fca9f1902be4c1e54e786b13d3b (commit)
       via  b9b6e36c4e5201c5ffb5f405ee7c4e18ee787d1d (commit)
       via  ea7ef4dac89ff14aaa752ca10ad0a1ec965ea0f4 (commit)
       via  b08a456d702942de353ae57529bdbe2d1ba22d07 (commit)
       via  f9b1652469debfcc2974149219b4098019458649 (commit)
       via  425b14dc49047c29338e415f6360a15c81b4f48c (commit)
       via  b2d762a14ce55201967f0d38e2216289b98955fd (commit)
      from  401f99d8ce662e361c4aa067e758e03b8c0a78e0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7a821cf7fe79d72a294053865a65fe52b29394ee
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 19:00:38 2012 +0900

    [2157] update item definitions

commit 24cecc6e6249e1805160c7c6d1ed121ae57a451f
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 18:46:24 2012 +0900

    [2157] only count for requests with EDNS version 0

commit 0e784ad2b33879f2cfcb40921a891fb73714be68
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 18:45:34 2012 +0900

    [2157] fix code-to-counter conversion table

commit c30ebf9ecc8b18a7b2e6ae57f6e8db582acb00c7
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 18:15:28 2012 +0900

    [2157] change need_generate condition
    
    regenerate the file if .pre file is updated

commit 7dd1d39f9711ec039988a527eff33dc5912b4721
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 18:09:25 2012 +0900

    [2157] directly convert `ConstEDNSPtr` to bool

commit 0382951b17dfa9647f4f1b4c55d021f51138aa1e
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 17:28:06 2012 +0900

    [2157] remove unnecessary #include

commit d24fcdc5998f904c5b81de311066935906566ff2
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 17:26:28 2012 +0900

    [2157] ItemTreeType renamed to ItemTreePtr, fixed markup

commit 01cec039d9326d4d29e501109aa3bf5b28896786
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 16:56:29 2012 +0900

    [2157] remove empty explicit destructor

commit 16a7ef79d27c65f25a72908244b088fd8488c729
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Oct 25 20:40:33 2012 +0900

    [2155] call reset() instead of initializer
    
    Conflicts:
    	src/bin/auth/statistics.h

commit 7791af176bda3e99caffe8ca2aa2fc69d92a95dc
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Oct 25 20:36:08 2012 +0900

    [2155] removed inline keywords from methods inside class definition
    
    Conflicts:
    	src/bin/auth/statistics.h

commit 1603af4c983f4fbebc4731177680c8c9549b4c60
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 16:44:33 2012 +0900

    [2155] added some notes to the mapping tables of counter item

commit fb246fec83de75f41171b48f48c314b985a985de
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Fri Oct 12 14:21:15 2012 +0900

    [2155] update test case according to the review comment
    
    Conflicts:
    	src/bin/auth/tests/auth_srv_unittest.cc

commit 081f73d83d9afee393283514afc4398b8515f6a3
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Wed Oct 10 19:34:26 2012 +0900

    [2155] fixed wrong comment
    
    Conflicts:
    	src/bin/auth/tests/auth_srv_unittest.cc

commit 5b92e04d29ae21a217b8ce01fe3487ccd4ca180b
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Wed Oct 10 19:32:37 2012 +0900

    [2155] inline methods in a canonical way
    
    Conflicts:
    	src/bin/auth/statistics.h

commit eeb6dd5d64907846387b886cd2aa20e018e4234e
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Wed Oct 10 19:09:58 2012 +0900

    [2155] use auto-generated copy constructor

commit 52598eb44e5c7fca9f1902be4c1e54e786b13d3b
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Wed Oct 10 18:40:50 2012 +0900

    [2155] checkCountersAllZeroExcept() returns void
    
    Conflicts:
    	src/bin/auth/tests/statistics_unittest.cc.pre

commit b9b6e36c4e5201c5ffb5f405ee7c4e18ee787d1d
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Wed Oct 10 16:31:15 2012 +0900

    [2155] added notes for including header files with EXTRA_DIST

commit ea7ef4dac89ff14aaa752ca10ad0a1ec965ea0f4
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 15:32:07 2012 +0900

    [2157] fixed doxygen comment position

commit b08a456d702942de353ae57529bdbe2d1ba22d07
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 15:22:08 2012 +0900

    [2157] specify encoding explicitly for xml.etree.ElementTree.tostring

commit f9b1652469debfcc2974149219b4098019458649
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 14:01:31 2012 +0900

    [2157] remove extra comments, remove zone_origin_

commit 425b14dc49047c29338e415f6360a15c81b4f48c
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 13:59:21 2012 +0900

    [2157] removed a member from QRAttributes

commit b2d762a14ce55201967f0d38e2216289b98955fd
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date:   Thu Nov 15 13:45:06 2012 +0900

    [2157] add note

-----------------------------------------------------------------------

Summary of changes:
 src/bin/auth/auth_srv.cc                      |   36 +++---
 src/bin/auth/auth_srv.h                       |    1 -
 src/bin/auth/gen-statistics_items.py.pre.in   |    9 +-
 src/bin/auth/statistics.cc.pre                |  119 +++++++++---------
 src/bin/auth/statistics.h                     |  161 ++++++++-----------------
 src/bin/auth/statistics_items.h.pre           |    8 +-
 src/bin/auth/statistics_qr_items.def          |   12 +-
 src/bin/auth/tests/auth_srv_unittest.cc       |   23 ++--
 src/bin/auth/tests/statistics_unittest.cc.pre |    9 +-
 src/lib/statistics/Makefile.am                |    4 +-
 src/lib/statistics/counter.h                  |   55 +++------
 src/lib/statistics/counter_dict.h             |  157 +++++++++---------------
 12 files changed, 223 insertions(+), 371 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/auth/auth_srv.cc b/src/bin/auth/auth_srv.cc
index 3ab1d00..5c3de37 100644
--- a/src/bin/auth/auth_srv.cc
+++ b/src/bin/auth/auth_srv.cc
@@ -237,7 +237,8 @@ public:
                 BaseSocketSessionForwarder& ddns_forwarder);
     ~AuthSrvImpl();
 
-    bool processNormalQuery(const IOMessage& io_message, Message& message,
+    bool processNormalQuery(const IOMessage& io_message,
+                            ConstEDNSPtr remote_edns, Message& message,
                             OutputBuffer& buffer,
                             auto_ptr<TSIGContext> tsig_context);
     bool processXfrQuery(const IOMessage& io_message, Message& message,
@@ -493,7 +494,6 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
 {
     InputBuffer request_buffer(io_message.getData(), io_message.getDataSize());
 
-    // statistics: check transport carrying the message (IP, transport)
     impl_->stats_attrs_.setQueryIPVersion(
         io_message.getRemoteEndpoint().getFamily());
     impl_->stats_attrs_.setQueryTransportProtocol(
@@ -553,8 +553,6 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
                                            **impl_->keyring_));
         tsig_error = tsig_context->verify(tsig_record, io_message.getData(),
                                           io_message.getDataSize());
-        // statistics: check TSIG attributes
-        // SIG(0) is currently not implemented in Auth
         impl_->stats_attrs_.setQuerySig(true, false,
                                         tsig_error != TSIGError::NOERROR());
     }
@@ -569,19 +567,15 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
     const Opcode opcode = message.getOpcode();
     bool send_answer = true;
     try {
-        // statistics: check EDNS
-        //     note: This can only be reliable after TSIG check succeeds.
-        {
-            ConstEDNSPtr edns = message.getEDNS();
-            if (edns != NULL) {
-                impl_->stats_attrs_.setQueryEDNS(true,
-                                                 edns->getVersion() != 0);
-                impl_->stats_attrs_.setQueryDO(edns->getDNSSECAwareness());
-            }
+        // note: This can only be reliable after TSIG check succeeds.
+        ConstEDNSPtr edns = message.getEDNS();
+        if (edns) {
+            impl_->stats_attrs_.setQueryEDNS(edns->getVersion() == 0,
+                                             edns->getVersion() != 0);
+            impl_->stats_attrs_.setQueryDO(edns->getDNSSECAwareness());
         }
 
-        // statistics: check OpCode
-        //     note: This can only be reliable after TSIG check succeeds.
+        // note: This can only be reliable after TSIG check succeeds.
         impl_->stats_attrs_.setQueryOpCode(opcode.getCode());
 
         if (opcode == Opcode::NOTIFY()) {
@@ -612,8 +606,9 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
                 send_answer = impl_->processXfrQuery(io_message, message,
                                                      buffer, tsig_context);
             } else {
-                send_answer = impl_->processNormalQuery(io_message, message,
-                                                        buffer, tsig_context);
+                send_answer = impl_->processNormalQuery(io_message, edns,
+                                                        message, buffer,
+                                                        tsig_context);
             }
         }
     } catch (const std::exception& ex) {
@@ -628,11 +623,11 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
 }
 
 bool
-AuthSrvImpl::processNormalQuery(const IOMessage& io_message, Message& message,
+AuthSrvImpl::processNormalQuery(const IOMessage& io_message,
+                                ConstEDNSPtr remote_edns, Message& message,
                                 OutputBuffer& buffer,
                                 auto_ptr<TSIGContext> tsig_context)
 {
-    ConstEDNSPtr remote_edns = message.getEDNS();
     const bool dnssec_ok = remote_edns && remote_edns->getDNSSECAwareness();
     const uint16_t remote_bufsize = remote_edns ? remote_edns->getUDPSize() :
         Message::DEFAULT_MAX_UDPSIZE;
@@ -820,11 +815,10 @@ void
 AuthSrvImpl::resumeServer(DNSServer* server, Message& message,
                           const bool done) {
     if (done) {
-        stats_attrs_.answerWasSent();
         // isTruncated from MessageRenderer
         stats_attrs_.setResponseTruncated(renderer_.isTruncated());
     }
-    counters_.inc(stats_attrs_, message);
+    counters_.inc(stats_attrs_, message, done);
     stats_attrs_.reset();
     server->resume(done);
 }
diff --git a/src/bin/auth/auth_srv.h b/src/bin/auth/auth_srv.h
index a3d8402..781b2b9 100644
--- a/src/bin/auth/auth_srv.h
+++ b/src/bin/auth/auth_srv.h
@@ -33,7 +33,6 @@
 
 #include <asiolink/asiolink.h>
 #include <server_common/portconfig.h>
-#include <auth/statistics.h>
 
 namespace isc {
 namespace util {
diff --git a/src/bin/auth/gen-statistics_items.py.pre.in b/src/bin/auth/gen-statistics_items.py.pre.in
index 544db33..816e426 100755
--- a/src/bin/auth/gen-statistics_items.py.pre.in
+++ b/src/bin/auth/gen-statistics_items.py.pre.in
@@ -34,7 +34,9 @@ def need_generate(filepath, mtime):
     To avoid unnecessary compilation, we skip (re)generating the file when
     the file already exists and newer than the base file.
     '''
-    if os.path.exists(filepath) and os.path.getmtime(filepath) > mtime:
+    if os.path.exists(filepath) and\
+        (os.path.getmtime(filepath) > mtime or
+         os.path.getmtime(filepath) > os.path.getmtime(filepath+pre_suffix)):
         return False
     return True
 
@@ -167,7 +169,8 @@ def generate_docfile(docfile, def_mtime):
 
     if need_generate(builddir+os.sep+docfile, def_mtime):
         doc_pre = open(srcdir+os.sep+docfile+pre_suffix, 'r')
-        doc_pre_xml = doc_pre.read().replace('@@LOCAL'+'STATEDIR@@', localstatedir)
+        doc_pre_xml = doc_pre.read().replace('@@LOCAL'+'STATEDIR@@',
+                                             localstatedir)
         doc_pre.close
 
         variable_tree = ElementTree.Element('variablelist')
@@ -175,7 +178,7 @@ def generate_docfile(docfile, def_mtime):
         doc = open(builddir+os.sep+docfile, 'w')
         doc.write(doc_pre_xml.replace(
             '<!-- ### STATISTICS DATA PLACEHOLDER ### -->',
-            ElementTree.tostring(variable_tree)))
+            str(ElementTree.tostring(variable_tree))))
         doc.close()
     else:
         print('skip generating ' + docfile)
diff --git a/src/bin/auth/statistics.cc.pre b/src/bin/auth/statistics.cc.pre
index e63f35d..d84eeb1 100644
--- a/src/bin/auth/statistics.cc.pre
+++ b/src/bin/auth/statistics.cc.pre
@@ -44,13 +44,13 @@ namespace {
 void
 fillNodes(const Counter& counter,
           const struct isc::auth::statistics::CounterTypeTree type_tree[],
-          isc::auth::statistics::Counters::ItemTreeType& trees)
+          isc::auth::statistics::Counters::ItemTreePtr& trees)
 {
     using namespace isc::data;
 
     for (int i = 0; type_tree[i].name != NULL; ++i) {
         if (type_tree[i].sub_tree != NULL) {
-            isc::auth::statistics::Counters::ItemTreeType sub_tree =
+            isc::auth::statistics::Counters::ItemTreePtr sub_tree =
                 Element::createMap();
             trees->set(type_tree[i].name, sub_tree);
             fillNodes(counter, type_tree[i].sub_tree, sub_tree);
@@ -71,49 +71,50 @@ namespace statistics {
 
 // ### STATISTICS ITEMS DEFINITION ###
 
-const int QROpCodeToQRCounterType[16] = {
-    QR_OPCODE_QUERY,
-    QR_OPCODE_IQUERY,
-    QR_OPCODE_STATUS,
-    QR_OPCODE_OTHER,
-    QR_OPCODE_NOTIFY,
-    QR_OPCODE_UPDATE,
-    QR_OPCODE_OTHER,
-    QR_OPCODE_OTHER,
-    QR_OPCODE_OTHER,
-    QR_OPCODE_OTHER,
-    QR_OPCODE_OTHER,
-    QR_OPCODE_OTHER,
-    QR_OPCODE_OTHER,
-    QR_OPCODE_OTHER,
-    QR_OPCODE_OTHER,
-    QR_OPCODE_OTHER
+// Note: opcode in this array must be start with 0 and be sequential
+const int opcode_to_qrcounter[] = {
+    QR_OPCODE_QUERY,    // Opcode =  0: Query
+    QR_OPCODE_IQUERY,   // Opcode =  1: Iquery
+    QR_OPCODE_STATUS,   // Opcode =  2: STATUS
+    QR_OPCODE_OTHER,    // Opcode =  3: (Unassigned)
+    QR_OPCODE_NOTIFY,   // Opcode =  4: Notify
+    QR_OPCODE_UPDATE,   // Opcode =  5: Update
+    QR_OPCODE_OTHER,    // Opcode =  6: (Unassigned)
+    QR_OPCODE_OTHER,    // Opcode =  7: (Unassigned)
+    QR_OPCODE_OTHER,    // Opcode =  8: (Unassigned)
+    QR_OPCODE_OTHER,    // Opcode =  9: (Unassigned)
+    QR_OPCODE_OTHER,    // Opcode = 10: (Unassigned)
+    QR_OPCODE_OTHER,    // Opcode = 11: (Unassigned)
+    QR_OPCODE_OTHER,    // Opcode = 12: (Unassigned)
+    QR_OPCODE_OTHER,    // Opcode = 13: (Unassigned)
+    QR_OPCODE_OTHER,    // Opcode = 14: (Unassigned)
+    QR_OPCODE_OTHER     // Opcode = 15: (Unassigned)
 };
-const int QRRCodeToQRCounterType[23] = {
-    QR_RCODE_NOERROR,
-    QR_RCODE_FORMERR,
-    QR_RCODE_SERVFAIL,
-    QR_RCODE_NXDOMAIN,
-    QR_RCODE_NOTIMP,
-    QR_RCODE_REFUSED,
-    QR_RCODE_YXDOMAIN,
-    QR_RCODE_YXRRSET,
-    QR_RCODE_NXRRSET,
-    QR_RCODE_NOTAUTH,
-    QR_RCODE_NOTZONE,
-    QR_RCODE_OTHER,
-    QR_RCODE_OTHER,
-    QR_RCODE_OTHER,
-    QR_RCODE_OTHER,
-    QR_RCODE_OTHER,
-    QR_RCODE_BADSIGVERS,
-    QR_RCODE_BADKEY,
-    QR_RCODE_BADTIME,
-    QR_RCODE_BADMODE,
-    QR_RCODE_BADNAME,
-    QR_RCODE_BADALG,
-    QR_RCODE_BADTRUNC
+const size_t num_opcode_to_qrcounter =
+    sizeof(opcode_to_qrcounter) / sizeof(opcode_to_qrcounter[0]);
+
+// Note: rcode in this array must be start with 0 and be sequential
+const int rcode_to_qrcounter[] = {
+    QR_RCODE_NOERROR,       // Rcode =  0: NoError
+    QR_RCODE_FORMERR,       // Rcode =  1: FormErr
+    QR_RCODE_SERVFAIL,      // Rcode =  2: ServFail
+    QR_RCODE_NXDOMAIN,      // Rcode =  3: NXDomain
+    QR_RCODE_NOTIMP,        // Rcode =  4: NotImp
+    QR_RCODE_REFUSED,       // Rcode =  5: Refused
+    QR_RCODE_YXDOMAIN,      // Rcode =  6: YXDomain
+    QR_RCODE_YXRRSET,       // Rcode =  7: YXRRSet
+    QR_RCODE_NXRRSET,       // Rcode =  8: NXRRSet
+    QR_RCODE_NOTAUTH,       // Rcode =  9: NotAuth
+    QR_RCODE_NOTZONE,       // Rcode = 10: NotZone
+    QR_RCODE_OTHER,         // Rcode = 11: (Unassigned)
+    QR_RCODE_OTHER,         // Rcode = 12: (Unassigned)
+    QR_RCODE_OTHER,         // Rcode = 13: (Unassigned)
+    QR_RCODE_OTHER,         // Rcode = 14: (Unassigned)
+    QR_RCODE_OTHER,         // Rcode = 15: (Unassigned)
+    QR_RCODE_BADVERS        // Rcode = 16: (BADVERS)
 };
+const size_t num_rcode_to_qrcounter =
+    sizeof(rcode_to_qrcounter) / sizeof(rcode_to_qrcounter[0]);
 
 Counters::Counters() :
     // size of server_qr_counter_, zone_qr_counters_: QR_COUNTER_TYPES
@@ -121,9 +122,6 @@ Counters::Counters() :
     zone_qr_counters_(QR_COUNTER_TYPES)
 {}
 
-Counters::~Counters()
-{}
-
 void
 Counters::incRequest(const QRAttributes& qrattrs) {
     // protocols carrying request
@@ -166,7 +164,7 @@ Counters::incRequest(const QRAttributes& qrattrs) {
     }
 
     // OPCODE
-    server_qr_counter_.inc(QROpCodeToQRCounterType[qrattrs.req_opcode_]);
+    server_qr_counter_.inc(opcode_to_qrcounter[qrattrs.req_opcode_]);
 }
 
 void
@@ -181,7 +179,7 @@ Counters::incResponse(const QRAttributes& qrattrs, const Message& response) {
 
     // response EDNS
     ConstEDNSPtr response_edns = response.getEDNS();
-    if (response_edns != NULL && response_edns->getVersion() == 0) {
+    if (response_edns && response_edns->getVersion() == 0) {
         server_qr_counter_.inc(QR_RESPONSE_EDNS0);
     }
 
@@ -195,14 +193,9 @@ Counters::incResponse(const QRAttributes& qrattrs, const Message& response) {
 
     // RCODE
     const unsigned int rcode = response.getRcode().getCode();
-    unsigned int rcode_type = QR_RCODE_OTHER;
-    if (rcode < 23) {
-        // rcode 0..22
-        rcode_type = QRRCodeToQRCounterType[rcode];
-    } else {
-        // opcode larger than 22 is reserved or unassigned
-        rcode_type = QR_RCODE_OTHER;
-    }
+    const unsigned int rcode_type =
+        rcode < num_rcode_to_qrcounter ?
+        rcode_to_qrcounter[rcode] : QR_RCODE_OTHER;
     server_qr_counter_.inc(rcode_type);
 
     // compound attributes
@@ -238,26 +231,28 @@ Counters::incResponse(const QRAttributes& qrattrs, const Message& response) {
 }
 
 void
-Counters::inc(const QRAttributes& qrattrs, const Message& response) {
+Counters::inc(const QRAttributes& qrattrs, const Message& response,
+              const bool done)
+{
     // increment request counters
     incRequest(qrattrs);
 
-    if (qrattrs.answer_sent_) {
+    if (done) {
         // increment response counters if answer was sent
         incResponse(qrattrs, response);
     }
 }
 
-Counters::ItemTreeType
+Counters::ItemTreePtr
 Counters::get() const {
     using namespace isc::data;
 
-    Counters::ItemTreeType item_tree = Element::createMap();
+    Counters::ItemTreePtr item_tree = Element::createMap();
 
-    Counters::ItemTreeType zones = Element::createMap();
+    Counters::ItemTreePtr zones = Element::createMap();
     item_tree->set("zones", zones);
 
-    Counters::ItemTreeType server = Element::createMap();
+    Counters::ItemTreePtr server = Element::createMap();
     fillNodes(server_qr_counter_, QRCounterTree, server);
     zones->set("_SERVER_", server);
 
diff --git a/src/bin/auth/statistics.h b/src/bin/auth/statistics.h
index d6ac181..5b8134d 100644
--- a/src/bin/auth/statistics.h
+++ b/src/bin/auth/statistics.h
@@ -33,7 +33,6 @@ namespace isc {
 namespace auth {
 namespace statistics {
 
-class QRAttributes {
 /// \brief Query/Response attributes for statistics.
 ///
 /// This class holds some attributes related to a query/response
@@ -41,6 +40,7 @@ class QRAttributes {
 ///
 /// This class does not have getter methods since it exposes private members
 /// to \c Counters directly.
+class QRAttributes {
 friend class Counters;
 private:
     // request attributes
@@ -53,10 +53,7 @@ private:
     bool req_is_tsig_;              // signed with valid TSIG
     bool req_is_sig0_;              // signed with valid SIG(0)
     bool req_is_badsig_;            // signed but bad signature
-    // zone origin
-    std::string zone_origin_;       // zone origin
     // response attributes
-    bool answer_sent_;              // DNS message has sent
     bool res_is_truncated_;         // DNS message is truncated
 public:
     /// \brief The constructor.
@@ -64,131 +61,73 @@ public:
     /// This constructor is mostly exception free. But it may still throw
     /// a standard exception if memory allocation fails inside the method.
     ///
-    inline QRAttributes();
-
-    /// \brief The destructor.
-    ///
-    /// This method never throws an exception.
-    ///
-    inline ~QRAttributes();
+    QRAttributes() {
+        reset();
+    };
 
     /// \brief Set query opcode.
     /// \throw None
-    inline void setQueryOpCode(const int opcode);
+    void setQueryOpCode(const int opcode) {
+        req_opcode_ = opcode;
+    };
 
     /// \brief Set IP version carrying a query.
     /// \throw None
-    inline void setQueryIPVersion(const int ip_version);
+    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);
+    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);
+    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);
+    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);
-
-    /// \brief Set if the answer has sent.
-    /// \throw None
-    inline void answerWasSent();
+    void 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;
+    };
 
     /// \brief Set if the response is truncated.
     /// \throw None
-    inline void setResponseTruncated(const bool is_truncated);
+    void setResponseTruncated(const bool is_truncated) {
+        res_is_truncated_ = is_truncated;
+    };
 
     /// \brief Reset attributes.
     /// \throw None
-    inline void reset();
+    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),
-    zone_origin_(),
-    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::answerWasSent() {
-    answer_sent_ = true;
-}
-
-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;
-    zone_origin_.clear();
-    answer_sent_ = false;
-    res_is_truncated_ = false;
-}
-
 /// \brief Set of query counters.
 ///
 /// \c Counters is set of query counters class. It holds query counters
@@ -224,6 +163,7 @@ private:
                      const isc::dns::Message& response);
 public:
     /// \brief A type of statistics item tree in isc::data::MapElement.
+    /// \verbatim
     ///        {
     ///          zone_name => {
     ///                         item_name => item_value,
@@ -233,8 +173,9 @@ public:
     ///        }
     ///        item_name is a string seperated by '.'.
     ///        item_value is an integer.
+    /// \endverbatim
     ///
-    typedef isc::data::ElementPtr ItemTreeType;
+    typedef isc::data::ElementPtr ItemTreePtr;
 
     /// \brief The constructor.
     ///
@@ -243,12 +184,6 @@ public:
     ///
     Counters();
 
-    /// \brief The destructor.
-    ///
-    /// This method never throws an exception.
-    ///
-    ~Counters();
-
     /// \brief Increment counters according to the parameters.
     ///
     /// This constructor is mostly exception free. But it may still throw
@@ -256,10 +191,12 @@ public:
     ///
     /// \param qrattrs Query/Response attributes.
     /// \param response DNS response message.
+    /// \param done DNS response was sent to the client.
     ///
     /// \throw std::bad_alloc Internal resource allocation fails
     ///
-    void inc(const QRAttributes& qrattrs, const isc::dns::Message& response);
+    void inc(const QRAttributes& qrattrs, const isc::dns::Message& response,
+             const bool done);
 
     /// \brief Get statistics counters.
     ///
@@ -270,7 +207,7 @@ public:
     ///
     /// \throw std::bad_alloc Internal resource allocation fails
     ///
-    ItemTreeType get() const;
+    ItemTreePtr get() const;
 };
 
 } // namespace statistics
diff --git a/src/bin/auth/statistics_items.h.pre b/src/bin/auth/statistics_items.h.pre
index 0ef98e6..8145378 100644
--- a/src/bin/auth/statistics_items.h.pre
+++ b/src/bin/auth/statistics_items.h.pre
@@ -15,8 +15,8 @@
 #ifndef __STATISTICS_ITEMS_H
 #define __STATISTICS_ITEMS_H 1
 
-/// This file defines a set of statistics items in Auth module for internal
-/// use. This file is intended to be included in statistics.cc.
+/// This file declares a set of statistics items in Auth module for internal
+/// use. This file is intended to be included in statistics.cc and unittests.
 
 namespace isc {
 namespace auth {
@@ -30,8 +30,8 @@ struct CounterTypeTree {
 
 // ### STATISTICS ITEMS DECLARATION ###
 
-extern const int QROpCodeToQRCounterType[];
-extern const int QRRCodeToQRCounterType[];
+extern const int opcode_to_qrcounter[];
+extern const int rcode_to_qrcounter[];
 
 } // namespace statistics
 } // namespace auth
diff --git a/src/bin/auth/statistics_qr_items.def b/src/bin/auth/statistics_qr_items.def
index 3a9b227..c17da60 100644
--- a/src/bin/auth/statistics_qr_items.def
+++ b/src/bin/auth/statistics_qr_items.def
@@ -1,14 +1,14 @@
 request	QRCounterRequest	Request statistics	=
 	v4		QR_REQUEST_IPV4		Number of IPv4 requests received by the b10-auth server.
 	v6		QR_REQUEST_IPV6		Number of IPv6 requests received by the b10-auth server.
-	edns0		QR_REQUEST_EDNS0	Number of requests with EDNS(0) received by the b10-auth server.
+	edns0		QR_REQUEST_EDNS0	Number of requests with EDNS0 received by the b10-auth server.
 	badednsver	QR_REQUEST_BADEDNSVER	Number of requests with unsupported EDNS version received by the b10-auth server.
 	tsig		QR_REQUEST_TSIG		Number of requests with TSIG received by the b10-auth server.
 	sig0		QR_REQUEST_SIG0		Number of requests with SIG(0) received by the b10-auth server; currently not implemented in BIND 10.
 	badsig		QR_REQUEST_BADSIG	Number of requests with invalid TSIG or SIG(0) signature received by the b10-auth server.
 	udp		QR_REQUEST_UDP		Number of UDP requests received by the b10-auth server.
 	tcp		QR_REQUEST_TCP		Number of UDP requests received by the b10-auth server.
-	dnssec_ok	QR_REQUEST_DNSSEC_OK	Number of requests with DO bit received by the b10-auth server.
+	dnssec_ok	QR_REQUEST_DNSSEC_OK	Number of requests with "DNSSEC OK" (DO) bit was set received by the b10-auth server.
 	;
 opcode	QRCounterOpcode		Opcode statistics	=
 	query		QR_OPCODE_QUERY		Number of Opcode=QUERY requests received by the b10-auth server.
@@ -43,12 +43,6 @@ rcode		QRCounterRcode	Rcode statistics	=
 	nxrrset		QR_RCODE_NXRRSET	Number of queries received by the b10-auth server resulted in RCODE = 8 (NXRRSet).
 	notauth		QR_RCODE_NOTAUTH	Number of queries received by the b10-auth server resulted in RCODE = 9 (NotAuth).
 	notzone		QR_RCODE_NOTZONE	Number of queries received by the b10-auth server resulted in RCODE = 10 (NotZone).
-	badsigvers	QR_RCODE_BADSIGVERS	Number of queries received by the b10-auth server resulted in RCODE = 16 (BADVERS, BADSIG).
-	badkey		QR_RCODE_BADKEY		Number of queries received by the b10-auth server resulted in RCODE = 17 (BADKEY).
-	badtime		QR_RCODE_BADTIME	Number of queries received by the b10-auth server resulted in RCODE = 18 (BADTIME).
-	badmode		QR_RCODE_BADMODE	Number of queries received by the b10-auth server resulted in RCODE = 19 (BADMODE).
-	badname		QR_RCODE_BADNAME	Number of queries received by the b10-auth server resulted in RCODE = 20 (BADNAME).
-	badalg		QR_RCODE_BADALG		Number of queries received by the b10-auth server resulted in RCODE = 21 (BADALG).
-	badtrunc	QR_RCODE_BADTRUNC	Number of queries received by the b10-auth server resulted in RCODE = 22 (BADTRUNC).
+	badvers		QR_RCODE_BADVERS	Number of queries received by the b10-auth server resulted in RCODE = 16 (BADVERS).
 	other		QR_RCODE_OTHER		Number of queries received by the b10-auth server resulted in other RCODEs.
 	;
diff --git a/src/bin/auth/tests/auth_srv_unittest.cc b/src/bin/auth/tests/auth_srv_unittest.cc
index d44c323..47b744b 100644
--- a/src/bin/auth/tests/auth_srv_unittest.cc
+++ b/src/bin/auth/tests/auth_srv_unittest.cc
@@ -131,25 +131,14 @@ protected:
 
     // Checks whether all Rcode counters are set to zero
     void checkAllRcodeCountersZero() const {
-        const std::map<std::string, ConstElementPtr>
-            stats_map(server.getStatistics()->get("zones")->get("_SERVER_")->
-                      get("rcode")->mapValue());
-
-        for (std::map<std::string, ConstElementPtr>::const_iterator
-                 i = stats_map.begin(), e = stats_map.end();
-             i != e;
-             ++i)
-        {
-            checkRcodeCounter(i->first, i->second->intValue(), 0);
-        }
+        // with checking NOERROR == 0 and the others are 0
+        checkAllRcodeCountersZeroExcept(Rcode::NOERROR(), 0);
     }
 
     // Checks whether all Rcode counters are set to zero except the given
     // rcode (it is checked to be set to 'value')
     void checkAllRcodeCountersZeroExcept(const Rcode& rcode, int value) const {
-        // rcode 16 is registered as both BADVERS and BADSIG
-        std::string target_rcode_name =
-            rcode.toText() == "BADVERS" ? "BADSIGVERS" : rcode.toText();
+        std::string target_rcode_name = rcode.toText();
         std::transform(target_rcode_name.begin(), target_rcode_name.end(),
                        target_rcode_name.begin(), ::tolower);
 
@@ -242,6 +231,8 @@ createBuiltinVersionResponse(const qid_t qid, vector<uint8_t>& data) {
                 renderer.getLength());
 }
 
+// Check if the item has expected value.
+// Before reading the item, check the item exists.
 void
 expectCounterItem(ConstElementPtr stats,
                   const std::string& item, const int expected) {
@@ -1079,7 +1070,7 @@ TEST_F(AuthSrvTest, queryCounterUDPNormal) {
     server.processMessage(*io_message, *parse_message, *response_obuffer,
                           &dnsserv);
     // After processing the UDP query, these counters should be incremented:
-    //   request.tcp, opcode.query, rcode.refused, response
+    //   request.udp, opcode.query, rcode.refused
     // and these counters should not be incremented:
     //   request.tcp
     ConstElementPtr stats_after = server.getStatistics()->
@@ -1179,7 +1170,7 @@ TEST_F(AuthSrvTest, queryCounterOpcodes) {
     for (int i = 0; i < 16; ++i) {
         std::string item_name;
         int expected;
-        if (isc::auth::statistics::QROpCodeToQRCounterType[i] ==
+        if (isc::auth::statistics::opcode_to_qrcounter[i] ==
             isc::auth::statistics::QR_OPCODE_OTHER) {
             item_name = "OTHER";
             other_expected += i + 1;
diff --git a/src/bin/auth/tests/statistics_unittest.cc.pre b/src/bin/auth/tests/statistics_unittest.cc.pre
index 1e04de2..22881f8 100644
--- a/src/bin/auth/tests/statistics_unittest.cc.pre
+++ b/src/bin/auth/tests/statistics_unittest.cc.pre
@@ -76,7 +76,9 @@ flatten(std::map<std::string, int>& flat_map, const std::string& prefix,
     }
 }
 
-bool
+// Test if the values of the counters are all zero except for the items
+// specified in except_for.
+void
 checkCountersAllZeroExcept(const isc::data::ConstElementPtr counters,
                            const std::set<std::string>& except_for) {
     std::map<std::string, int> stats_map;
@@ -95,8 +97,6 @@ checkCountersAllZeroExcept(const isc::data::ConstElementPtr counters,
             << i->first << " = " << expect << ", actual: "
             << i->second;
     }
-
-    return false;
 }
 
 TEST_F(CountersTest, incrementNormalQuery) {
@@ -113,13 +113,12 @@ TEST_F(CountersTest, incrementNormalQuery) {
     qrattrs.setQueryOpCode(Opcode::QUERY_CODE);
     qrattrs.setQueryEDNS(true, false);
     qrattrs.setQueryDO(true);
-    qrattrs.answerWasSent();
 
     response.setRcode(Rcode::REFUSED());
     response.addQuestion(Question(Name("example.com"),
                                   RRClass::IN(), RRType::AAAA()));
 
-    counters.inc(qrattrs, response);
+    counters.inc(qrattrs, response, true);
 
     expect_nonzero.clear();
     expect_nonzero.insert("opcode.query");
diff --git a/src/lib/statistics/Makefile.am b/src/lib/statistics/Makefile.am
index 478f1c1..a395bf5 100644
--- a/src/lib/statistics/Makefile.am
+++ b/src/lib/statistics/Makefile.am
@@ -19,5 +19,7 @@ endif
 
 CLEANFILES = *.gcno *.gcda
 
-# These header files should be in the distribution.
+# These are header-only shared classes and required to build BIND 10.
+# Include them in the distributed tarball with EXTRA_DIST (like as
+# external sources in ext/).
 EXTRA_DIST = counter.h counter_dict.h
diff --git a/src/lib/statistics/counter.h b/src/lib/statistics/counter.h
index ed5c276..b3f6f34 100644
--- a/src/lib/statistics/counter.h
+++ b/src/lib/statistics/counter.h
@@ -46,55 +46,40 @@ public:
     /// \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);
-
-    /// The destructor.
-    ///
-    /// This method never throws an exception.
-    inline ~Counter();
+    explicit Counter(const size_t items) :
+        counters_(items, InitialValue)
+    {
+        if (items == 0) {
+            isc_throw(isc::InvalidParameter, "Items must not be 0");
+        }
+    };
 
     /// \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);
+    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;
+    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
 
diff --git a/src/lib/statistics/counter_dict.h b/src/lib/statistics/counter_dict.h
index 3715fc2..665d656 100644
--- a/src/lib/statistics/counter_dict.h
+++ b/src/lib/statistics/counter_dict.h
@@ -48,12 +48,49 @@ private:
     // 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 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");
+        }
+    };
+    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_))));
+    };
+    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");
+        }
+    };
+    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");
+        }
+    };
+    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.
     ///
@@ -74,50 +111,27 @@ public:
             /// This constructor is mostly exception free. But it may still
             /// throw a standard exception if memory allocation fails
             /// inside the method.
-            inline ConstIterator() {}
-            /// The destructor.
-            ///
-            /// This method never throws an exception.
-            inline ~ConstIterator() {}
-            /// The assignment operator.
-            ///
-            /// This method is mostly exception free. But it may still
-            /// throw a standard exception if memory allocation fails
-            /// inside the method.
-            inline ConstIterator& operator=(const ConstIterator& source) {
-                iterator_ = source.iterator_;
-                return (*this);
-            }
-
-            /// The copy constructor.
-            ///
-            /// This constructor is mostly exception free. But it may still
-            /// throw a standard exception if memory allocation fails
-            /// inside the method.
-            inline ConstIterator(const ConstIterator& source) :
-                iterator_(source.iterator_)
-            {}
-            //
-            // Constructor from implementation detail DictionaryMap::const_iterator
-            inline ConstIterator(
+            ConstIterator() {}
+            /// Constructor from implementation detail DictionaryMap::const_iterator
+            ConstIterator(
                 DictionaryMap::const_iterator iterator) :
                 iterator_(iterator)
             {}
 
         private:
             /// \brief An internal method to increment this iterator.
-            inline void increment() {
+            void increment() {
                 ++iterator_;
                 return;
             }
 
             /// \brief An internal method to check equality.
-            inline bool equal(const ConstIterator& other) const {
+            bool equal(const ConstIterator& other) const {
                 return (iterator_ == other.iterator_);
             }
 
             /// \brief An internal method to dereference this iterator.
-            inline const value_type& dereference() const {
+            const value_type& dereference() const {
                 return (iterator_->first);
             }
 
@@ -126,77 +140,16 @@ public:
             DictionaryMap::const_iterator iterator_;
     };
 
-    inline ConstIterator begin() const;
-    inline ConstIterator end() const;
+    ConstIterator begin() const {
+        return (CounterDictionary::ConstIterator(dictionary_.begin()));
+    };
+    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
 



More information about the bind10-changes mailing list