summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-10-12 12:53:04 +0100
committerPeter Powell <petpow@saberuk.com>2019-10-13 22:05:19 +0100
commit51b9b4c9b404bd801be194644133be47bd035b58 (patch)
treee5ef99d606ae80a6d827a68ae9c9260507c59ce6
parentdd24f8ac713793d5d5a7e959228937f48788ba66 (diff)
Add GetTypeStr to the DNS API.
-rw-r--r--include/modules/dns.h1
-rw-r--r--src/coremods/core_dns.cpp19
2 files changed, 20 insertions, 0 deletions
diff --git a/include/modules/dns.h b/include/modules/dns.h
index 3db651798..d371a62ea 100644
--- a/include/modules/dns.h
+++ b/include/modules/dns.h
@@ -146,6 +146,7 @@ namespace DNS
virtual void Process(Request* req) = 0;
virtual void RemoveRequest(Request* req) = 0;
virtual std::string GetErrorStr(Error) = 0;
+ virtual std::string GetTypeStr(QueryType) = 0;
};
/** A DNS query.
diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp
index 8532179fb..c736034bf 100644
--- a/src/coremods/core_dns.cpp
+++ b/src/coremods/core_dns.cpp
@@ -538,6 +538,25 @@ class MyManager : public Manager, public Timer, public EventHandler
}
}
+ std::string GetTypeStr(QueryType qt) CXX11_OVERRIDE
+ {
+ switch (qt)
+ {
+ case QUERY_A:
+ return "A";
+ case QUERY_AAAA:
+ return "AAAA";
+ case QUERY_CNAME:
+ return "CNAME";
+ case QUERY_PTR:
+ return "PTR";
+ case QUERY_TXT:
+ return "TXT";
+ default:
+ return "UNKNOWN";
+ }
+ }
+
void OnEventHandlerError(int errcode) CXX11_OVERRIDE
{
ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "UDP socket got an error event");