Struct etherparse::TcpHeaderSlice [−][src]
pub struct TcpHeaderSlice<'a> { /* fields omitted */ }
Expand description
A slice containing an tcp header of a network package.
Implementations
Creates a slice containing an tcp header.
Returns the slice containing the tcp header
Read the destination port number.
Read the destination port number.
Read the sequence number of the first data octet in this segment (except when SYN is present).
If SYN is present the sequence number is the initial sequence number (ISN) and the first data octet is ISN+1. [copied from RFC 793, page 16]
Reads the acknowledgment number.
If the ACK control bit is set this field contains the value of the next sequence number the sender of the segment is expecting to receive.
Once a connection is established this is always sent.
Read the number of 32 bit words in the TCP Header.
This indicates where the data begins. The TCP header (even one including options) is an integral number of 32 bits long.
Reads the cwr flag (Congestion Window Reduced).
This flag is set by the sending host to indicate that it received a TCP segment with the ECE flag set and had responded in congestion control mechanism (added to header by RFC 3168).
The number of data octets beginning with the one indicated in the acknowledgment field which the sender of this segment is willing to accept.
Checksum (16 bit one’s complement) of the pseudo ip header, this tcp header and the payload.
This field communicates the current value of the urgent pointer as a positive offset from the sequence number in this segment.
The urgent pointer points to the sequence number of the octet following the urgent data. This field is only be interpreted in segments with the URG control bit set.
Options of the header
pub fn options_iterator(&self) -> TcpOptionsIterator<'_>ⓘNotable traits for TcpOptionsIterator<'a>impl<'a> Iterator for TcpOptionsIterator<'a> type Item = Result<TcpOptionElement, TcpOptionReadError>;
pub fn options_iterator(&self) -> TcpOptionsIterator<'_>ⓘNotable traits for TcpOptionsIterator<'a>impl<'a> Iterator for TcpOptionsIterator<'a> type Item = Result<TcpOptionElement, TcpOptionReadError>;
impl<'a> Iterator for TcpOptionsIterator<'a> type Item = Result<TcpOptionElement, TcpOptionReadError>;
Returns an iterator that allows to iterate through all known TCP header options.
Decode all the fields and copy the results to a TcpHeader struct
pub fn calc_checksum_ipv4(
&self,
ip_header: &Ipv4HeaderSlice<'_>,
payload: &[u8]
) -> Result<u16, ValueError>
pub fn calc_checksum_ipv4(
&self,
ip_header: &Ipv4HeaderSlice<'_>,
payload: &[u8]
) -> Result<u16, ValueError>
Calculates the upd header checksum based on a ipv4 header and returns the result. This does NOT set the checksum.
Calculates the checksum for the current header in ipv4 mode and returns the result. This does NOT set the checksum.
pub fn calc_checksum_ipv6(
&self,
ip_header: &Ipv6HeaderSlice<'_>,
payload: &[u8]
) -> Result<u16, ValueError>
pub fn calc_checksum_ipv6(
&self,
ip_header: &Ipv6HeaderSlice<'_>,
payload: &[u8]
) -> Result<u16, ValueError>
Calculates the upd header checksum based on a ipv6 header and returns the result. This does NOT set the checksum..
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<'a> RefUnwindSafe for TcpHeaderSlice<'a>
impl<'a> Send for TcpHeaderSlice<'a>
impl<'a> Sync for TcpHeaderSlice<'a>
impl<'a> Unpin for TcpHeaderSlice<'a>
impl<'a> UnwindSafe for TcpHeaderSlice<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more