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.