Permalink
Browse files

implement pdns_control qtypes

  • Loading branch information...
1 parent 6d7c406 commit ba7244a5093230d74ae92f2ad44a76615ecd2b2c @Habbie Habbie committed Aug 8, 2013
Showing with 18 additions and 0 deletions.
  1. +13 −0 pdns/dynhandler.cc
  2. +1 −0 pdns/dynhandler.hh
  3. +3 −0 pdns/nameserver.hh
  4. +1 −0 pdns/receiver.cc
View
@@ -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<string>&parts, Utility::pid_t ppid)
return os.str();
}
+string DLQTypesHandler(const vector<string>&parts, Utility::pid_t ppid)
+{
+ ostringstream os;
+ typedef map<uint16_t, uint64_t> qtmap;
+ qtmap stats = g_rs.getQTypeResponseCounts();
+ BOOST_FOREACH(qtmap::value_type &i, stats)
+ {
+ os<<QType(i.first).getName()<<"("<<i.first<<"):"<<i.second<<"; ";
+ }
+ os<<endl;
+ return os.str();
+}
string DLSettingsHandler(const vector<string>&parts, Utility::pid_t ppid)
{
View
@@ -43,6 +43,7 @@ string DLShowHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLUptimeHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLSettingsHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLCCHandler(const vector<string>&parts, Utility::pid_t ppid);
+string DLQTypesHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLStatusHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLNotifyHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLNotifyHostHandler(const vector<string>&parts, Utility::pid_t ppid);
View
@@ -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
View
@@ -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", "[<record>]");
DynListener::registerFunc("CCOUNTS",&DLCCHandler, "get cache statistics");
+ DynListener::registerFunc("QTYPES", &DLQTypesHandler, "get QType statistics");
DynListener::registerFunc("SET",&DLSettingsHandler, "set config variables", "<var> <value>");
DynListener::registerFunc("RETRIEVE",&DLNotifyRetrieveHandler, "retrieve slave domain", "<domain>");
DynListener::registerFunc("CURRENT-CONFIG",&DLCurrentConfigHandler, "Retrieve the current configuration");

0 comments on commit ba7244a

Please sign in to comment.