Browse Source

[2157] apply review comments

Yoshitaka Aharen 12 years ago
parent
commit
1bd6030873

+ 2 - 0
configure.ac

@@ -1279,6 +1279,7 @@ AC_OUTPUT([doc/version.ent
            src/bin/msgq/run_msgq.sh
            src/bin/auth/auth.spec.pre
            src/bin/auth/spec_config.h.pre
+           src/bin/auth/gen-statistics_items.py.pre
            src/bin/dhcp4/spec_config.h.pre
            src/bin/dhcp6/spec_config.h.pre
            src/bin/tests/process_rename_test.py
@@ -1341,6 +1342,7 @@ AC_OUTPUT([doc/version.ent
            chmod +x src/bin/usermgr/run_b10-cmdctl-usermgr.sh
            chmod +x src/bin/msgq/run_msgq.sh
            chmod +x src/bin/msgq/tests/msgq_test
+           chmod +x src/bin/auth/gen-statistics_items.py.pre
            chmod +x src/lib/dns/gen-rdatacode.py
            chmod +x src/lib/log/tests/console_test.sh
            chmod +x src/lib/log/tests/destination_test.sh

+ 23 - 3
src/bin/auth/Makefile.am

@@ -18,6 +18,9 @@ pkglibexecdir = $(libexecdir)/@PACKAGE@
 
 CLEANFILES  = *.gcno *.gcda auth.spec spec_config.h
 CLEANFILES += auth_messages.h auth_messages.cc
+CLEANFILES += gen-statistics_items.py
+# auto-generated by gen-statistics_items.py
+CLEANFILES += statistics.cc statistics_items.h b10-auth.xml tests/statistics_unittest.cc
 
 man_MANS = b10-auth.8
 DISTCLEANFILES = $(man_MANS)
@@ -36,8 +39,18 @@ $(man_MANS):
 
 endif
 
-auth.spec: auth.spec.pre
-	$(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" auth.spec.pre >$@
+auth.spec: auth.spec.pre statistics_qr_items.def
+b10-auth.xml: b10-auth.xml.pre statistics_qr_items.def
+statistics_items.h: statistics_items.h.pre statistics_qr_items.def
+statistics.cc: statistics.cc.pre statistics_qr_items.def
+tests/statistics_unittest.cc: tests/statistics_unittest.cc.pre statistics_qr_items.def
+
+gen-statistics_items.py: gen-statistics_items.py.pre
+	$(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" gen-statistics_items.py.pre >$@
+	chmod +x $@
+
+auth.spec b10-auth.xml statistics_items.h statistics.cc tests/statistics_unittest.cc: Makefile gen-statistics_items.py
+	./gen-statistics_items.py
 
 spec_config.h: spec_config.h.pre
 	$(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" spec_config.h.pre >$@
@@ -46,6 +59,8 @@ auth_messages.h auth_messages.cc: auth_messages.mes
 	$(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/bin/auth/auth_messages.mes
 
 BUILT_SOURCES = spec_config.h auth_messages.h auth_messages.cc
+# auto-generated by gen-statistics_items.py
+BUILT_SOURCES += statistics_items.h statistics.cc
 
 pkglibexec_PROGRAMS = b10-auth
 b10_auth_SOURCES = query.cc query.h
@@ -54,12 +69,17 @@ b10_auth_SOURCES += auth_log.cc auth_log.h
 b10_auth_SOURCES += auth_config.cc auth_config.h
 b10_auth_SOURCES += command.cc command.h
 b10_auth_SOURCES += common.h common.cc
-b10_auth_SOURCES += statistics.cc statistics.h statistics_items.h
+b10_auth_SOURCES += statistics.h
 b10_auth_SOURCES += datasrc_configurator.h
 b10_auth_SOURCES += main.cc
 
 nodist_b10_auth_SOURCES = auth_messages.h auth_messages.cc
+nodist_b10_auth_SOURCES += statistics.cc statistics_items.h
 EXTRA_DIST += auth_messages.mes
+EXTRA_DIST += statistics_qr_items.def
+EXTRA_DIST += b10-auth.xml.pre
+EXTRA_DIST += statistics_items.h.pre statistics.cc.pre
+EXTRA_DIST += tests/statistics_unittest.cc.pre
 
 b10_auth_LDADD =  $(top_builddir)/src/lib/datasrc/libb10-datasrc.la
 b10_auth_LDADD += $(top_builddir)/src/lib/dns/libb10-dns++.la

File diff suppressed because it is too large
+ 0 - 1247
src/bin/auth/auth.spec.pre.in


File diff suppressed because it is too large
+ 0 - 1075
src/bin/auth/b10-auth.xml


+ 248 - 0
src/bin/auth/b10-auth.xml.pre

@@ -0,0 +1,248 @@
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+               "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
+	       [<!ENTITY mdash "&#8212;">]>
+<!--
+ - Copyright (C) 2010-2012  Internet Systems Consortium, Inc. ("ISC")
+ -
+ - Permission to use, copy, modify, and/or distribute this software for any
+ - purpose with or without fee is hereby granted, provided that the above
+ - copyright notice and this permission notice appear in all copies.
+ -
+ - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ - AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ - PERFORMANCE OF THIS SOFTWARE.
+-->
+
+<refentry>
+
+  <refentryinfo>
+    <date>October 3, 2012</date>
+  </refentryinfo>
+
+  <refmeta>
+    <refentrytitle>b10-auth</refentrytitle>
+    <manvolnum>8</manvolnum>
+    <refmiscinfo>BIND10</refmiscinfo>
+  </refmeta>
+
+  <refnamediv>
+    <refname>b10-auth</refname>
+    <refpurpose>Authoritative DNS server</refpurpose>
+  </refnamediv>
+
+  <docinfo>
+    <copyright>
+      <year>2010-2012</year>
+      <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
+    </copyright>
+  </docinfo>
+
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>b10-auth</command>
+      <arg><option>-v</option></arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+
+  <refsect1>
+    <title>DESCRIPTION</title>
+    <para>The <command>b10-auth</command> daemon provides the BIND 10
+      authoritative DNS server.
+      Normally it is started by the
+      <citerefentry><refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+      boss process.
+    </para>
+
+    <para>
+      This daemon communicates with other BIND 10 components over a
+      <citerefentry><refentrytitle>b10-msgq</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+      C-Channel connection.  If this connection is not established,
+      <command>b10-auth</command> will exit.
+<!-- TODO what if msgq connection closes later, will b10-auth exit? -->
+      It receives its configurations from
+<citerefentry><refentrytitle>b10-cfgmgr</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
+
+    </para>
+
+<!-- TODO: mention xfrin, xfrout, zonemgr ? -->
+
+  </refsect1>
+
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <para>The arguments are as follows:</para>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-v</option></term>
+        <listitem><para>
+	  Enable verbose logging mode. This enables logging of
+	  diagnostic messages at the maximum debug level.
+        </para></listitem>
+      </varlistentry>
+
+    </variablelist>
+
+  </refsect1>
+
+  <refsect1>
+    <title>CONFIGURATION AND COMMANDS</title>
+    <para>
+      The configurable settings are:
+    </para>
+
+    <para>
+      <varname>database_file</varname> defines the path to the
+      SQLite3 zone file when using the sqlite datasource.
+      The default is
+      <filename>@@LOCALSTATEDIR@@/bind10-devel/zone.sqlite3</filename>.
+    </para>
+
+    <para>
+      <varname>datasources</varname> configures data sources.
+      The list items include:
+      <varname>type</varname> to define the required data source type
+      (such as <quote>memory</quote>);
+      <varname>class</varname> to optionally select the class
+      (it defaults to <quote>IN</quote>);
+      and
+      <varname>zones</varname> to define the
+      <varname>file</varname> path name,
+      <varname>origin</varname> (default domain), and optional
+      <varname>filetype</varname>.
+      By default, <varname>zones</varname> is empty.
+      For the in-memory data source (i.e., the <varname>type</varname>
+      is <quote>memory</quote>), the optional <varname>filetype</varname>
+      configuration item for <varname>zones</varname> can be
+      specified so the in-memory zone data can be built from another
+      data source that is based on a database backend (in practice
+      with current implementation, it would be an SQLite3 database
+      file for the SQLite3 data source).
+      See the <citetitle>BIND 10 Guide</citetitle> for configuration
+      details.
+
+      <note><simpara>
+        Only the IN class is supported at this time.
+        By default, the memory data source is disabled.
+        Also, currently the zone file must be canonical such as
+        generated by <command>named-compilezone -D</command>.
+      </simpara></note>
+    </para>
+
+    <para>
+      <varname>listen_on</varname> is a list of addresses and ports for
+      <command>b10-auth</command> to listen on.
+      The list items are the <varname>address</varname> string
+      and <varname>port</varname> number.
+      By default, <command>b10-auth</command> listens on port 53
+      on the IPv6 (::) and IPv4 (0.0.0.0) wildcard addresses.
+    </para>
+
+    <para>
+      <varname>tcp_recv_timeout</varname> is the timeout used on
+      incoming TCP connections, in milliseconds. If the query
+      is not sent within this time, the connection is closed.
+      Setting this to 0 will disable TCP timeouts completely.
+    </para>
+
+<!-- TODO: formating -->
+    <para>
+      The configuration commands are:
+    </para>
+
+    <para>
+      <command>loadzone</command> tells <command>b10-auth</command>
+      to load or reload a zone file. The arguments include:
+      <varname>class</varname> which optionally defines the class
+      (it defaults to <quote>IN</quote>);
+      <varname>origin</varname> is the domain name of the zone;
+      and
+      <varname>datasrc</varname> optionally defines the type of datasource
+      (it defaults to <quote>memory</quote>).
+
+      <note><simpara>
+        In this development version, currently this only supports the
+        IN class and the memory data source.
+      </simpara></note>
+    </para>
+
+    <para>
+      <command>getstats</command> tells <command>b10-auth</command>
+      to send its statistics data.
+    </para>
+
+    <para>
+      <command>shutdown</command> exits <command>b10-auth</command>.
+      This has an optional <varname>pid</varname> argument to
+      select the process ID to stop.
+      (Note that the BIND 10 boss process may restart this service
+      if configured.)
+    </para>
+
+  </refsect1>
+
+  <refsect1>
+    <title>STATISTICS DATA</title>
+
+    <para>
+      The statistics data collected by the <command>b10-stats</command>
+      daemon for <quote>Auth</quote> include:
+    </para>
+
+<!-- ### STATISTICS DATA PLACEHOLDER ### -->
+
+<!-- TODO: missing stats docs. See ticket #1721 -->
+
+  </refsect1>
+
+  <refsect1>
+    <title>FILES</title>
+    <para>
+      <filename>@@LOCALSTATEDIR@@/bind10-devel/zone.sqlite3</filename>
+      &mdash; Location for the SQLite3 zone database
+      when <emphasis>database_file</emphasis> configuration is not
+      defined.
+    </para>
+  </refsect1>
+
+  <refsect1>
+    <title>SEE ALSO</title>
+    <para>
+      <citerefentry>
+        <refentrytitle>b10-cfgmgr</refentrytitle><manvolnum>8</manvolnum>
+      </citerefentry>,
+      <citerefentry>
+        <refentrytitle>b10-loadzone</refentrytitle><manvolnum>8</manvolnum>
+      </citerefentry>,
+      <citerefentry>
+        <refentrytitle>b10-msgq</refentrytitle><manvolnum>8</manvolnum>
+      </citerefentry>,
+      <citerefentry>
+        <refentrytitle>b10-stats</refentrytitle><manvolnum>8</manvolnum>
+      </citerefentry>,
+      <citerefentry>
+        <refentrytitle>b10-zonemgr</refentrytitle><manvolnum>8</manvolnum>
+      </citerefentry>,
+      <citerefentry>
+        <refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum>
+      </citerefentry>,
+      <citetitle>BIND 10 Guide</citetitle>.
+    </para>
+  </refsect1>
+
+  <refsect1>
+    <title>HISTORY</title>
+    <para>
+      The <command>b10-auth</command> daemon was first coded in October 2009.
+    </para>
+  </refsect1>
+</refentry><!--
+ - Local variables:
+ - mode: sgml
+ - End:
+-->

+ 276 - 0
src/bin/auth/gen-statistics_items.py.pre.in

@@ -0,0 +1,276 @@
+#!@PYTHON@
+
+# Copyright (C) 2012  Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+import os
+import re
+import sys
+import json
+from xml.etree import ElementTree
+
+item_list = []
+localstatedir = '@@LOCALSTATEDIR@@'
+builddir = '@builddir@'
+srcdir = '@srcdir@'
+pre_suffix = '.pre'
+
+xmldocument_command_name = 'b10-auth'
+
+def need_generate(filepath, mtime):
+    '''Check if we need to generate the specified file.
+
+    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:
+        return False
+    return True
+
+def import_definitions():
+    global item_list
+
+    items_definition_file = srcdir + os.sep + 'statistics_qr_items.def'
+    item_definition = open(items_definition_file, 'r')
+
+    re_splitter = re.compile('\t+')
+    l = item_list
+    lp = None
+    for line in item_definition.readlines():
+        element = re_splitter.split(line.rstrip())
+        if element[0] == '':
+            element.pop(0)
+
+        if element[-1] == '=':
+            l.append({'name': element[0], 'child': [], 'index': element[1],
+                      'description': element[2], 'parent': lp})
+            lp = l
+            l = l[-1]['child']
+        elif element[-1] == ';':
+            l = lp
+            lp = l[-1]['parent']
+        else:
+            l.append({'name': element[0], 'child': None, 'index': element[1],
+                      'description': element[2], 'parent': lp})
+
+    item_definition.close()
+    return os.path.getmtime(items_definition_file)
+
+def generate_specfile(specfile, def_mtime):
+    global item_list
+
+    def convert_list(items, prefix = ''):
+        spec_list = []
+        default_map = {}
+        for item in items:
+            full_item_name = prefix + item['name']
+            if item['child'] is None:
+                default_map[item['name']] = 0
+                spec_list.append({
+                        'item_name': item['name'],
+                        'item_optional': False,
+                        'item_type': 'integer',
+                        'item_default': 0,
+                        'item_title': full_item_name,
+                        'item_description': item['description'],
+                    })
+            else:
+                child_spec_list, child_default_map = \
+                    convert_list(item['child'], full_item_name + '.')
+                spec_list.append({
+                        'item_name': item['name'],
+                        'item_type': 'map',
+                        'item_optional': False,
+                        'item_title': full_item_name,
+                        'item_description': item['description'],
+                        'item_default': child_default_map,
+                        'map_item_spec': child_spec_list,
+                    })
+                default_map[item['name']] = child_default_map
+        return spec_list, default_map
+
+    item_spec_list, item_default_map = convert_list(item_list)
+
+    statistics_spec_list = [{
+        'item_name': 'zones',
+        'item_type': 'named_set',
+        'item_optional': False,
+        'item_title': 'Zone statistics',
+        'item_description':
+                'Zone statistics items. ' +
+                "Items for all zones are stored in '_SERVER_'.",
+        'item_default': { '_SERVER_': item_default_map },
+        'named_set_item_spec': {
+            'item_name': 'zone',
+            'item_type': 'map',
+            'item_optional': False,
+            'item_default': {},
+            'map_item_spec': item_spec_list,
+            },
+        }]
+
+    if need_generate(builddir+os.sep+specfile, def_mtime):
+        stats_pre = open(builddir+os.sep+specfile+pre_suffix, 'r')
+        stats_pre_json = json.loads(stats_pre.read().replace('@@LOCAL'+'STATEDIR@@',
+                                                             localstatedir))
+        stats_pre.close()
+        stats_pre_json['module_spec']['statistics'] = statistics_spec_list
+        statistics_spec_json = json.dumps(stats_pre_json, sort_keys = True,
+                                          indent = 2)
+        stats_spec = open(builddir+os.sep+specfile, 'w')
+        stats_spec.write(statistics_spec_json)
+        stats_spec.close()
+    else:
+        print('skip generating ' + specfile)
+    return
+
+def generate_docfile(docfile, def_mtime):
+    global item_list
+
+    def convert_list(items, tree, prefix = ''):
+        for item in items:
+            full_item_name = prefix + item['name']
+            if item['child'] is None:
+                child_element = ElementTree.SubElement(tree, 'varlistentry')
+                term = ElementTree.SubElement(child_element, 'term')
+                term.text = full_item_name
+                list_item = ElementTree.SubElement(child_element, 'listitem')
+                sim_para = ElementTree.SubElement(list_item, 'simpara')
+                sim_para.text = ''
+                prev = None
+                for word in item['description'].split():
+                    if word == xmldocument_command_name:
+                        command = ElementTree.SubElement(sim_para, 'command')
+                        command.text = word
+                        para_tail = command
+                        command.tail = ' '
+                        prev = command
+                    else:
+                        if prev is None:
+                            sim_para.text += word + ' '
+                        else:
+                            prev.tail += word + ' '
+            else:
+                convert_list(item['child'], tree, full_item_name + '.')
+        return
+
+    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('@@LOCALSTATEDIR@@', localstatedir)
+        doc_pre.close
+
+        variable_tree = ElementTree.Element('variablelist')
+        convert_list(item_list, variable_tree)
+        doc = open(builddir+os.sep+docfile, 'w')
+        doc.write(doc_pre_xml.replace(
+            '<!-- ### STATISTICS DATA PLACEHOLDER ### -->',
+            ElementTree.tostring(variable_tree)))
+        doc.close()
+    else:
+        print('skip generating ' + docfile)
+    return
+
+def generate_cxx(itemsfile, ccfile, utfile, def_mtime):
+    global item_list
+
+    qr_counter_types = 'enum QRCounterType {\n'
+    item_names = []
+
+    def convert_list(items, qr_counter_types, item_names_current, item_names):
+        for item in items:
+            if item['child'] is None:
+                qr_counter_types += '    ' + item['index'] + ',    ' +\
+                                    '///< ' + item['description'] + '\n'
+                item_names_current.append('    { "' + item['name'] +
+                                          '", NULL, ' + item['index'] + ' },\n'
+                                          )
+            else:
+                item_names_current_ = ['const struct CounterTypeTree ' +
+                                       item['index'] + '[] = {\n']
+                qr_counter_types, item_names_current_, item_names = \
+                        convert_list(item['child'], qr_counter_types,
+                                     item_names_current_, item_names)
+                item_names_current_.append('    { NULL, NULL, -1 }\n' +
+                              '};\n')
+                item_names.extend(item_names_current_)
+                item_names_current.append('    { "' + item['name'] + '", ' +
+                                          item['index'] + ', -1 },\n')
+        return qr_counter_types, item_names_current, item_names
+
+    qr_counter_types, item_names_current, item_names = \
+            convert_list(item_list, qr_counter_types, [], item_names)
+    item_names.append('const struct CounterTypeTree QRCounterTree[] = {\n')
+    item_names.extend(item_names_current)
+    item_names.append('    { NULL, NULL, -1 }\n' +
+                  '};\n')
+
+    qr_counter_types += \
+        '    // End of counter types\n' +\
+        '    QR_COUNTER_TYPES  ///< The number of defined counters\n' +\
+        '};\n'
+
+    item_defs = qr_counter_types
+    item_decls = ''.join(item_names)
+
+    if need_generate(builddir+os.sep+itemsfile, def_mtime):
+        statistics_items_h_pre = open(srcdir+os.sep+itemsfile+pre_suffix, 'r')
+        items_pre = statistics_items_h_pre.read()
+        statistics_items_h_pre.close
+
+        statistics_items_h = open(builddir+os.sep+itemsfile, 'w')
+        statistics_items_h.write(items_pre.replace(
+            '// ### STATISTICS ITEMS DECLARATION ###', item_defs))
+        statistics_items_h.close()
+    else:
+        print('skip generating ' + itemsfile)
+
+    if need_generate(builddir+os.sep+ccfile, def_mtime):
+        statistics_cc_pre = open(srcdir+os.sep+ccfile+pre_suffix, 'r')
+        items_pre = statistics_cc_pre.read()
+        statistics_cc_pre.close
+
+        statistics_cc = open(builddir+os.sep+ccfile, 'w')
+        statistics_cc.write(items_pre.replace(
+            '// ### STATISTICS ITEMS DEFINITION ###', item_decls))
+        statistics_cc.close()
+    else:
+        print('skip generating ' + ccfile)
+
+    if need_generate(builddir+os.sep+utfile, def_mtime):
+        statistics_ut_cc_pre = open(srcdir+os.sep+utfile+pre_suffix, 'r')
+        items_pre = statistics_ut_cc_pre.read()
+        statistics_ut_cc_pre.close
+
+        statistics_ut_cc = open(builddir+os.sep+utfile, 'w')
+        statistics_ut_cc.write(items_pre.replace(
+            '// ### STATISTICS ITEMS DEFINITION ###', item_decls))
+        statistics_ut_cc.close()
+    else:
+        print('skip generating ' + utfile)
+
+    return
+
+if __name__ == "__main__":
+    try:
+        def_mtime = import_definitions()
+        generate_specfile('auth.spec', def_mtime)
+        generate_docfile('b10-auth.xml', def_mtime)
+        generate_cxx('statistics_items.h',
+                     'statistics.cc',
+                     'tests'+os.sep+'statistics_unittest.cc',
+                     def_mtime)
+    except:
+        sys.stderr.write('Code generation failed due to exception: %s\n' %
+                sys.exc_info()[1])
+        exit(1)

+ 50 - 28
src/bin/auth/statistics.cc

@@ -42,7 +42,8 @@ using namespace isc::statistics;
 namespace {
 
 void
-fillNodes(const Counter& counter, const struct CounterTypeTree type_tree[],
+fillNodes(const Counter& counter,
+          const struct isc::auth::statistics::CounterTypeTree type_tree[],
           isc::auth::statistics::Counters::ItemTreeType& trees)
 {
     using namespace isc::data;
@@ -68,6 +69,52 @@ namespace isc {
 namespace auth {
 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
+};
+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
+};
+
 Counters::Counters() :
     // size of server_qr_counter_, zone_qr_counters_: QR_COUNTER_TYPES
     server_qr_counter_(QR_COUNTER_TYPES),
@@ -78,7 +125,7 @@ Counters::~Counters()
 {}
 
 void
-Counters::incRequest(const QRAttributes& qrattrs, const Message& response) {
+Counters::incRequest(const QRAttributes& qrattrs) {
     // protocols carrying request
     if (qrattrs.req_ip_version_ == AF_INET) {
         server_qr_counter_.inc(QR_REQUEST_IPV4);
@@ -118,31 +165,6 @@ Counters::incRequest(const QRAttributes& qrattrs, const Message& response) {
         server_qr_counter_.inc(QR_REQUEST_DNSSEC_OK);
     }
 
-    // QTYPE
-    unsigned int qtype_type = QR_QTYPE_OTHER;
-    const QuestionIterator qiter = response.beginQuestion();
-    if (qiter != response.endQuestion()) {
-        // get the first and only question section
-        const QuestionPtr qptr = *qiter;
-        if (qptr != NULL) {
-            // get the qtype code
-            const unsigned int qtype = qptr->getType().getCode();
-            if (qtype < 258) {
-                // qtype 0..257
-                qtype_type = QRQTypeToQRCounterType[qtype];
-            } else if (qtype < 32768) {
-                // qtype 258..32767
-                qtype_type = QR_QTYPE_OTHER;
-            } else if (qtype < 32770) {
-                // qtype 32768..32769
-                qtype_type = QR_QTYPE_TA + (qtype - 32768);
-            } else {
-                // qtype 32770..65535
-                qtype_type = QR_QTYPE_OTHER;
-            }
-        }
-    }
-    server_qr_counter_.inc(qtype_type);
     // OPCODE
     server_qr_counter_.inc(QROpCodeToQRCounterType[qrattrs.req_opcode_]);
 }
@@ -218,7 +240,7 @@ Counters::incResponse(const QRAttributes& qrattrs, const Message& response) {
 void
 Counters::inc(const QRAttributes& qrattrs, const Message& response) {
     // increment request counters
-    incRequest(qrattrs, response);
+    incRequest(qrattrs);
 
     if (qrattrs.answer_sent_) {
         // increment response counters if answer was sent

+ 1 - 2
src/bin/auth/statistics.h

@@ -208,8 +208,7 @@ private:
     isc::statistics::Counter server_qr_counter_;
     // set of counters for zones
     isc::statistics::CounterDictionary zone_qr_counters_;
-    void incRequest(const QRAttributes& qrattrs,
-                    const isc::dns::Message& response);
+    void incRequest(const QRAttributes& qrattrs);
     void incResponse(const QRAttributes& qrattrs,
                      const isc::dns::Message& response);
 public:

+ 0 - 609
src/bin/auth/statistics_items.h

@@ -1,609 +0,0 @@
-// Copyright (C) 2012  Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-#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.
-
-namespace {
-
-struct CounterTypeTree {
-    const char* const name;
-    const struct CounterTypeTree* const sub_tree;
-    const int counter_id;
-};
-
-// enum for query/response counters
-enum QRCounterType {
-    // Request Attributes
-    QR_REQUEST_IPV4,        ///< Number of IPv4 requests received
-    QR_REQUEST_IPV6,        ///< Number of IPv6 requests received
-    QR_REQUEST_EDNS0,       ///< Number of requests with EDNS(0) received
-    QR_REQUEST_BADEDNSVER,  ///< Number of requests with unsupported EDNS version received
-    QR_REQUEST_TSIG,        ///< Number of requests with TSIG received
-    QR_REQUEST_SIG0,        ///< Number of requests with SIG(0) received; not implemented in BIND 10
-    QR_REQUEST_BADSIG,      ///< Number of requests with invalid TSIG or SIG(0) signature received
-    QR_REQUEST_UDP,         ///< Number of UDP requests received
-    QR_REQUEST_TCP,         ///< Number of TCP requests received
-    QR_REQUEST_DNSSEC_OK,   ///< Number of requests with DO bit
-    // Request Opcodes
-    QR_OPCODE_QUERY,        ///< Number of Opcode=QUERY requests received
-    QR_OPCODE_IQUERY,       ///< Number of Opcode=IQUERY requests received
-    QR_OPCODE_STATUS,       ///< Number of Opcode=STATUS requests received
-    QR_OPCODE_NOTIFY,       ///< Number of Opcode=NOTIFY requests received
-    QR_OPCODE_UPDATE,       ///< Number of Opcode=UPDATE requests received
-    QR_OPCODE_OTHER,        ///< Number of requests in other OpCode received
-    // Query Types
-    QR_QTYPE_A,             ///< Number of QTYPE = A queries received
-    QR_QTYPE_NS,            ///< Number of QTYPE = NS queries received
-    QR_QTYPE_MD,            ///< Number of QTYPE = MD queries received
-    QR_QTYPE_MF,            ///< Number of QTYPE = MF queries received
-    QR_QTYPE_CNAME,         ///< Number of QTYPE = CNAME queries received
-    QR_QTYPE_SOA,           ///< Number of QTYPE = SOA queries received
-    QR_QTYPE_MB,            ///< Number of QTYPE = MB queries received
-    QR_QTYPE_MG,            ///< Number of QTYPE = MG queries received
-    QR_QTYPE_MR,            ///< Number of QTYPE = MR queries received
-    QR_QTYPE_NULL,          ///< Number of QTYPE = NULL queries received
-    QR_QTYPE_WKS,           ///< Number of QTYPE = WKS queries received
-    QR_QTYPE_PTR,           ///< Number of QTYPE = PTR queries received
-    QR_QTYPE_HINFO,         ///< Number of QTYPE = HINFO queries received
-    QR_QTYPE_MINFO,         ///< Number of QTYPE = MINFO queries received
-    QR_QTYPE_MX,            ///< Number of QTYPE = MX queries received
-    QR_QTYPE_TXT,           ///< Number of QTYPE = TXT queries received
-    QR_QTYPE_RP,            ///< Number of QTYPE = RP queries received
-    QR_QTYPE_AFSDB,         ///< Number of QTYPE = AFSDB queries received
-    QR_QTYPE_X25,           ///< Number of QTYPE = X25 queries received
-    QR_QTYPE_ISDN,          ///< Number of QTYPE = ISDN queries received
-    QR_QTYPE_RT,            ///< Number of QTYPE = RT queries received
-    QR_QTYPE_NSAP,          ///< Number of QTYPE = NSAP queries received
-    QR_QTYPE_NSAP_PTR,      ///< Number of QTYPE = NSAP-PTR queries received
-    QR_QTYPE_SIG,           ///< Number of QTYPE = SIG queries received
-    QR_QTYPE_KEY,           ///< Number of QTYPE = KEY queries received
-    QR_QTYPE_PX,            ///< Number of QTYPE = PX queries received
-    QR_QTYPE_GPOS,          ///< Number of QTYPE = GPOS queries received
-    QR_QTYPE_AAAA,          ///< Number of QTYPE = AAAA queries received
-    QR_QTYPE_LOC,           ///< Number of QTYPE = LOC queries received
-    QR_QTYPE_NXT,           ///< Number of QTYPE = NXT queries received
-    QR_QTYPE_EID,           ///< Number of QTYPE = EID queries received
-    QR_QTYPE_NIMLOC,        ///< Number of QTYPE = NIMLOC queries received
-    QR_QTYPE_SRV,           ///< Number of QTYPE = SRV queries received
-    QR_QTYPE_ATMA,          ///< Number of QTYPE = ATMA queries received
-    QR_QTYPE_NAPTR,         ///< Number of QTYPE = NAPTR queries received
-    QR_QTYPE_KX,            ///< Number of QTYPE = KX queries received
-    QR_QTYPE_CERT,          ///< Number of QTYPE = CERT queries received
-    QR_QTYPE_A6,            ///< Number of QTYPE = A6 queries received
-    QR_QTYPE_DNAME,         ///< Number of QTYPE = DNAME queries received
-    QR_QTYPE_SINK,          ///< Number of QTYPE = SINK queries received
-    QR_QTYPE_OPT,           ///< Number of QTYPE = OPT queries received
-    QR_QTYPE_APL,           ///< Number of QTYPE = APL queries received
-    QR_QTYPE_DS,            ///< Number of QTYPE = DS queries received
-    QR_QTYPE_SSHFP,         ///< Number of QTYPE = SSHFP queries received
-    QR_QTYPE_IPSECKEY,      ///< Number of QTYPE = IPSECKEY queries received
-    QR_QTYPE_RRSIG,         ///< Number of QTYPE = RRSIG queries received
-    QR_QTYPE_NSEC,          ///< Number of QTYPE = NSEC queries received
-    QR_QTYPE_DNSKEY,        ///< Number of QTYPE = DNSKEY queries received
-    QR_QTYPE_DHCID,         ///< Number of QTYPE = DHCID queries received
-    QR_QTYPE_NSEC3,         ///< Number of QTYPE = NSEC3 queries received
-    QR_QTYPE_NSEC3PARAM,    ///< Number of QTYPE = NSEC3PARAM queries received
-    QR_QTYPE_HIP,           ///< Number of QTYPE = HIP queries received
-    QR_QTYPE_NINFO,         ///< Number of QTYPE = NINFO queries received
-    QR_QTYPE_RKEY,          ///< Number of QTYPE = RKEY queries received
-    QR_QTYPE_TALINK,        ///< Number of QTYPE = TALINK queries received
-    QR_QTYPE_SPF,           ///< Number of QTYPE = SPF queries received
-    QR_QTYPE_UINFO,         ///< Number of QTYPE = UINFO queries received
-    QR_QTYPE_UID,           ///< Number of QTYPE = UID queries received
-    QR_QTYPE_GID,           ///< Number of QTYPE = GID queries received
-    QR_QTYPE_UNSPEC,        ///< Number of QTYPE = UNSPEC queries received
-    QR_QTYPE_TKEY,          ///< Number of QTYPE = TKEY queries received
-    QR_QTYPE_TSIG,          ///< Number of QTYPE = TSIG queries received
-    QR_QTYPE_IXFR,          ///< Number of QTYPE = IXFR queries received
-    QR_QTYPE_AXFR,          ///< Number of QTYPE = AXFR queries received
-    QR_QTYPE_MAILB,         ///< Number of QTYPE = MAILB queries received
-    QR_QTYPE_MAILA,         ///< Number of QTYPE = MAILA queries received
-    QR_QTYPE_URI,           ///< Number of QTYPE = URI queries received
-    QR_QTYPE_CAA,           ///< Number of QTYPE = CAA queries received
-    QR_QTYPE_TA,            ///< Number of QTYPE = TA queries received
-    QR_QTYPE_DLV,           ///< Number of QTYPE = DLV queries received
-    QR_QTYPE_OTHER,         ///< Number of queries in other QTYPE received
-    // Respose Attributes
-    QR_RESPONSE,            ///< Number of responses sent
-    QR_RESPONSE_TRUNCATED,  ///< Number of truncated responses sent
-    QR_RESPONSE_EDNS0,      ///< Number of responses with EDNS0; not implemented in BIND 10
-    QR_RESPONSE_TSIG,       ///< Number of responses with TSIG
-    QR_RESPONSE_SIG0,       ///< Number of responses with SIG(0); not implemented in BIND 10
-    QR_QRYSUCCESS,          ///< Number of queries resulted in rcode = NOERROR and answer RR >= 1
-    QR_QRYAUTHANS,          ///< Number of queries resulted in authoritative answer
-    QR_QRYNOAUTHANS,        ///< Number of queries resulted in non-authoritative answer
-    QR_QRYREFERRAL,         ///< Number of queries resulted in referral answer
-    QR_QRYNXRRSET,          ///< Number of queries resulted in NOERROR but answer RR == 0
-    QR_QRYREJECT,           ///< Number of queries rejected
-    // Response Rcodes
-    QR_RCODE_NOERROR,       ///< Number of queries resulted in RCODE = 0 (NoError)
-    QR_RCODE_FORMERR,       ///< Number of queries resulted in RCODE = 1 (FormErr)
-    QR_RCODE_SERVFAIL,      ///< Number of queries resulted in RCODE = 2 (ServFail)
-    QR_RCODE_NXDOMAIN,      ///< Number of queries resulted in RCODE = 3 (NXDomain)
-    QR_RCODE_NOTIMP,        ///< Number of queries resulted in RCODE = 4 (NotImp)
-    QR_RCODE_REFUSED,       ///< Number of queries resulted in RCODE = 5 (Refused)
-    QR_RCODE_YXDOMAIN,      ///< Number of queries resulted in RCODE = 6 (YXDomain)
-    QR_RCODE_YXRRSET,       ///< Number of queries resulted in RCODE = 7 (YXRRSet)
-    QR_RCODE_NXRRSET,       ///< Number of queries resulted in RCODE = 8 (NXRRSet)
-    QR_RCODE_NOTAUTH,       ///< Number of queries resulted in RCODE = 9 (NotAuth)
-    QR_RCODE_NOTZONE,       ///< Number of queries resulted in RCODE = 10 (NotZone)
-    QR_RCODE_BADSIGVERS,    ///< Number of queries resulted in RCODE = 16 (BADVERS, BADSIG)
-    QR_RCODE_BADKEY,        ///< Number of queries resulted in RCODE = 17 (BADKEY)
-    QR_RCODE_BADTIME,       ///< Number of queries resulted in RCODE = 18 (BADTIME)
-    QR_RCODE_BADMODE,       ///< Number of queries resulted in RCODE = 19 (BADMODE)
-    QR_RCODE_BADNAME,       ///< Number of queries resulted in RCODE = 20 (BADNAME)
-    QR_RCODE_BADALG,        ///< Number of queries resulted in RCODE = 21 (BADALG)
-    QR_RCODE_BADTRUNC,      ///< Number of queries resulted in RCODE = 22 (BADTRUNC)
-    QR_RCODE_OTHER,         ///< Number of queries resulted in other RCODEs
-    // End of counter types
-    QR_COUNTER_TYPES  ///< The number of defined counters
-};
-
-// item names for query/response counters
-const struct CounterTypeTree QRCounterRequest[] = {
-    { "v4",         NULL,   QR_REQUEST_IPV4       },
-    { "v6",         NULL,   QR_REQUEST_IPV6       },
-    { "edns0",      NULL,   QR_REQUEST_EDNS0      },
-    { "badednsver", NULL,   QR_REQUEST_BADEDNSVER },
-    { "tsig",       NULL,   QR_REQUEST_TSIG       },
-    { "sig0",       NULL,   QR_REQUEST_SIG0       },
-    { "badsig",     NULL,   QR_REQUEST_BADSIG     },
-    { "udp",        NULL,   QR_REQUEST_UDP        },
-    { "tcp",        NULL,   QR_REQUEST_TCP        },
-    { "dnssec_ok",  NULL,   QR_REQUEST_DNSSEC_OK  },
-    { NULL,         NULL,   -1                    }
-};
-const struct CounterTypeTree QRCounterOpcode[] = {
-    { "query",  NULL,   QR_OPCODE_QUERY  },
-    { "iquery", NULL,   QR_OPCODE_IQUERY },
-    { "status", NULL,   QR_OPCODE_STATUS },
-    { "notify", NULL,   QR_OPCODE_NOTIFY },
-    { "update", NULL,   QR_OPCODE_UPDATE },
-    { "other",  NULL,   QR_OPCODE_OTHER  },
-    { NULL,     NULL,   -1               }
-};
-const struct CounterTypeTree QRCounterQtype[] = {
-    { "a",          NULL,   QR_QTYPE_A,         },
-    { "ns",         NULL,   QR_QTYPE_NS         },
-    { "md",         NULL,   QR_QTYPE_MD         },
-    { "mf",         NULL,   QR_QTYPE_MF         },
-    { "cname",      NULL,   QR_QTYPE_CNAME      },
-    { "soa",        NULL,   QR_QTYPE_SOA        },
-    { "mb",         NULL,   QR_QTYPE_MB         },
-    { "mg",         NULL,   QR_QTYPE_MG         },
-    { "mr",         NULL,   QR_QTYPE_MR         },
-    { "null",       NULL,   QR_QTYPE_NULL       },
-    { "wks",        NULL,   QR_QTYPE_WKS        },
-    { "ptr",        NULL,   QR_QTYPE_PTR        },
-    { "hinfo",      NULL,   QR_QTYPE_HINFO      },
-    { "minfo",      NULL,   QR_QTYPE_MINFO      },
-    { "mx",         NULL,   QR_QTYPE_MX         },
-    { "txt",        NULL,   QR_QTYPE_TXT        },
-    { "rp",         NULL,   QR_QTYPE_RP         },
-    { "afsdb",      NULL,   QR_QTYPE_AFSDB      },
-    { "x25",        NULL,   QR_QTYPE_X25        },
-    { "isdn",       NULL,   QR_QTYPE_ISDN       },
-    { "rt",         NULL,   QR_QTYPE_RT         },
-    { "nsap",       NULL,   QR_QTYPE_NSAP       },
-    { "nsap-ptr",   NULL,   QR_QTYPE_NSAP_PTR   },
-    { "sig",        NULL,   QR_QTYPE_SIG        },
-    { "key",        NULL,   QR_QTYPE_KEY        },
-    { "px",         NULL,   QR_QTYPE_PX         },
-    { "gpos",       NULL,   QR_QTYPE_GPOS       },
-    { "aaaa",       NULL,   QR_QTYPE_AAAA       },
-    { "loc",        NULL,   QR_QTYPE_LOC        },
-    { "nxt",        NULL,   QR_QTYPE_NXT        },
-    { "eid",        NULL,   QR_QTYPE_EID        },
-    { "nimloc",     NULL,   QR_QTYPE_NIMLOC     },
-    { "srv",        NULL,   QR_QTYPE_SRV        },
-    { "atma",       NULL,   QR_QTYPE_ATMA       },
-    { "naptr",      NULL,   QR_QTYPE_NAPTR      },
-    { "kx",         NULL,   QR_QTYPE_KX         },
-    { "cert",       NULL,   QR_QTYPE_CERT       },
-    { "a6",         NULL,   QR_QTYPE_A6         },
-    { "dname",      NULL,   QR_QTYPE_DNAME      },
-    { "sink",       NULL,   QR_QTYPE_SINK       },
-    { "opt",        NULL,   QR_QTYPE_OPT        },
-    { "apl",        NULL,   QR_QTYPE_APL        },
-    { "ds",         NULL,   QR_QTYPE_DS         },
-    { "sshfp",      NULL,   QR_QTYPE_SSHFP      },
-    { "ipseckey",   NULL,   QR_QTYPE_IPSECKEY   },
-    { "rrsig",      NULL,   QR_QTYPE_RRSIG      },
-    { "nsec",       NULL,   QR_QTYPE_NSEC       },
-    { "dnskey",     NULL,   QR_QTYPE_DNSKEY     },
-    { "dhcid",      NULL,   QR_QTYPE_DHCID      },
-    { "nsec3",      NULL,   QR_QTYPE_NSEC3      },
-    { "nsec3param", NULL,   QR_QTYPE_NSEC3PARAM },
-    { "hip",        NULL,   QR_QTYPE_HIP        },
-    { "ninfo",      NULL,   QR_QTYPE_NINFO      },
-    { "rkey",       NULL,   QR_QTYPE_RKEY       },
-    { "talink",     NULL,   QR_QTYPE_TALINK     },
-    { "spf",        NULL,   QR_QTYPE_SPF        },
-    { "uinfo",      NULL,   QR_QTYPE_UINFO      },
-    { "uid",        NULL,   QR_QTYPE_UID        },
-    { "gid",        NULL,   QR_QTYPE_GID        },
-    { "unspec",     NULL,   QR_QTYPE_UNSPEC     },
-    { "tkey",       NULL,   QR_QTYPE_TKEY       },
-    { "tsig",       NULL,   QR_QTYPE_TSIG       },
-    { "ixfr",       NULL,   QR_QTYPE_IXFR       },
-    { "axfr",       NULL,   QR_QTYPE_AXFR       },
-    { "mailb",      NULL,   QR_QTYPE_MAILB      },
-    { "maila",      NULL,   QR_QTYPE_MAILA      },
-    { "uri",        NULL,   QR_QTYPE_URI        },
-    { "caa",        NULL,   QR_QTYPE_CAA        },
-    { "ta",         NULL,   QR_QTYPE_TA         },
-    { "dlv",        NULL,   QR_QTYPE_DLV        },
-    { "other",      NULL,   QR_QTYPE_OTHER      },
-    { NULL,         NULL,   -1                  }
-};
-const struct CounterTypeTree QRCounterResponse[] = {
-    { "truncated",  NULL,   QR_RESPONSE_TRUNCATED },
-    { "edns0",      NULL,   QR_RESPONSE_EDNS0     },
-    { "tsig",       NULL,   QR_RESPONSE_TSIG      },
-    { "sig0",       NULL,   QR_RESPONSE_SIG0      },
-    { NULL,         NULL,   -1                    }
-};
-const struct CounterTypeTree QRCounterRcode[] = {
-    { "noerror",    NULL,   QR_RCODE_NOERROR    },
-    { "formerr",    NULL,   QR_RCODE_FORMERR    },
-    { "servfail",   NULL,   QR_RCODE_SERVFAIL   },
-    { "nxdomain",   NULL,   QR_RCODE_NXDOMAIN   },
-    { "notimp",     NULL,   QR_RCODE_NOTIMP     },
-    { "refused",    NULL,   QR_RCODE_REFUSED    },
-    { "yxdomain",   NULL,   QR_RCODE_YXDOMAIN   },
-    { "yxrrset",    NULL,   QR_RCODE_YXRRSET    },
-    { "nxrrset",    NULL,   QR_RCODE_NXRRSET    },
-    { "notauth",    NULL,   QR_RCODE_NOTAUTH    },
-    { "notzone",    NULL,   QR_RCODE_NOTZONE    },
-    { "badsigvers", NULL,   QR_RCODE_BADSIGVERS },
-    { "badkey",     NULL,   QR_RCODE_BADKEY     },
-    { "badtime",    NULL,   QR_RCODE_BADTIME    },
-    { "badmode",    NULL,   QR_RCODE_BADMODE    },
-    { "badname",    NULL,   QR_RCODE_BADNAME    },
-    { "badalg",     NULL,   QR_RCODE_BADALG     },
-    { "badtrunc",   NULL,   QR_RCODE_BADTRUNC   },
-    { "other",      NULL,   QR_RCODE_OTHER      },
-    { NULL,         NULL,   -1 }
-};
-const struct CounterTypeTree QRCounterTree[] = {
-    { "request",        QRCounterRequest,   -1              },
-    { "opcode",         QRCounterOpcode,    -1              },
-    { "qtype",          QRCounterQtype,     -1              },
-    { "responses",      NULL,               QR_RESPONSE     },
-    { "response",       QRCounterResponse,  -1              },
-    { "qrysuccess",     NULL,               QR_QRYSUCCESS   },
-    { "qryauthans",     NULL,               QR_QRYAUTHANS   },
-    { "qrynoauthans",   NULL,               QR_QRYNOAUTHANS },
-    { "qryreferral",    NULL,               QR_QRYREFERRAL  },
-    { "qrynxrrset",     NULL,               QR_QRYNXRRSET   },
-    { "authqryrej",     NULL,               QR_QRYREJECT    },
-    { "rcode",          QRCounterRcode,     -1              },
-    { NULL,             NULL,               -1              }
-};
-
-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
-};
-const int QRQTypeToQRCounterType[258] = {
-    QR_QTYPE_OTHER,
-    QR_QTYPE_A,
-    QR_QTYPE_NS,
-    QR_QTYPE_MD,
-    QR_QTYPE_MF,
-    QR_QTYPE_CNAME,
-    QR_QTYPE_SOA,
-    QR_QTYPE_MB,
-    QR_QTYPE_MG,
-    QR_QTYPE_MR,
-    QR_QTYPE_NULL,
-    QR_QTYPE_WKS,
-    QR_QTYPE_PTR,
-    QR_QTYPE_HINFO,
-    QR_QTYPE_MINFO,
-    QR_QTYPE_MX,
-    QR_QTYPE_TXT,
-    QR_QTYPE_RP,
-    QR_QTYPE_AFSDB,
-    QR_QTYPE_X25,
-    QR_QTYPE_ISDN,
-    QR_QTYPE_RT,
-    QR_QTYPE_NSAP,
-    QR_QTYPE_NSAP_PTR,
-    QR_QTYPE_SIG,
-    QR_QTYPE_KEY,
-    QR_QTYPE_PX,
-    QR_QTYPE_GPOS,
-    QR_QTYPE_AAAA,
-    QR_QTYPE_LOC,
-    QR_QTYPE_NXT,
-    QR_QTYPE_EID,
-    QR_QTYPE_NIMLOC,
-    QR_QTYPE_SRV,
-    QR_QTYPE_ATMA,
-    QR_QTYPE_NAPTR,
-    QR_QTYPE_KX,
-    QR_QTYPE_CERT,
-    QR_QTYPE_A6,
-    QR_QTYPE_DNAME,
-    QR_QTYPE_SINK,
-    QR_QTYPE_OPT,
-    QR_QTYPE_APL,
-    QR_QTYPE_DS,
-    QR_QTYPE_SSHFP,
-    QR_QTYPE_IPSECKEY,
-    QR_QTYPE_RRSIG,
-    QR_QTYPE_NSEC,
-    QR_QTYPE_DNSKEY,
-    QR_QTYPE_DHCID,
-    QR_QTYPE_NSEC3,
-    QR_QTYPE_NSEC3PARAM,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_HIP,
-    QR_QTYPE_NINFO,
-    QR_QTYPE_RKEY,
-    QR_QTYPE_TALINK,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_SPF,
-    QR_QTYPE_UINFO,
-    QR_QTYPE_UID,
-    QR_QTYPE_GID,
-    QR_QTYPE_UNSPEC,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_TKEY,
-    QR_QTYPE_TSIG,
-    QR_QTYPE_IXFR,
-    QR_QTYPE_AXFR,
-    QR_QTYPE_MAILB,
-    QR_QTYPE_MAILA,
-    QR_QTYPE_OTHER,
-    QR_QTYPE_URI,
-    QR_QTYPE_CAA
-};
-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
-};
-
-} // anonymous namespace
-
-#endif // __STATISTICS_ITEMS_H
-
-// Local Variables:
-// mode: c++
-// End:

+ 44 - 0
src/bin/auth/statistics_items.h.pre

@@ -0,0 +1,44 @@
+// Copyright (C) 2012  Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#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.
+
+namespace isc {
+namespace auth {
+namespace statistics {
+
+struct CounterTypeTree {
+    const char* const name;
+    const struct CounterTypeTree* const sub_tree;
+    const int counter_id;
+};
+
+// ### STATISTICS ITEMS DECLARATION ###
+
+extern const int QROpCodeToQRCounterType[];
+extern const int QRRCodeToQRCounterType[];
+
+} // namespace statistics
+} // namespace auth
+} // namespace isc
+
+#endif // __STATISTICS_ITEMS_H
+
+// Local Variables:
+// mode: c++
+// End:

+ 54 - 0
src/bin/auth/statistics_qr_items.def

@@ -0,0 +1,54 @@
+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.
+	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.
+	;
+opcode	QRCounterOpcode		Opcode statistics	=
+	query		QR_OPCODE_QUERY		Number of Opcode=QUERY requests received by the b10-auth server.
+	iquery		QR_OPCODE_IQUERY	Number of Opcode=IQUERY requests received by the b10-auth server.
+	status		QR_OPCODE_STATUS	Number of Opcode=STATUS requests received by the b10-auth server.
+	notify		QR_OPCODE_NOTIFY	Number of Opcode=NOTIFY requests received by the b10-auth server.
+	update		QR_OPCODE_UPDATE	Number of Opcode=UPDATE requests received by the b10-auth server.
+	other		QR_OPCODE_OTHER		Number of requests in other OpCode received by the b10-auth server.
+	;
+responses	QR_RESPONSE			Number of responses sent by the b10-auth server.
+response	QRCounterResponse	Response statistics	=
+	truncated	QR_RESPONSE_TRUNCATED	Number of truncated responses sent by the b10-auth server.
+	edns0		QR_RESPONSE_EDNS0	Number of responses with EDNS0 sent by the b10-auth server.
+	tsig		QR_RESPONSE_TSIG	Number of responses with TSIG sent by the b10-auth server.
+	sig0		QR_RESPONSE_SIG0	Number of responses with SIG(0) sent by the b10-auth server; currently not implemented in BIND 10.
+	;
+qrysuccess	QR_QRYSUCCESS			Number of queries received by the b10-auth server resulted in rcode = NOERROR and the number of answer RR >= 1.
+qryauthans	QR_QRYAUTHANS			Number of queries received by the b10-auth server resulted in authoritative answer.
+qrynoauthans	QR_QRYNOAUTHANS			Number of queries received by the b10-auth server resulted in non-authoritative answer.
+qryreferral	QR_QRYREFERRAL			Number of queries received by the b10-auth server resulted in referral answer.
+qrynxrrset	QR_QRYNXRRSET			Number of queries received by the b10-auth server resulted in NOERROR but the number of answer RR == 0.
+authqryrej	QR_QRYREJECT			Number of authoritative queries rejected by the b10-auth server.
+rcode		QRCounterRcode	Rcode statistics	=
+	noerror		QR_RCODE_NOERROR	Number of queries received by the b10-auth server resulted in RCODE = 0 (NoError).
+	formerr		QR_RCODE_FORMERR	Number of queries received by the b10-auth server resulted in RCODE = 1 (FormErr).
+	servfail	QR_RCODE_SERVFAIL	Number of queries received by the b10-auth server resulted in RCODE = 2 (ServFail).
+	nxdomain	QR_RCODE_NXDOMAIN	Number of queries received by the b10-auth server resulted in RCODE = 3 (NXDomain).
+	notimp		QR_RCODE_NOTIMP		Number of queries received by the b10-auth server resulted in RCODE = 4 (NotImp).
+	refused		QR_RCODE_REFUSED	Number of queries received by the b10-auth server resulted in RCODE = 5 (Refused).
+	yxdomain	QR_RCODE_YXDOMAIN	Number of queries received by the b10-auth server resulted in RCODE = 6 (YXDomain).
+	yxrrset		QR_RCODE_YXRRSET	Number of queries received by the b10-auth server resulted in RCODE = 7 (YXRRSet).
+	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).
+	other		QR_RCODE_OTHER		Number of queries received by the b10-auth server resulted in other RCODEs.
+	;

+ 4 - 1
src/bin/auth/tests/Makefile.am

@@ -33,6 +33,9 @@ TESTS_ENVIRONMENT = \
 TESTS =
 if HAVE_GTEST
 
+# auto-generated by statistics_items.py
+BUILT_SOURCES = statistics_unittest.cc
+
 run_unittests_SOURCES = $(top_srcdir)/src/lib/dns/tests/unittest_util.h
 run_unittests_SOURCES += $(top_srcdir)/src/lib/dns/tests/unittest_util.cc
 run_unittests_SOURCES += ../auth_srv.h ../auth_srv.cc
@@ -49,11 +52,11 @@ run_unittests_SOURCES += config_syntax_unittest.cc
 run_unittests_SOURCES += command_unittest.cc
 run_unittests_SOURCES += common_unittest.cc
 run_unittests_SOURCES += query_unittest.cc
-run_unittests_SOURCES += statistics_unittest.cc
 run_unittests_SOURCES += datasrc_configurator_unittest.cc
 run_unittests_SOURCES += run_unittests.cc
 
 nodist_run_unittests_SOURCES = ../auth_messages.h ../auth_messages.cc
+nodist_run_unittests_SOURCES += statistics_unittest.cc
 
 run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
 run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)

+ 6 - 5
src/bin/auth/tests/auth_srv_unittest.cc

@@ -1078,7 +1078,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, qtype.ns, rcode.refused, response
+    //   request.tcp, opcode.query, rcode.refused, response
     // and these counters should not be incremented:
     //   request.tcp
     ConstElementPtr stats_after = server.getStatistics()->
@@ -1106,7 +1106,7 @@ TEST_F(AuthSrvTest, queryCounterTCPNormal) {
     server.processMessage(*io_message, *parse_message, *response_obuffer,
                           &dnsserv);
     // After processing the TCP query, these counters should be incremented:
-    //   request.tcp, opcode.query, qtype.ns, rcode.refused, response
+    //   request.tcp, opcode.query, rcode.refused, response
     // and these counters should not be incremented:
     //   request.udp
     ConstElementPtr stats_after = server.getStatistics()->
@@ -1135,7 +1135,7 @@ TEST_F(AuthSrvTest, queryCounterTCPAXFR) {
     EXPECT_FALSE(dnsserv.hasAnswer());
     // After processing the TCP AXFR query, these counters should be
     // incremented:
-    //   request.tcp, opcode.query, qtype.axfr
+    //   request.tcp, opcode.query
     // and these counters should not be incremented:
     //   request.udp, response
     ConstElementPtr stats_after = server.getStatistics()->
@@ -1163,7 +1163,7 @@ TEST_F(AuthSrvTest, queryCounterTCPIXFR) {
     EXPECT_FALSE(dnsserv.hasAnswer());
     // After processing the TCP IXFR query, these counters should be
     // incremented:
-    //   request.tcp, opcode.query, qtype.ixfr
+    //   request.tcp, opcode.query
     // and these counters should not be incremented:
     //   request.udp, response
     ConstElementPtr stats_after = server.getStatistics()->
@@ -1178,7 +1178,8 @@ TEST_F(AuthSrvTest, queryCounterOpcodes) {
     for (int i = 0; i < 16; ++i) {
         std::string item_name;
         int expected;
-        if (QROpCodeToQRCounterType[i] == QR_OPCODE_OTHER) {
+        if (isc::auth::statistics::QROpCodeToQRCounterType[i] ==
+            isc::auth::statistics::QR_OPCODE_OTHER) {
             item_name = "OTHER";
             other_expected += i + 1;
             expected = other_expected;

+ 3 - 3
src/bin/auth/tests/statistics_unittest.cc

@@ -41,11 +41,12 @@ using namespace std;
 using namespace isc::cc;
 using namespace isc::dns;
 using namespace isc::data;
-using isc::auth::statistics::Counters;
-using isc::auth::statistics::QRAttributes;
+using namespace isc::auth::statistics;
 
 namespace {
 
+// ### STATISTICS ITEMS DEFINITION ###
+
 class CountersTest : public ::testing::Test {
 protected:
     CountersTest() : counters() {}
@@ -122,7 +123,6 @@ TEST_F(CountersTest, incrementNormalQuery) {
 
     expect_nonzero.clear();
     expect_nonzero.insert("opcode.query");
-    expect_nonzero.insert("qtype.aaaa");
     expect_nonzero.insert("request.v6");
     expect_nonzero.insert("request.udp");
     expect_nonzero.insert("request.edns0");

+ 4 - 0
src/lib/dns/gen-rdatacode.py.in

@@ -34,6 +34,10 @@ class_definitions = ''
 classdir_mtime = 0
 rdatadef_mtime = 0
 rdatahdr_mtime = 0
+localstatedir='@@LOCALSTATEDIR@@'
+localstatedir2='@localstatedir@'
+builddir='@@BUILDDIR@@'
+builddir2='@builddir@'
 heading_txt = '''///////////////
 ///////////////
 ///////////////   THIS FILE IS AUTOMATICALLY GENERATED BY gen-rdatacode.py.