summaryrefslogtreecommitdiff
path: root/src/dns/packet/result.rs
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2023-03-06 18:50:08 -0500
committerTyler Murphy <tylermurphy534@gmail.com>2023-03-06 18:50:08 -0500
commitb1fb410affb7bcd2e714abac01d22c4a5332c344 (patch)
tree7ebb621ab9b73e3e1fbaeb0ef8c19abef95b7c9f /src/dns/packet/result.rs
parentfinialize initial dns + caching (diff)
downloadwrapper-b1fb410affb7bcd2e714abac01d22c4a5332c344.tar.gz
wrapper-b1fb410affb7bcd2e714abac01d22c4a5332c344.tar.bz2
wrapper-b1fb410affb7bcd2e714abac01d22c4a5332c344.zip
finish dns and start webserver
Diffstat (limited to 'src/dns/packet/result.rs')
-rw-r--r--src/dns/packet/result.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/dns/packet/result.rs b/src/dns/packet/result.rs
new file mode 100644
index 0000000..41c8ba9
--- /dev/null
+++ b/src/dns/packet/result.rs
@@ -0,0 +1,22 @@
+#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+pub enum ResultCode {
+ NOERROR = 0,
+ FORMERR = 1,
+ SERVFAIL = 2,
+ NXDOMAIN = 3,
+ NOTIMP = 4,
+ REFUSED = 5,
+}
+
+impl ResultCode {
+ pub fn from_num(num: u8) -> Self {
+ match num {
+ 1 => Self::FORMERR,
+ 2 => Self::SERVFAIL,
+ 3 => Self::NXDOMAIN,
+ 4 => Self::NOTIMP,
+ 5 => Self::REFUSED,
+ 0 | _ => Self::NOERROR,
+ }
+ }
+}