From 63cebcd47b6a618af997d87a8ccaf5fa1e3f4694 Mon Sep 17 00:00:00 2001 From: Lee Smet Date: Wed, 27 Sep 2023 15:13:30 +0200 Subject: [PATCH] Add missing constants Signed-off-by: Lee Smet --- src/data.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/data.rs b/src/data.rs index 0b7da4a..52cdba7 100644 --- a/src/data.rs +++ b/src/data.rs @@ -1,6 +1,5 @@ use std::{marker::PhantomData, net::Ipv6Addr}; -use etherparse::IpHeader; use futures::{Sink, SinkExt, Stream, StreamExt}; use log::{debug, error, trace, warn}; use tokio::sync::mpsc::UnboundedReceiver; @@ -13,6 +12,16 @@ const USER_DATA_VERSION: u8 = 1; /// Type value indicating L3 data in the user data header. const USER_DATA_L3_TYPE: u8 = 0; +/// Minimum size in bytes of an IPv6 header. +const IPV6_MIN_HEADER_SIZE: usize = 40; + +/// Mask applied to the first byte of an IP header to extract the version. +const IP_VERSION_MASK: u8 = 0b1111_0000; + +/// Version byte of an IP header indicating IPv6. Since the version is only 4 bits, the lower bits +/// must be masked first. +const IPV6_VERSION_BYTE: u8 = 0b0110_0000; + /// The DataPlane manages forwarding/receiving of local data packets to the [`Router`], and the /// encryption/decryption of them. #[derive(Clone)]