pub struct TcpSegment<'a> { /* private fields */ }Expand description
A structurally validated TCP segment.
Implementations§
Source§impl TcpSegment<'_>
impl TcpSegment<'_>
Sourcepub fn checksum_is_valid_ipv4(
&self,
source: Ipv4Address,
destination: Ipv4Address,
) -> Result<bool, TcpChecksumError>
pub fn checksum_is_valid_ipv4( &self, source: Ipv4Address, destination: Ipv4Address, ) -> Result<bool, TcpChecksumError>
Checks this TCP segment against its IPv4 pseudoheader.
Source§impl TcpSegment<'_>
impl TcpSegment<'_>
Sourcepub fn checksum_is_valid_ipv6(
&self,
source: Ipv6Address,
destination: Ipv6Address,
) -> Result<bool, TcpChecksumError>
pub fn checksum_is_valid_ipv6( &self, source: Ipv6Address, destination: Ipv6Address, ) -> Result<bool, TcpChecksumError>
Checks this TCP segment against its IPv6 pseudoheader.
Source§impl<'a> TcpSegment<'a>
impl<'a> TcpSegment<'a>
Sourcepub fn parse(bytes: &'a [u8]) -> Result<Self, ParseError>
pub fn parse(bytes: &'a [u8]) -> Result<Self, ParseError>
Parses a complete TCP segment without checking its checksum.
Sourcepub fn source_port(&self) -> u16
pub fn source_port(&self) -> u16
Returns the source port.
Sourcepub fn destination_port(&self) -> u16
pub fn destination_port(&self) -> u16
Returns the destination port.
Sourcepub fn sequence_number(&self) -> u32
pub fn sequence_number(&self) -> u32
Returns the sequence number.
Sourcepub fn acknowledgment_number(&self) -> u32
pub fn acknowledgment_number(&self) -> u32
Returns the acknowledgment number.
Sourcepub fn data_offset(&self) -> u8
pub fn data_offset(&self) -> u8
Returns the data offset in four-octet words.
Sourcepub fn header_length(&self) -> usize
pub fn header_length(&self) -> usize
Returns the header length in octets.
Sourcepub fn window_size(&self) -> u16
pub fn window_size(&self) -> u16
Returns the window size.
Sourcepub fn urgent_pointer(&self) -> u16
pub fn urgent_pointer(&self) -> u16
Returns the urgent pointer.
Trait Implementations§
Source§impl<'a> Clone for TcpSegment<'a>
impl<'a> Clone for TcpSegment<'a>
impl<'a> Copy for TcpSegment<'a>
Source§impl<'a> Debug for TcpSegment<'a>
impl<'a> Debug for TcpSegment<'a>
impl<'a> Eq for TcpSegment<'a>
Source§impl<'a> PartialEq for TcpSegment<'a>
impl<'a> PartialEq for TcpSegment<'a>
impl<'a> StructuralPartialEq for TcpSegment<'a>
Auto Trait Implementations§
impl<'a> Freeze for TcpSegment<'a>
impl<'a> RefUnwindSafe for TcpSegment<'a>
impl<'a> Send for TcpSegment<'a>
impl<'a> Sync for TcpSegment<'a>
impl<'a> Unpin for TcpSegment<'a>
impl<'a> UnsafeUnpin for TcpSegment<'a>
impl<'a> UnwindSafe for TcpSegment<'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