diff options
Diffstat (limited to 'src/common/shibari_util_rcode_str.c')
| -rw-r--r-- | src/common/shibari_util_rcode_str.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/common/shibari_util_rcode_str.c b/src/common/shibari_util_rcode_str.c new file mode 100644 index 0000000..142cc0e --- /dev/null +++ b/src/common/shibari_util_rcode_str.c @@ -0,0 +1,41 @@ +/* ISC license. */ + +#include <stdint.h> + +#include <shibari/util.h> + +char const *shibari_util_rcode_str (uint16_t rcode) +{ + static char const *const rcode_table[24] = + { + "noerror", + "formerr", + "servfail", + "nxdomain", + "notimp", + "refused", + "yxdomain", + "yxrrset", + "nxrrset", + "notauth", + "notzone", + "dsotypeni", + "unassigned", + "unassigned", + "unassigned", + "unassigned", + "badsig", + "badkey", + "badtime", + "badmode", + "badname", + "badalg", + "badtrunc", + "badcookie" + } ; + if (rcode < 24) return rcode_table[rcode] ; + if (rcode < 3841) return "unassigned" ; + if (rcode < 4096) return "private" ; + if (rcode < 65535) return "unassigned" ; + return "reserved" ; +} |
