diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2023-03-01 01:13:25 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2023-03-01 01:13:25 -0500 |
commit | b7676d06363f71b4a856c5f5815f75e2bf7ca8ec (patch) | |
tree | b7e188aa4e1abaa69b1b9ee4fb6cd5a0ad60637d /packet/src/result.rs | |
parent | gpl (diff) | |
download | wrapper-b7676d06363f71b4a856c5f5815f75e2bf7ca8ec.tar.gz wrapper-b7676d06363f71b4a856c5f5815f75e2bf7ca8ec.tar.bz2 wrapper-b7676d06363f71b4a856c5f5815f75e2bf7ca8ec.zip |
inital working dns
Diffstat (limited to 'packet/src/result.rs')
-rw-r--r-- | packet/src/result.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/packet/src/result.rs b/packet/src/result.rs new file mode 100644 index 0000000..66108b8 --- /dev/null +++ b/packet/src/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) -> ResultCode { + match num { + 1 => ResultCode::FORMERR, + 2 => ResultCode::SERVFAIL, + 3 => ResultCode::NXDOMAIN, + 4 => ResultCode::NOTIMP, + 5 => ResultCode::REFUSED, + 0 | _ => ResultCode::NOERROR, + } + } +}
\ No newline at end of file |