Skip to content

Commit

Permalink
Add new RCODES
Browse files Browse the repository at this point in the history
  • Loading branch information
Litr0 committed Jul 25, 2024
1 parent 2f59b36 commit e363f8a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/message/rcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ pub enum Rcode {
NXDOMAIN,
NOTIMP,
REFUSED,
BADSIG,
BADKEY,
BADTIME,
UNKNOWN(u8),
}

Expand All @@ -23,6 +26,9 @@ impl From<u8> for Rcode {
3 => Rcode::NXDOMAIN,
4 => Rcode::NOTIMP,
5 => Rcode::REFUSED,
16 => Rcode::BADSIG,
17 => Rcode::BADKEY,
18 => Rcode::BADTIME,
_ => Rcode::UNKNOWN(int),
}
}
Expand All @@ -37,6 +43,9 @@ impl From<Rcode> for u8 {
Rcode::NXDOMAIN => 3,
Rcode::NOTIMP => 4,
Rcode::REFUSED => 5,
Rcode::BADSIG => 16,
Rcode::BADKEY => 17,
Rcode::BADTIME => 18,
Rcode::UNKNOWN(u8) => u8,
}
}
Expand Down Expand Up @@ -69,6 +78,9 @@ impl fmt::Display for Rcode {
Rcode::NXDOMAIN => "NXDOMAIN",
Rcode::NOTIMP => "NOTIMP",
Rcode::REFUSED => "REFUSED",
Rcode::BADSIG => "BADSIG",
Rcode::BADKEY => "BADKEY",
Rcode::BADTIME => "BADTIME",
Rcode::UNKNOWN(_) => "UNKNOWN",
})
}
Expand Down

0 comments on commit e363f8a

Please sign in to comment.