pub struct PacketHeader {
pub length: u64,
pub packet_hash: [u8; 16],
pub recovery_set_id: RecoverySetId,
pub packet_type: PacketType,
}Expand description
Parsed 64-byte packet header.
Fields§
§length: u64Total packet length (header + body), always >= 64 and multiple of 4.
packet_hash: [u8; 16]MD5 of bytes 32..length (recovery_set_id + type + body).
recovery_set_id: RecoverySetIdRecovery set this packet belongs to.
packet_type: PacketTypeThe packet type.
Implementations§
Source§impl PacketHeader
impl PacketHeader
Sourcepub fn parse(data: &[u8], offset: u64) -> Result<Self>
pub fn parse(data: &[u8], offset: u64) -> Result<Self>
Parse a 64-byte header from raw bytes.
offset is used only for error reporting (position in file/stream).
This does NOT validate the packet hash (needs the full packet body).
Sourcepub fn validate_hash(&self, full_packet: &[u8], offset: u64) -> Result<()>
pub fn validate_hash(&self, full_packet: &[u8], offset: u64) -> Result<()>
Validate the packet hash against the full packet data (bytes 0..length).
The hash covers bytes 32..length (recovery_set_id + type + body).
Sourcepub fn body_length(&self) -> u64
pub fn body_length(&self) -> u64
Size of the packet body (everything after the 64-byte header).
Trait Implementations§
Source§impl Clone for PacketHeader
impl Clone for PacketHeader
Source§fn clone(&self) -> PacketHeader
fn clone(&self) -> PacketHeader
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PacketHeader
impl RefUnwindSafe for PacketHeader
impl Send for PacketHeader
impl Sync for PacketHeader
impl Unpin for PacketHeader
impl UnsafeUnpin for PacketHeader
impl UnwindSafe for PacketHeader
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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