#include "secpoll-auth.hh"
#include <sys/time.h>
#include <sys/resource.h>
+#include "dynhandler.hh"
#include <boost/foreach.hpp>
bool g_anyToTcp;
S.declare("incoming-notifications", "NOTIFY packets received.");
S.declare("uptime", "Uptime of process in seconds", uptimeOfProcess);
+#ifdef __linux__
+ S.declare("udp-recvbuf-errors", "UDP 'recvbuf' errors", udpErrorStats);
+ S.declare("udp-sndbuf-errors", "UDP 'sndbuf' errors", udpErrorStats);
+ S.declare("udp-noport-errors", "UDP 'noport' errors", udpErrorStats);
+ S.declare("udp-in-errors", "UDP 'in' errors", udpErrorStats);
+#endif
+
S.declare("sys-msec", "Number of msec spent in system time", getSysUserTimeMsec);
S.declare("user-msec", "Number of msec spent in user time", getSysUserTimeMsec);
S.declare("meta-cache-size", "Number of entries in the metadata cache", DNSSECKeeper::dbdnssecCacheSizes);
return "Ok";
}
+uint64_t udpErrorStats(const std::string& str)
+{
+ ifstream ifs("/proc/net/snmp");
+ if(!ifs)
+ return 0;
+ string line;
+ vector<string> parts;
+ while(getline(ifs,line)) {
+ if(boost::starts_with(line, "Udp: ") && isdigit(line[5])) {
+ stringtok(parts, line, " \n\t\r");
+ if(parts.size() < 7)
+ break;
+ if(str=="udp-rcvbuf-errors")
+ return boost::lexical_cast<uint64_t>(parts[5]);
+ else if(str=="udp-sndbuf-errors")
+ return boost::lexical_cast<uint64_t>(parts[6]);
+ else if(str=="udp-noport-errors")
+ return boost::lexical_cast<uint64_t>(parts[2]);
+ else if(str=="udp-in-errors")
+ return boost::lexical_cast<uint64_t>(parts[3]);
+ else
+ return 0;
+ }
+ }
+ return 0;
+}
+
string DLListZones(const vector<string>&parts, Utility::pid_t ppid)
{
UeberBackend B;
string DLNotifyRetrieveHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLCurrentConfigHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLListZones(const vector<string>&parts, Utility::pid_t ppid);
+uint64_t udpErrorStats(const std::string& str);
#endif /* PDNS_DYNHANDLER_HH */