From: Aki Tuomi Date: Sat, 23 May 2015 13:57:16 +0000 (+0300) Subject: Add function for converting TSIG algorithm to string X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~79^2~9^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bfd4efae4099e0d24269af75551a33484da482a7;p=thirdparty%2Fpdns.git Add function for converting TSIG algorithm to string --- diff --git a/pdns/misc.cc b/pdns/misc.cc index bdda042cc5..b3584c2bf5 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -1024,3 +1024,17 @@ bool getTSIGHashEnum(const string &algoName, TSIGHashEnum& algoEnum) } return true; } + +string getTSIGAlgoName(TSIGHashEnum& algoEnum) +{ + switch(algoEnum) { + case TSIG_MD5: return "hmac-md5.sig-alg.reg.int"; + case TSIG_SHA1: return "hmac-sha1"; + case TSIG_SHA224: return "hmac-sha224"; + case TSIG_SHA256: return "hmac-sha256"; + case TSIG_SHA384: return "hmac-sha384"; + case TSIG_SHA512: return "hmac-sha512"; + case TSIG_GSS: return "gss-tsig"; + } + throw PDNSException("getTSIGAlgoName does not understand given algorithm, please fix!"); +} diff --git a/pdns/misc.hh b/pdns/misc.hh index 6849bd04ac..e397250d34 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -71,6 +71,7 @@ uint32_t getLong(const unsigned char *p); uint32_t getLong(const char *p); uint32_t pdns_strtoui(const char *nptr, char **endptr, int base); bool getTSIGHashEnum(const string &algoName, TSIGHashEnum& algoEnum); +string getTSIGAlgoName(TSIGHashEnum& algoEnum); int logFacilityToLOG(unsigned int facility);