summaryrefslogtreecommitdiff
path: root/src/common/shibari_util_rcode_str.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-12-10 11:48:01 +0000
committerLaurent Bercot <ska@appnovation.com>2023-12-10 11:48:01 +0000
commitb8d0f83e6cea9640a7ee4402c163ad812237355d (patch)
tree57a64ac8aa0e98c40db8c36e96e7379490e44dbf /src/common/shibari_util_rcode_str.c
downloadshibari-b8d0f83e6cea9640a7ee4402c163ad812237355d.tar.xz
Initial commit
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/common/shibari_util_rcode_str.c')
-rw-r--r--src/common/shibari_util_rcode_str.c41
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" ;
+}