From 51b9b4c9b404bd801be194644133be47bd035b58 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 12 Oct 2019 12:53:04 +0100 Subject: Add GetTypeStr to the DNS API. --- include/modules/dns.h | 1 + src/coremods/core_dns.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) 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"); -- cgit v1.2.3