Commit d394e64f authored by Jeremy C. Reed's avatar Jeremy C. Reed
Browse files

[trac1446]Merge branch 'master' into trac1446

I fixed three conflicts.

In addition to merge this also updates new bin/dhcp4 to use libdhcp++.la.
parents 582b0cc8 d75d622a
336. [func] jelte
345. [func] tomek
dhcp4: Dummy DHCPv4 component implemented. Currently it does
nothing useful, except providing skeleton implementation that can
be expanded in the future.
(Trac #992, git d6e33479365c8f8f62ef2b9aa5548efe6b194601)
344. [func] y-aharen
src/lib/statistics: Added statistics counter library for entire server
items and per zone items. Also, modified b10-auth to use it. It is
also intended to use in the other modules such as b10-resolver.
(Trac #510, git afddaf4c5718c2a0cc31f2eee79c4e0cc625499f)
343. [func] jelte
Added IXFR-out system tests, based on the first two test sets of
http://bind10.isc.org/wiki/IxfrSystemTests.
(Trac #1314, git 1655bed624866a766311a01214597db01b4c7cec)
342. [bug] stephen
In the resolver, a FORMERR received from an upstream nameserver
now results in a SERVFAIL being returned as a response to the original
query. Additional debug messages added to distinguish between
different errors in packets received from upstream nameservers.
(Trac #1383, git 9b2b249d23576c999a65d8c338e008cabe45f0c9)
341. [func] tomek
libdhcp++: Support for handling both IPv4 and IPv6 added.
Also added support for binding IPv4 sockets.
(Trac #1238, git 86a4ce45115dab4d3978c36dd2dbe07edcac02ac)
340. [build] jelte
Fixed several linker issues related to recent gcc versions, botan
and gtest.
(Trac #1442, git 91fb141bfb3aadfdf96f13e157a26636f6e9f9e3)
339. [bug] jinmei
libxfr, used by b10-auth to share TCP sockets with b10-xfrout,
incorrectly propagated ASIO specific exceptions to the application
if the given file name was too long. This could lead to
unexpected shut down of b10-auth.
(Trac #1387, git a5e9d9176e9c60ef20c0f5ef59eeb6838ed47ab2)
338. [bug] jinmei
b10-xfrin didn't check SOA serials of SOA and IXFR responses,
which resulted in unnecessary transfer or unexpected IXFR
timeouts (these issues were not overlooked but deferred to be
fixed until #1278 was completed). Validation on responses to SOA
queries were tightened, too.
(Trac #1299, git 6ff03bb9d631023175df99248e8cc0cda586c30a)
337. [func] tomek
libdhcp++: Support for DHCPv4 option that can store a single
address or a list of IPv4 addresses added. Support for END option
added.
(Trac #1350, git cc20ff993da1ddb1c6e8a98370438b45a2be9e0a)
336. [func] jelte
libdns++ (and its python wrapper) now includes a class Serial, for
SOA SERIAL comparison and addition. Operations on instances of this
class follow the specification from RFC 1982.
......@@ -31,12 +86,12 @@
potential problems and were fixed.
(Trac #1389, git 3fdce88046bdad392bd89ea656ec4ac3c858ca2f)
333. [bug] dvv
Solaris needs "-z now" to force non-lazy binding and prevent g++ static
initialization code from deadlocking.
333. [bug] dvv
Solaris needs "-z now" to force non-lazy binding and prevent
g++ static initialization code from deadlocking.
(Trac #1439, git c789138250b33b6b08262425a08a2a0469d90433)
332. [bug] vorner
332. [bug] vorner
C++ exceptions in the isc.dns.Rdata wrapper are now converted
to python ones instead of just aborting the interpretter.
(Trac #1407, git 5b64e839be2906b8950f5b1e42a3fadd72fca033)
......
......@@ -480,23 +480,33 @@ else
fi
fi
BOTAN_LDFLAGS=`${BOTAN_CONFIG} --libs`
BOTAN_LIBS=`${BOTAN_CONFIG} --libs`
BOTAN_INCLUDES=`${BOTAN_CONFIG} --cflags`
# We expect botan-config --libs to contain -L<path_to_libbotan>, but
# this is not always the case. As a heuristics workaround we add
# -L`botan-config --prefix/lib` in this case. Same for BOTAN_INCLUDES
# (but using include instead of lib) below.
# -L`botan-config --prefix/lib` in this case (if not present already).
# Same for BOTAN_INCLUDES (but using include instead of lib) below.
if [ $BOTAN_CONFIG --prefix >/dev/null 2>&1 ] ; then
echo ${BOTAN_LDFLAGS} | grep -- -L > /dev/null || \
BOTAN_LDFLAGS="-L`${BOTAN_CONFIG} --prefix`/lib ${BOTAN_LDFLAGS}"
echo ${BOTAN_LIBS} | grep -- -L > /dev/null || \
BOTAN_LIBS="-L`${BOTAN_CONFIG} --prefix`/lib ${BOTAN_LIBS}"
echo ${BOTAN_INCLUDES} | grep -- -I > /dev/null || \
BOTAN_INCLUDES="-I`${BOTAN_CONFIG} --prefix`/include ${BOTAN_INCLUDES}"
fi
# botan-config script (and the way we call pkg-config) returns -L and -l
# as one string, but we need them in separate values
BOTAN_LDFLAGS=
BOTAN_NEWLIBS=
for flag in ${BOTAN_LIBS}; do
BOTAN_LDFLAGS="${BOTAN_LDFLAGS} `echo $flag | sed -ne '/^\(\-L\)/p'`"
BOTAN_LIBS="${BOTAN_LIBS} `echo $flag | sed -ne '/^\(\-l\)/p'`"
done
# See python_rpath for some info on why we do this
if test $rpath_available = yes; then
BOTAN_RPATH=
for flag in ${BOTAN_LDFLAGS}; do
for flag in ${BOTAN_LIBS}; do
BOTAN_RPATH="${BOTAN_RPATH} `echo $flag | sed -ne 's/^\(\-L\)/-R/p'`"
done
AC_SUBST(BOTAN_RPATH)
......@@ -512,13 +522,13 @@ AC_SUBST(BOTAN_RPATH)
fi
AC_SUBST(BOTAN_LDFLAGS)
AC_SUBST(BOTAN_LIBS)
AC_SUBST(BOTAN_INCLUDES)
CPPFLAGS_SAVED=$CPPFLAGS
CPPFLAGS="$BOTAN_INCLUDES $CPPFLAGS"
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$BOTAN_LDFLAGS $LDFLAGS"
LIBS_SAVED="$LIBS"
LIBS="$LIBS $BOTAN_LIBS"
AC_CHECK_HEADERS([botan/botan.h],,AC_MSG_ERROR([Missing required header files.]))
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <botan/botan.h>
......@@ -533,7 +543,7 @@ AC_LINK_IFELSE(
AC_MSG_ERROR([Needs Botan library 1.8 or higher])]
)
CPPFLAGS=$CPPFLAGS_SAVED
LDFLAGS=$LDFLAGS_SAVED
LIBS=$LIBS_SAVED
# Check for log4cplus
log4cplus_path="yes"
......@@ -545,7 +555,7 @@ if test "${log4cplus_path}" = "no" ; then
AC_MSG_ERROR([Need log4cplus])
elif test "${log4cplus_path}" != "yes" ; then
LOG4CPLUS_INCLUDES="-I${log4cplus_path}/include"
LOG4CPLUS_LDFLAGS="-L${log4cplus_path}/lib"
LOG4CPLUS_LIBS="-L${log4cplus_path}/lib"
else
# If not specified, try some common paths.
log4cplusdirs="/usr/local /usr/pkg /opt /opt/local"
......@@ -553,21 +563,21 @@ else
do
if test -f $d/include/log4cplus/logger.h; then
LOG4CPLUS_INCLUDES="-I$d/include"
LOG4CPLUS_LDFLAGS="-L$d/lib"
LOG4CPLUS_LIBS="-L$d/lib"
break
fi
done
fi
LOG4CPLUS_LDFLAGS="$LOG4CPLUS_LDFLAGS -llog4cplus $MULTITHREADING_FLAG"
LOG4CPLUS_LIBS="$LOG4CPLUS_LIBS -llog4cplus $MULTITHREADING_FLAG"
AC_SUBST(LOG4CPLUS_LDFLAGS)
AC_SUBST(LOG4CPLUS_LIBS)
AC_SUBST(LOG4CPLUS_INCLUDES)
CPPFLAGS_SAVED=$CPPFLAGS
CPPFLAGS="$LOG4CPLUS_INCLUDES $CPPFLAGS"
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LOG4CPLUS_LDFLAGS $LDFLAGS"
LIBS_SAVED="$LIBS"
LIBS="$LOG4CPLUS_LIBS $LIBS"
AC_CHECK_HEADERS([log4cplus/logger.h],,AC_MSG_ERROR([Missing required header files.]))
AC_LINK_IFELSE(
......@@ -582,7 +592,7 @@ AC_LINK_IFELSE(
)
CPPFLAGS=$CPPFLAGS_SAVED
LDFLAGS=$LDFLAGS_SAVED
LIBS=$LIBS_SAVED
#
# Configure Boost header path
......@@ -675,6 +685,13 @@ else
AM_CONDITIONAL(NEED_LIBBOOST_THREAD, test "${use_boost_threads}" = "yes")
fi
# I can't get some of the #include <asio.hpp> right without this
# TODO: find the real cause of asio/boost wanting pthreads
# (this currently only occurs for src/lib/cc/session_unittests)
PTHREAD_LDFLAGS=
AC_CHECK_LIB(pthread, pthread_create,[ PTHREAD_LDFLAGS=-lpthread ], [])
AC_SUBST(PTHREAD_LDFLAGS)
AC_SUBST(MULTITHREADING_FLAG)
#
# Check availability of gtest, which will be used for unit tests.
......@@ -711,6 +728,48 @@ then
GTEST_LDFLAGS="-L$dir/lib"
GTEST_LDADD="-lgtest"
GTEST_FOUND="true"
# There is no gtest-config script on this
# system, which is supposed to inform us
# whether we need pthreads as well (a
# gtest compile-time option). So we still
# need to test that manually.
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GTEST_INCLUDES"
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $GTEST_LDFLAGS"
LIBS_SAVED=$LIBS
LIBS="$LIBS $GTEST_LDADD"
AC_MSG_CHECKING([Checking whether gtest tests need pthreads])
# First try to compile without pthreads
AC_TRY_LINK([
#include <gtest/gtest.h>
],[
int i = 0;
char* c = NULL;
::testing::InitGoogleTest(&i, &c);
return (0);
],
[ AC_MSG_RESULT(no) ],
[
LIBS="$SAVED_LIBS $GTEST_LDADD $PTHREAD_LDFLAGS"
# Now try to compile with pthreads
AC_TRY_LINK([
#include <gtest/gtest.h>
],[
int i = 0;
char* c = NULL;
::testing::InitGoogleTest(&i, &c);
return (0);
],
[ AC_MSG_RESULT(yes)
GTEST_LDADD="$GTEST_LDADD $PTHREAD_LDFLAGS"
],
# Apparently we can't compile it at all
[ AC_MSG_ERROR(unable to compile with gtest) ])
])
CPPFLAGS=$CPPFLAGS_SAVED
LDFLAGS=$LDFLAGS_SAVED
LIBS=$LIBS_SAVED
break
fi
done
......@@ -737,15 +796,6 @@ if test "x$HAVE_PKG_CONFIG" = "xno" ; then
fi
PKG_CHECK_MODULES(SQLITE, sqlite3 >= 3.3.9, enable_features="$enable_features SQLite3")
# I can't get some of the #include <asio.hpp> right without this
# TODO: find the real cause of asio/boost wanting pthreads
# (this currently only occurs for src/lib/cc/session_unittests)
PTHREAD_LDFLAGS=
AC_CHECK_LIB(pthread, pthread_create,[ PTHREAD_LDFLAGS=-lpthread ], [])
AC_SUBST(PTHREAD_LDFLAGS)
AC_SUBST(MULTITHREADING_FLAG)
#
# ASIO: we extensively use it as the C++ event management module.
#
......@@ -842,6 +892,8 @@ AC_CONFIG_FILES([Makefile
src/bin/auth/benchmarks/Makefile
src/bin/dhcp6/Makefile
src/bin/dhcp6/tests/Makefile
src/bin/dhcp4/Makefile
src/bin/dhcp4/tests/Makefile
src/bin/resolver/Makefile
src/bin/resolver/tests/Makefile
src/bin/sockcreator/Makefile
......@@ -912,6 +964,7 @@ AC_CONFIG_FILES([Makefile
src/lib/datasrc/tests/Makefile
src/lib/datasrc/tests/testdata/Makefile
src/lib/xfr/Makefile
src/lib/xfr/tests/Makefile
src/lib/log/Makefile
src/lib/log/compiler/Makefile
src/lib/log/tests/Makefile
......@@ -933,6 +986,8 @@ AC_CONFIG_FILES([Makefile
src/lib/util/tests/Makefile
src/lib/acl/Makefile
src/lib/acl/tests/Makefile
src/lib/statistics/Makefile
src/lib/statistics/tests/Makefile
tests/Makefile
tests/system/Makefile
tests/tools/Makefile
......@@ -980,6 +1035,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/dhcp4/spec_config.h.pre
src/bin/dhcp6/spec_config.h.pre
src/bin/tests/process_rename_test.py
src/lib/config/tests/data_def_unittests_config.h
......@@ -1087,8 +1143,9 @@ dnl includes too
Boost: ${BOOST_INCLUDES}
Botan: ${BOTAN_INCLUDES}
${BOTAN_LDFLAGS}
${BOTAN_LIBS}
Log4cplus: ${LOG4CPLUS_INCLUDES}
${LOG4CPLUS_LDFLAGS}
${LOG4CPLUS_LIBS}
SQLite: $SQLITE_CFLAGS
$SQLITE_LIBS
......
......@@ -1502,6 +1502,49 @@ what if a NOTIFY is sent?
-->
<section id="zonemgr">
<title>Secondary Manager</title>
<para>
The <command>b10-zonemgr</command> process is started by
<command>bind10</command>.
It keeps track of SOA refresh, retry, and expire timers
and other details for BIND 10 to perform as a slave.
When the <command>b10-auth</command> authoritative DNS server
receives a NOTIFY message, <command>b10-zonemgr</command>
may tell <command>b10-xfrin</command> to do a refresh
to start an inbound zone transfer.
The secondary manager resets its counters when a new zone is
transferred in.
</para>
<note><simpara>
Access control (such as allowing notifies) is not yet provided.
The primary/secondary service is not yet complete.
</simpara></note>
<para>
The following example shows using <command>bindctl</command>
to configure the server to be a secondary for the example zone:
<screen>&gt; <userinput>config add Zonemgr/secondary_zones</userinput>
&gt; <userinput>config set Zonemgr/secondary_zones[0]/name "<option>example.com</option>"</userinput>
&gt; <userinput>config set Zonemgr/secondary_zones[0]/class "<option>IN</option>"</userinput>
&gt; <userinput>config commit</userinput></screen>
<!-- TODO: remove the IN class example above when it is the default -->
</para>
<para>
If the zone does not exist in the data source already
(i.e. no SOA record for it), <command>b10-zonemgr</command>
will automatically tell <command>b10-xfrin</command>
to transfer the zone in.
</para>
</section>
<section>
<title>Trigger an Incoming Zone Transfer Manually</title>
......@@ -1514,7 +1557,6 @@ what if a NOTIFY is sent?
</para>
</section>
<!-- TODO: can that retransfer be used to identify a new zone? -->
<!-- TODO: what if doesn't exist at that master IP? -->
......@@ -1606,31 +1648,6 @@ what is XfroutClient xfr_client??
</chapter>
<chapter id="zonemgr">
<title>Secondary Manager</title>
<para>
The <command>b10-zonemgr</command> process is started by
<command>bind10</command>.
It keeps track of SOA refresh, retry, and expire timers
and other details for BIND 10 to perform as a slave.
When the <command>b10-auth</command> authoritative DNS server
receives a NOTIFY message, <command>b10-zonemgr</command>
may tell <command>b10-xfrin</command> to do a refresh
to start an inbound zone transfer.
The secondary manager resets its counters when a new zone is
transferred in.
</para>
<note><simpara>
Access control (such as allowing notifies) is not yet provided.
The primary/secondary service is not yet complete.
</simpara></note>
<!-- TODO: lots to describe for zonemgr -->
</chapter>
<chapter id="resolverserver">
<title>Recursive Name Server</title>
......
SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin xfrout \
usermgr zonemgr stats tests resolver sockcreator dhcp6
usermgr zonemgr stats tests resolver sockcreator dhcp6 dhcp4
check-recursive: all-recursive
......@@ -71,6 +71,7 @@ b10_auth_LDADD += $(top_builddir)/src/lib/asiolink/libasiolink.la
b10_auth_LDADD += $(top_builddir)/src/lib/log/liblog.la
b10_auth_LDADD += $(top_builddir)/src/lib/xfr/libxfr.la
b10_auth_LDADD += $(top_builddir)/src/lib/server_common/libserver_common.la
b10_auth_LDADD += $(top_builddir)/src/lib/statistics/libstatistics.la
b10_auth_LDADD += $(SQLITE_LIBS)
# TODO: config.h.in is wrong because doesn't honor pkgdatadir
......
......@@ -671,9 +671,9 @@ void
AuthSrvImpl::incCounter(const int protocol) {
// Increment query counter.
if (protocol == IPPROTO_UDP) {
counters_.inc(AuthCounters::COUNTER_UDP_QUERY);
counters_.inc(AuthCounters::SERVER_UDP_QUERY);
} else if (protocol == IPPROTO_TCP) {
counters_.inc(AuthCounters::COUNTER_TCP_QUERY);
counters_.inc(AuthCounters::SERVER_TCP_QUERY);
} else {
// unknown protocol
isc_throw(Unexpected, "Unknown protocol: " << protocol);
......@@ -766,7 +766,7 @@ bool AuthSrv::submitStatistics() const {
}
uint64_t
AuthSrv::getCounter(const AuthCounters::CounterType type) const {
AuthSrv::getCounter(const AuthCounters::ServerCounterType type) const {
return (impl_->counters_.getCounter(type));
}
......
......@@ -343,7 +343,7 @@ public:
/// \param type Type of a counter to get the value of
///
/// \return the value of the counter.
uint64_t getCounter(const AuthCounters::CounterType type) const;
uint64_t getCounter(const AuthCounters::ServerCounterType type) const;
/**
* \brief Set and get the addresses we listen on.
......
......@@ -32,8 +32,9 @@ query_bench_LDADD += $(top_builddir)/src/lib/cc/libcc.la
query_bench_LDADD += $(top_builddir)/src/lib/xfr/libxfr.la
query_bench_LDADD += $(top_builddir)/src/lib/log/liblog.la
query_bench_LDADD += $(top_builddir)/src/lib/nsas/libnsas.la
query_bench_LDADD += $(top_builddir)/src/lib/asiodns/libasiodns.la
query_bench_LDADD += $(top_builddir)/src/lib/asiolink/libasiolink.la
query_bench_LDADD += $(top_builddir)/src/lib/server_common/libserver_common.la
query_bench_LDADD += $(top_builddir)/src/lib/asiodns/libasiodns.la
query_bench_LDADD += $(top_builddir)/src/lib/statistics/libstatistics.la
query_bench_LDADD += $(SQLITE_LIBS)
......@@ -117,7 +117,6 @@ void
Query::addNXDOMAINProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
if (nsec->getRdataCount() == 0) {
isc_throw(BadNSEC, "NSEC for NXDOMAIN is empty");
return;
}
// Add the NSEC proving NXDOMAIN to the authority section.
......@@ -152,7 +151,6 @@ Query::addNXDOMAINProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
if (fresult.code != ZoneFinder::NXDOMAIN || !fresult.rrset ||
fresult.rrset->getRdataCount() == 0) {
isc_throw(BadNSEC, "Unexpected result for wildcard NXDOMAIN proof");
return;
}
// Add the (no-) wildcard proof only when it's different from the NSEC
......@@ -178,7 +176,6 @@ Query::addWildcardProof(ZoneFinder& finder) {
if (fresult.code != ZoneFinder::NXDOMAIN || !fresult.rrset ||
fresult.rrset->getRdataCount() == 0) {
isc_throw(BadNSEC, "Unexpected result for wildcard proof");
return;
}
response_.addRRset(Message::SECTION_AUTHORITY,
boost::const_pointer_cast<RRset>(fresult.rrset),
......@@ -186,12 +183,11 @@ Query::addWildcardProof(ZoneFinder& finder) {
}
void
Query::addWildcardNxrrsetProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
Query::addWildcardNXRRSETProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
// There should be one NSEC RR which was found in the zone to prove
// that there is not matched <QNAME,QTYPE> via wildcard expansion.
if (nsec->getRdataCount() == 0) {
isc_throw(BadNSEC, "NSEC for WILDCARD_NXRRSET is empty");
return;
}
// Add this NSEC RR to authority section.
response_.addRRset(Message::SECTION_AUTHORITY,
......@@ -203,7 +199,6 @@ Query::addWildcardNxrrsetProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
if (fresult.code != ZoneFinder::NXDOMAIN || !fresult.rrset ||
fresult.rrset->getRdataCount() == 0) {
isc_throw(BadNSEC, "Unexpected result for no match QNAME proof");
return;
}
if (nsec->getName() != fresult.rrset->getName()) {
......@@ -387,7 +382,7 @@ Query::process() {
case ZoneFinder::WILDCARD_NXRRSET:
addSOA(*result.zone_finder);
if (dnssec_ && db_result.rrset) {
addWildcardNxrrsetProof(zfinder,db_result.rrset);
addWildcardNXRRSETProof(zfinder, db_result.rrset);
}
break;
default:
......
......@@ -91,7 +91,7 @@ private:
/// query is to be found.
/// \param nsec The RRset (NSEC RR) which proved that there is no matched
/// <QNAME,QTTYPE>.
void addWildcardNxrrsetProof(isc::datasrc::ZoneFinder& finder,
void addWildcardNXRRSETProof(isc::datasrc::ZoneFinder& finder,
isc::dns::ConstRRsetPtr nsec);
/// \brief Look up additional data (i.e., address records for the names
......
......@@ -18,48 +18,67 @@
#include <cc/data.h>
#include <cc/session.h>
#include <statistics/counter.h>
#include <statistics/counter_dict.h>
#include <sstream>
#include <iostream>
#include <boost/noncopyable.hpp>
using namespace isc::auth;
using namespace isc::statistics;
// TODO: We need a namespace ("auth_server"?) to hold
// AuthSrv and AuthCounters.
class AuthCountersImpl {
private:
// prohibit copy
AuthCountersImpl(const AuthCountersImpl& source);
AuthCountersImpl& operator=(const AuthCountersImpl& source);
// TODO: Make use of wrappers like isc::dns::Opcode
// for counter item type.
class AuthCountersImpl : boost::noncopyable {
public:
AuthCountersImpl();
~AuthCountersImpl();
void inc(const AuthCounters::CounterType type);
void inc(const AuthCounters::ServerCounterType type);
void inc(const std::string& zone,
const AuthCounters::PerZoneCounterType type);
bool submitStatistics() const;
void setStatisticsSession(isc::cc::AbstractSession* statistics_session);
void registerStatisticsValidator
(AuthCounters::validator_type validator);
// Currently for testing purpose only
uint64_t getCounter(const AuthCounters::CounterType type) const;
uint64_t getCounter(const AuthCounters::ServerCounterType type) const;
private:
std::vector<uint64_t> counters_;
Counter server_counter_;
CounterDictionary per_zone_counter_;
isc::cc::AbstractSession* statistics_session_;
AuthCounters::validator_type validator_;
};
AuthCountersImpl::AuthCountersImpl() :
// initialize counter
// size: AuthCounters::COUNTER_TYPES, initial value: 0
counters_(AuthCounters::COUNTER_TYPES, 0),
// size of server_counter_: AuthCounters::SERVER_COUNTER_TYPES
// size of per_zone_counter_: AuthCounters::PER_ZONE_COUNTER_TYPES
server_counter_(AuthCounters::SERVER_COUNTER_TYPES),
per_zone_counter_(AuthCounters::PER_ZONE_COUNTER_TYPES),
statistics_session_(NULL)
{}
{
per_zone_counter_.addElement("_SERVER_");
}
AuthCountersImpl::~AuthCountersImpl()
{}
void
AuthCountersImpl::inc(const AuthCounters::CounterType type) {
++counters_.at(type);
AuthCountersImpl::inc(const AuthCounters::ServerCounterType type) {
server_counter_.inc(type);
}
void
AuthCountersImpl::inc(const std::string& zone,
const AuthCounters::PerZoneCounterType type)
{
per_zone_counter_[zone].inc(type);
}
bool
......@@ -73,9 +92,9 @@ AuthCountersImpl::submitStatistics() const {
<< "{ \"owner\": \"Auth\","
<< " \"data\":"
<< "{ \"queries.udp\": "
<< counters_.at(AuthCounters::COUNTER_UDP_QUERY)
<< server_counter_.get(AuthCounters::SERVER_UDP_QUERY)
<< ", \"queries.tcp\": "
<< counters_.at(AuthCounters::COUNTER_TCP_QUERY)
<< server_counter_.get(AuthCounters::SERVER_TCP_QUERY)
<< " }"
<< "}"
<< "]}";
......@@ -126,19 +145,17 @@ AuthCountersImpl::registerStatisticsValidator
// Currently for testing purpose only
uint64_t
AuthCountersImpl::getCounter(const AuthCounters::CounterType type) const {
return (counters_.at(type));
AuthCountersImpl::getCounter(const AuthCounters::ServerCounterType type) const {
return (server_counter_.get(type));
}