diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-05-16 16:36:42 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-05-16 16:36:42 +0200 |
commit | dfdd0489073d4b9616f9f769c397e4730860e31a (patch) | |
tree | 43d7e18ae966a07fd12a887c2f468805ff88b1d1 | |
parent | 90f6579dd8c6514b288cba4e56d4df487c940bd1 (diff) |
add VerType bit field struct
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/lib.rs | 3 | ||||
-rw-r--r-- | src/types.rs | 18 |
3 files changed, 22 insertions, 0 deletions
@@ -6,5 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +bitfield = "0.14.0" ppproperly_macros = { git = "https://github.com/rsdsl/ppproperly_macros.git", version = "0.1.0" } thiserror = "1.0" @@ -4,6 +4,9 @@ mod ser; pub mod error; pub use error::*; +pub mod types; +pub use types::*; + #[cfg(test)] mod tests { use super::{de::Deserialize, ser::Serialize, *}; diff --git a/src/types.rs b/src/types.rs new file mode 100644 index 0000000..6265ea6 --- /dev/null +++ b/src/types.rs @@ -0,0 +1,18 @@ +use bitfield::bitfield; + +bitfield! { + /// Version and type of a PPPoE header combined in a single octet. + pub struct VerType(u8); + impl Debug; + + u8; + + pub ver, set_ver: 7, 4; + pub ty, set_ty: 3, 0; +} + +impl Default for VerType { + fn default() -> Self { + Self(0x11) + } +} |