From: Peter van Dijk Date: Thu, 8 Aug 2013 13:09:51 +0000 (+0200) Subject: implement pdns_control qtypes X-Git-Tag: rec-3.6.0-rc1~528^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba7244a5093230d74ae92f2ad44a76615ecd2b2c;p=thirdparty%2Fpdns.git implement pdns_control qtypes --- diff --git a/pdns/dynhandler.cc b/pdns/dynhandler.cc index 56322c7e44..e77816b678 100644 --- a/pdns/dynhandler.cc +++ b/pdns/dynhandler.cc @@ -26,6 +26,7 @@ #include "misc.hh" #include "communicator.hh" #include "dnsseckeeper.hh" +#include "nameserver.hh" static bool s_pleasequit; static string d_status; @@ -165,6 +166,18 @@ string DLCCHandler(const vector&parts, Utility::pid_t ppid) return os.str(); } +string DLQTypesHandler(const vector&parts, Utility::pid_t ppid) +{ + ostringstream os; + typedef map qtmap; + qtmap stats = g_rs.getQTypeResponseCounts(); + BOOST_FOREACH(qtmap::value_type &i, stats) + { + os<&parts, Utility::pid_t ppid) { diff --git a/pdns/dynhandler.hh b/pdns/dynhandler.hh index 33cda1590b..d6fd1b28bf 100644 --- a/pdns/dynhandler.hh +++ b/pdns/dynhandler.hh @@ -43,6 +43,7 @@ string DLShowHandler(const vector&parts, Utility::pid_t ppid); string DLUptimeHandler(const vector&parts, Utility::pid_t ppid); string DLSettingsHandler(const vector&parts, Utility::pid_t ppid); string DLCCHandler(const vector&parts, Utility::pid_t ppid); +string DLQTypesHandler(const vector&parts, Utility::pid_t ppid); string DLStatusHandler(const vector&parts, Utility::pid_t ppid); string DLNotifyHandler(const vector&parts, Utility::pid_t ppid); string DLNotifyHostHandler(const vector&parts, Utility::pid_t ppid); diff --git a/pdns/nameserver.hh b/pdns/nameserver.hh index ff0cb87a17..2cfe43ecdb 100644 --- a/pdns/nameserver.hh +++ b/pdns/nameserver.hh @@ -35,6 +35,7 @@ #include "statbag.hh" #include "namespaces.hh" #include "dnspacket.hh" +#include "responsestats.hh" /** This is the main class. It opens a socket on udp port 53 and waits for packets. Those packets can be retrieved with the receive() member function, which returns a DNSPacket. @@ -86,4 +87,6 @@ private: bool AddressIsUs(const ComboAddress& remote); +extern ResponseStats g_rs; + #endif diff --git a/pdns/receiver.cc b/pdns/receiver.cc index 0d25c55e46..a4f79fdb23 100644 --- a/pdns/receiver.cc +++ b/pdns/receiver.cc @@ -552,6 +552,7 @@ int main(int argc, char **argv) DynListener::registerFunc("VERSION",&DLVersionHandler, "get instance version"); DynListener::registerFunc("PURGE",&DLPurgeHandler, "purge entries from packet cache", "[]"); DynListener::registerFunc("CCOUNTS",&DLCCHandler, "get cache statistics"); + DynListener::registerFunc("QTYPES", &DLQTypesHandler, "get QType statistics"); DynListener::registerFunc("SET",&DLSettingsHandler, "set config variables", " "); DynListener::registerFunc("RETRIEVE",&DLNotifyRetrieveHandler, "retrieve slave domain", ""); DynListener::registerFunc("CURRENT-CONFIG",&DLCurrentConfigHandler, "Retrieve the current configuration");