pub struct TcpSegmentMut<'a> { /* private fields */ }Expand description
A mutable structurally validated TCP segment.
Implementations§
Source§impl TcpSegmentMut<'_>
impl TcpSegmentMut<'_>
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.
Sourcepub fn update_checksum_ipv4(
&mut self,
source: Ipv4Address,
destination: Ipv4Address,
) -> Result<(), TcpChecksumError>
pub fn update_checksum_ipv4( &mut self, source: Ipv4Address, destination: Ipv4Address, ) -> Result<(), TcpChecksumError>
Recomputes this TCP segment’s IPv4 pseudoheader checksum.
Source§impl TcpSegmentMut<'_>
impl TcpSegmentMut<'_>
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.
Sourcepub fn update_checksum_ipv6(
&mut self,
source: Ipv6Address,
destination: Ipv6Address,
) -> Result<(), TcpChecksumError>
pub fn update_checksum_ipv6( &mut self, source: Ipv6Address, destination: Ipv6Address, ) -> Result<(), TcpChecksumError>
Recomputes this TCP segment’s IPv6 pseudoheader checksum.
Source§impl<'a> TcpSegmentMut<'a>
impl<'a> TcpSegmentMut<'a>
Sourcepub fn parse(bytes: &'a mut [u8]) -> Result<Self, ParseError>
pub fn parse(bytes: &'a mut [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.
Sourcepub fn options_mut(&mut self) -> &mut [u8] ⓘ
pub fn options_mut(&mut self) -> &mut [u8] ⓘ
Returns mutable header options without updating the checksum.
Sourcepub fn payload_mut(&mut self) -> &mut [u8] ⓘ
pub fn payload_mut(&mut self) -> &mut [u8] ⓘ
Returns mutable payload bytes without updating the checksum.
Sourcepub fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
pub fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
Returns all represented segment bytes mutably without updating the checksum.
Sourcepub fn set_source_port(&mut self, value: u16)
pub fn set_source_port(&mut self, value: u16)
Replaces the source port without updating the checksum.
Sourcepub fn set_destination_port(&mut self, value: u16)
pub fn set_destination_port(&mut self, value: u16)
Replaces the destination port without updating the checksum.
Sourcepub fn set_sequence_number(&mut self, value: u32)
pub fn set_sequence_number(&mut self, value: u32)
Replaces the sequence number without updating the checksum.
Sourcepub fn set_acknowledgment_number(&mut self, value: u32)
pub fn set_acknowledgment_number(&mut self, value: u32)
Replaces the acknowledgment number without updating the checksum.
Sourcepub fn set_window_size(&mut self, value: u16)
pub fn set_window_size(&mut self, value: u16)
Replaces the window size without updating the checksum.
Sourcepub fn set_checksum(&mut self, value: u16)
pub fn set_checksum(&mut self, value: u16)
Replaces the checksum directly.
Sourcepub fn set_urgent_pointer(&mut self, value: u16)
pub fn set_urgent_pointer(&mut self, value: u16)
Replaces the urgent pointer without updating the checksum.