summaryrefslogtreecommitdiffstats
path: root/src/lib/dns/tsigerror.cc
diff options
context:
space:
mode:
authorJINMEI Tatuya <jinmei@isc.org>2011-05-06 18:02:17 +0200
committerJINMEI Tatuya <jinmei@isc.org>2011-05-06 18:02:17 +0200
commitcabd3b127cf5ab2b916c5717992338316496de8b (patch)
treed059450b4519df4e8a858ec1b95f118a32bb857a /src/lib/dns/tsigerror.cc
parent[trac893] temporary change for short signatures: modify cryptolink to reject (diff)
downloadkea-cabd3b127cf5ab2b916c5717992338316496de8b.tar.xz
kea-cabd3b127cf5ab2b916c5717992338316496de8b.zip
[trac893] added a new utility method, TSIGError::toRcode().
Diffstat (limited to 'src/lib/dns/tsigerror.cc')
-rw-r--r--src/lib/dns/tsigerror.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/dns/tsigerror.cc b/src/lib/dns/tsigerror.cc
index e63c9ab2dd..36ef47da10 100644
--- a/src/lib/dns/tsigerror.cc
+++ b/src/lib/dns/tsigerror.cc
@@ -49,6 +49,17 @@ TSIGError::toText() const {
}
}
+Rcode
+TSIGError::toRcode() const {
+ if (code_ <= MAX_RCODE_FOR_TSIGERROR) {
+ return (Rcode(code_));
+ }
+ if (code_ > BAD_TIME_CODE) {
+ return (Rcode::SERVFAIL());
+ }
+ return (Rcode::NOTAUTH());
+}
+
std::ostream&
operator<<(std::ostream& os, const TSIGError& error) {
return (os << error.toText());