aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-05-16 16:36:42 +0200
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-05-16 16:36:42 +0200
commitdfdd0489073d4b9616f9f769c397e4730860e31a (patch)
tree43d7e18ae966a07fd12a887c2f468805ff88b1d1
parent90f6579dd8c6514b288cba4e56d4df487c940bd1 (diff)
add VerType bit field struct
-rw-r--r--Cargo.toml1
-rw-r--r--src/lib.rs3
-rw-r--r--src/types.rs18
3 files changed, 22 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 6c4eadb..0c94b6d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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"
diff --git a/src/lib.rs b/src/lib.rs
index 53b764a..64efe58 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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)
+ }
+}