Skip to main content

TcpSegmentMut

Struct TcpSegmentMut 

Source
pub struct TcpSegmentMut<'a> { /* private fields */ }
Expand description

A mutable structurally validated TCP segment.

Implementations§

Source§

impl TcpSegmentMut<'_>

Source

pub fn checksum_is_valid_ipv4( &self, source: Ipv4Address, destination: Ipv4Address, ) -> Result<bool, TcpChecksumError>

Checks this TCP segment against its IPv4 pseudoheader.

Source

pub fn update_checksum_ipv4( &mut self, source: Ipv4Address, destination: Ipv4Address, ) -> Result<(), TcpChecksumError>

Recomputes this TCP segment’s IPv4 pseudoheader checksum.

Source§

impl TcpSegmentMut<'_>

Source

pub fn checksum_is_valid_ipv6( &self, source: Ipv6Address, destination: Ipv6Address, ) -> Result<bool, TcpChecksumError>

Checks this TCP segment against its IPv6 pseudoheader.

Source

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>

Source

pub fn parse(bytes: &'a mut [u8]) -> Result<Self, ParseError>

Parses a complete TCP segment without checking its checksum.

Source

pub fn source_port(&self) -> u16

Returns the source port.

Source

pub fn destination_port(&self) -> u16

Returns the destination port.

Source

pub fn sequence_number(&self) -> u32

Returns the sequence number.

Source

pub fn acknowledgment_number(&self) -> u32

Returns the acknowledgment number.

Source

pub fn data_offset(&self) -> u8

Returns the data offset in four-octet words.

Source

pub fn header_length(&self) -> usize

Returns the header length in octets.

Source

pub fn reserved(&self) -> u8

Returns the four reserved header bits.

Source

pub fn flags(&self) -> TcpFlags

Returns TCP control flags with their raw wire value preserved.

Source

pub fn window_size(&self) -> u16

Returns the window size.

Source

pub fn checksum(&self) -> u16

Returns the encoded checksum.

Source

pub fn urgent_pointer(&self) -> u16

Returns the urgent pointer.

Source

pub fn options(&self) -> &[u8]

Returns header options.

Source

pub fn options_mut(&mut self) -> &mut [u8] ⓘ

Returns mutable header options without updating the checksum.

Source

pub fn payload(&self) -> &[u8]

Returns payload bytes.

Source

pub fn payload_mut(&mut self) -> &mut [u8] ⓘ

Returns mutable payload bytes without updating the checksum.

Source

pub fn as_bytes(&self) -> &[u8]

Returns all represented segment bytes.

Source

pub fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ

Returns all represented segment bytes mutably without updating the checksum.

Source

pub fn set_source_port(&mut self, value: u16)

Replaces the source port without updating the checksum.

Source

pub fn set_destination_port(&mut self, value: u16)

Replaces the destination port without updating the checksum.

Source

pub fn set_sequence_number(&mut self, value: u32)

Replaces the sequence number without updating the checksum.

Source

pub fn set_acknowledgment_number(&mut self, value: u32)

Replaces the acknowledgment number without updating the checksum.

Source

pub fn set_flags(&mut self, value: TcpFlags)

Replaces flags without updating the checksum.

Source

pub fn set_window_size(&mut self, value: u16)

Replaces the window size without updating the checksum.

Source

pub fn set_checksum(&mut self, value: u16)

Replaces the checksum directly.

Source

pub fn set_urgent_pointer(&mut self, value: u16)

Replaces the urgent pointer without updating the checksum.

Trait Implementations§

Source§

impl<'a> Debug for TcpSegmentMut<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Eq for TcpSegmentMut<'a>

Source§

impl<'a> PartialEq for TcpSegmentMut<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for TcpSegmentMut<'a>

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for TcpSegmentMut<'a>

§

impl<'a> Freeze for TcpSegmentMut<'a>

§

impl<'a> RefUnwindSafe for TcpSegmentMut<'a>

§

impl<'a> Send for TcpSegmentMut<'a>

§

impl<'a> Sync for TcpSegmentMut<'a>

§

impl<'a> Unpin for TcpSegmentMut<'a>

§

impl<'a> UnsafeUnpin for TcpSegmentMut<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.