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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
use std::fmt;
#[derive(Debug, FromPrimitive)]
pub enum RCode {
NoError,
FormErr,
ServFail,
NXDomain,
NotImp,
Refused,
YXDomain,
YXRRSet,
NXRRSet,
NotAuth,
NotZone,
DSOTYPENI,
Unassigned12,
Unassigned13,
Unassigned14,
Unassigned15,
BADVERS,
BADKEY,
BADTIME,
BADMODE,
BADNAME,
BADALG,
BADTRUNC,
BADCOOKIE,
Unknown,
}
impl fmt::Display for RCode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
RCode::NoError => write!(f, "No Error"),
RCode::FormErr => write!(f, "Format Error"),
RCode::ServFail => write!(f, "Server Failure"),
RCode::NXDomain => write!(f, "Non-Existent Domain"),
RCode::NotImp => write!(f, "Not Implemented"),
RCode::Refused => write!(f, "Query Refused"),
RCode::YXDomain => write!(f, "Name Exists when it should not"),
RCode::YXRRSet => write!(f, "RR Set Exists when it should not"),
RCode::NXRRSet => write!(f, "RR Set that should exist does not"),
RCode::NotAuth => write!(f, "Server Not Authoritative for zone"),
RCode::NotZone => write!(f, "Name not contained in zone"),
RCode::DSOTYPENI => write!(f, "DSO-TYPE Not Implemented"),
RCode::Unassigned12
| RCode::Unassigned13
| RCode::Unassigned14
| RCode::Unassigned15 => write!(f, "Unassigned"),
RCode::BADVERS => write!(f, "Bad OPT Version"),
RCode::BADKEY => write!(f, "Key not recognized"),
RCode::BADTIME => write!(f, "Signature out of time window"),
RCode::BADMODE => write!(f, "Bad TKEY Mode"),
RCode::BADNAME => write!(f, "Duplicate key name"),
RCode::BADALG => write!(f, "Algorithm not supported"),
RCode::BADTRUNC => write!(f, "Bad Truncation"),
RCode::BADCOOKIE => write!(f, "Bad/missing Server Cookie"),
RCode::Unknown => write!(f, "Unknown"),
}
}
}