summaryrefslogtreecommitdiff
path: root/src/common/shibari_util_rcode_str.c
blob: 142cc0e25928ffa3ca21893c2858f913b3b9fdaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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" ;
}