pub struct TcpRepr<'a> {
pub src_port: u16,
pub dst_port: u16,
pub control: Control,
pub seq_number: SeqNumber,
pub ack_number: Option<SeqNumber>,
pub window_len: u16,
pub window_scale: Option<u8>,
pub max_seg_size: Option<u16>,
pub sack_permitted: bool,
pub sack_ranges: [Option<(u32, u32)>; 3],
pub payload: &'a [u8],
}
Expand description
A high-level representation of a Transmission Control Protocol packet.
Fields§
§src_port: u16
§dst_port: u16
§control: Control
§seq_number: SeqNumber
§ack_number: Option<SeqNumber>
§window_len: u16
§window_scale: Option<u8>
§max_seg_size: Option<u16>
§sack_permitted: bool
§sack_ranges: [Option<(u32, u32)>; 3]
§payload: &'a [u8]
Implementations§
Source§impl<'a> Repr<'a>
impl<'a> Repr<'a>
Sourcepub fn parse<T>(
packet: &Packet<&'a T>,
src_addr: &IpAddress,
dst_addr: &IpAddress,
checksum_caps: &ChecksumCapabilities,
) -> Result<Repr<'a>>
pub fn parse<T>( packet: &Packet<&'a T>, src_addr: &IpAddress, dst_addr: &IpAddress, checksum_caps: &ChecksumCapabilities, ) -> Result<Repr<'a>>
Parse a Transmission Control Protocol packet and return a high-level representation.
Sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Return the length of a header that will be emitted from this high-level representation.
This should be used for buffer space calculations. The TCP header length is a multiple of 4.
Sourcepub fn buffer_len(&self) -> usize
pub fn buffer_len(&self) -> usize
Return the length of a packet that will be emitted from this high-level representation.
Sourcepub fn emit<T>(
&self,
packet: &mut Packet<&mut T>,
src_addr: &IpAddress,
dst_addr: &IpAddress,
checksum_caps: &ChecksumCapabilities,
)
pub fn emit<T>( &self, packet: &mut Packet<&mut T>, src_addr: &IpAddress, dst_addr: &IpAddress, checksum_caps: &ChecksumCapabilities, )
Emit a high-level representation into a Transmission Control Protocol packet.
Sourcepub const fn segment_len(&self) -> usize
pub const fn segment_len(&self) -> usize
Return the length of the segment, in terms of sequence space.
Trait Implementations§
impl<'a> Copy for Repr<'a>
impl<'a> Eq for Repr<'a>
impl<'a> StructuralPartialEq for Repr<'a>
Auto Trait Implementations§
impl<'a> Freeze for Repr<'a>
impl<'a> RefUnwindSafe for Repr<'a>
impl<'a> Send for Repr<'a>
impl<'a> Sync for Repr<'a>
impl<'a> Unpin for Repr<'a>
impl<'a> UnwindSafe for Repr<'a>
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