pub struct QuicLayer {
pub index: LayerIndex,
}Expand description
QUIC protocol layer — a lightweight view into a raw packet buffer.
Follows the same “Lazy Zero-Copy View” pattern as all other layers in stackforge-core: no field values are copied at parse time; they are read directly from the buffer when accessed.
Fields§
§index: LayerIndexImplementations§
Source§impl QuicLayer
impl QuicLayer
Sourcepub fn from_index(index: LayerIndex) -> Self
pub fn from_index(index: LayerIndex) -> Self
Create a QuicLayer from an existing LayerIndex.
Sourcepub fn is_long_header(&self, buf: &[u8]) -> bool
pub fn is_long_header(&self, buf: &[u8]) -> bool
Returns true if bit 7 of the first byte is set (long header).
Sourcepub fn packet_type(&self, buf: &[u8]) -> Option<QuicPacketType>
pub fn packet_type(&self, buf: &[u8]) -> Option<QuicPacketType>
Returns the logical packet type, or None if the buffer is too short.
Sourcepub fn version(&self, buf: &[u8]) -> Option<u32>
pub fn version(&self, buf: &[u8]) -> Option<u32>
Returns the QUIC version (bytes 1-4) for long-header packets, or None
if this is a short-header packet or the buffer is too short.
Sourcepub fn header_len(&self, buf: &[u8]) -> usize
pub fn header_len(&self, buf: &[u8]) -> usize
Returns the header length in bytes.
For long headers this parses the connection-ID lengths to compute the actual header size. For short headers (where the connection-ID length is negotiated out-of-band) we return 1 as a safe minimum.
Sourcepub fn field_names() -> &'static [&'static str]
pub fn field_names() -> &'static [&'static str]
Returns the static field names exposed by this layer.
Sourcepub fn get_field(
&self,
buf: &[u8],
name: &str,
) -> Option<Result<FieldValue, FieldError>>
pub fn get_field( &self, buf: &[u8], name: &str, ) -> Option<Result<FieldValue, FieldError>>
Read a field value by name from the underlying buffer.
Sourcepub fn set_field(
&self,
buf: &mut [u8],
name: &str,
value: FieldValue,
) -> Option<Result<(), FieldError>>
pub fn set_field( &self, buf: &mut [u8], name: &str, value: FieldValue, ) -> Option<Result<(), FieldError>>
Write a field value by name into the underlying (mutable) buffer.
Trait Implementations§
Source§impl Layer for QuicLayer
impl Layer for QuicLayer
Source§fn header_len(&self, data: &[u8]) -> usize
fn header_len(&self, data: &[u8]) -> usize
Source§fn field_names(&self) -> &'static [&'static str]
fn field_names(&self) -> &'static [&'static str]
Source§impl LayerDispatch for QuicLayer
impl LayerDispatch for QuicLayer
Source§fn dispatch_kind(&self) -> LayerKind
fn dispatch_kind(&self) -> LayerKind
Source§fn dispatch_index(&self) -> &LayerIndex
fn dispatch_index(&self) -> &LayerIndex
Source§fn dispatch_summary(&self, buf: &[u8]) -> String
fn dispatch_summary(&self, buf: &[u8]) -> String
Source§fn dispatch_header_len(&self, buf: &[u8]) -> usize
fn dispatch_header_len(&self, buf: &[u8]) -> usize
Source§fn dispatch_field_names(&self) -> &'static [&'static str]
fn dispatch_field_names(&self) -> &'static [&'static str]
Source§fn dispatch_get_field(
&self,
buf: &[u8],
name: &str,
) -> Option<Result<FieldValue, FieldError>>
fn dispatch_get_field( &self, buf: &[u8], name: &str, ) -> Option<Result<FieldValue, FieldError>>
Source§fn dispatch_set_field(
&self,
buf: &mut [u8],
name: &str,
value: FieldValue,
) -> Option<Result<(), FieldError>>
fn dispatch_set_field( &self, buf: &mut [u8], name: &str, value: FieldValue, ) -> Option<Result<(), FieldError>>
Auto Trait Implementations§
impl Freeze for QuicLayer
impl RefUnwindSafe for QuicLayer
impl Send for QuicLayer
impl Sync for QuicLayer
impl Unpin for QuicLayer
impl UnsafeUnpin for QuicLayer
impl UnwindSafe for QuicLayer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more