diff options
Diffstat (limited to 'contrib/librdns/util.c')
-rw-r--r-- | contrib/librdns/util.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/librdns/util.c b/contrib/librdns/util.c index 1eb5410c3..0f701f1bd 100644 --- a/contrib/librdns/util.c +++ b/contrib/librdns/util.c @@ -289,6 +289,51 @@ rdns_type_fromstr (const char *str) return -1; } +enum dns_rcode +rdns_rcode_fromstr (const char *str) +{ + if (str) { + if (strcmp (str, "noerror") == 0) { + return RDNS_RC_NOERROR; + } + else if (strcmp (str, "formerr") == 0) { + return RDNS_RC_FORMERR; + } + else if (strcmp (str, "servfail") == 0) { + return RDNS_RC_SERVFAIL; + } + else if (strcmp (str, "notimp") == 0) { + return RDNS_RC_NOTIMP; + } + else if (strcmp (str, "yxdomain") == 0) { + return RDNS_RC_YXDOMAIN; + } + else if (strcmp (str, "yxrrset") == 0) { + return RDNS_RC_YXRRSET; + } + else if (strcmp (str, "nxrrset") == 0) { + return RDNS_RC_NXRRSET; + } + else if (strcmp (str, "notauth") == 0) { + return RDNS_RC_NOTAUTH; + } + else if (strcmp (str, "notzone") == 0) { + return RDNS_RC_NOTZONE; + } + else if (strcmp (str, "timeout") == 0) { + return RDNS_RC_TIMEOUT; + } + else if (strcmp (str, "neterr") == 0) { + return RDNS_RC_NETERR; + } + else if (strcmp (str, "norec") == 0) { + return RDNS_RC_NOREC; + } + } + + return -1; +} + uint16_t rdns_permutor_generate_id (void) { |