]> granicus.if.org Git - pdns/commitdiff
implement pdns_control qtypes
authorPeter van Dijk <peter.van.dijk@netherlabs.nl>
Thu, 8 Aug 2013 13:09:51 +0000 (15:09 +0200)
committerPeter van Dijk <peter.van.dijk@netherlabs.nl>
Thu, 8 Aug 2013 14:36:41 +0000 (16:36 +0200)
pdns/dynhandler.cc
pdns/dynhandler.hh
pdns/nameserver.hh
pdns/receiver.cc

index 56322c7e44c2c4af9db842be7a32f1e227ce827c..e77816b6780ce296625d646ddbf6670453b8efba 100644 (file)
@@ -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)
 {
index 33cda1590b58fc404db6d6ceee925920f5e56f84..d6fd1b28bf147598e102a5d1f3f2063dd1eaa60f 100644 (file)
@@ -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);
index ff0cb87a17fcd413d3dcd654db18b95aa352de36..2cfe43ecdbbacfee48e4f14841b9ce5feb9bcc11 100644 (file)
@@ -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
index 0d25c55e466d8efab9fe4b42509e2f348d45efd4..a4f79fdb233ab062ff1a0541351a2c2cfee83811 100644 (file)
@@ -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");