Struct etherparse::TcpHeaderSlice [−][src]
pub struct TcpHeaderSlice<'a> { /* fields omitted */ }
A slice containing an tcp header of a network package.
Methods
impl<'a> TcpHeaderSlice<'a>
[src]
impl<'a> TcpHeaderSlice<'a>
pub fn from_slice(slice: &'a [u8]) -> Result<TcpHeaderSlice<'a>, ReadError>
[src]
pub fn from_slice(slice: &'a [u8]) -> Result<TcpHeaderSlice<'a>, ReadError>
Creates a slice containing an tcp header.
pub fn slice(&self) -> &'a [u8]
[src]
pub fn slice(&self) -> &'a [u8]
Returns the slice containing the tcp header
pub fn source_port(&self) -> u16
[src]
pub fn source_port(&self) -> u16
Read the destination port number.
pub fn destination_port(&self) -> u16
[src]
pub fn destination_port(&self) -> u16
Read the destination port number.
pub fn sequence_number(&self) -> u32
[src]
pub fn sequence_number(&self) -> u32
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]
pub fn acknowledgment_number(&self) -> u32
[src]
pub fn acknowledgment_number(&self) -> u32
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.
pub fn data_offset(&self) -> u8
[src]
pub fn data_offset(&self) -> u8
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.
pub fn ns(&self) -> bool
[src]
pub fn ns(&self) -> bool
ECN-nonce - concealment protection (experimental: see RFC 3540)
pub fn fin(&self) -> bool
[src]
pub fn fin(&self) -> bool
Read the fin flag (no more data from sender).
pub fn syn(&self) -> bool
[src]
pub fn syn(&self) -> bool
Reads the syn flag (synchronize sequence numbers).
pub fn rst(&self) -> bool
[src]
pub fn rst(&self) -> bool
Reads the rst flag (reset the connection).
pub fn psh(&self) -> bool
[src]
pub fn psh(&self) -> bool
Reads the psh flag (push function).
pub fn ack(&self) -> bool
[src]
pub fn ack(&self) -> bool
Reads the ack flag (acknowledgment field significant).
pub fn urg(&self) -> bool
[src]
pub fn urg(&self) -> bool
Reads the urg flag (Urgent Pointer field significant).
pub fn ece(&self) -> bool
[src]
pub fn ece(&self) -> bool
Read the ECN-Echo flag (RFC 3168).
pub fn cwr(&self) -> bool
[src]
pub fn cwr(&self) -> bool
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).
pub fn window_size(&self) -> u16
[src]
pub fn window_size(&self) -> u16
The number of data octets beginning with the one indicated in the acknowledgment field which the sender of this segment is willing to accept.
pub fn checksum(&self) -> u16
[src]
pub fn checksum(&self) -> u16
Checksum (16 bit one's complement) of the pseudo ip header, this tcp header and the payload.
pub fn urgent_pointer(&self) -> u16
[src]
pub fn urgent_pointer(&self) -> u16
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.
pub fn options(&self) -> &[u8]
[src]
pub fn options(&self) -> &[u8]
Options of the header
ⓘImportant traits for TcpOptionsIterator<'a>pub fn options_iterator<'b>(&'b self) -> TcpOptionsIterator<'b>
[src]
pub fn options_iterator<'b>(&'b self) -> TcpOptionsIterator<'b>
Returns an iterator that allows to iterate through all known TCP header options.
pub fn to_header(&self) -> TcpHeader
[src]
pub fn to_header(&self) -> TcpHeader
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>
[src]
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.
pub fn calc_checksum_ipv4_raw(
&self,
source_ip: &[u8],
destination_ip: &[u8],
payload: &[u8]
) -> Result<u16, ValueError>
[src]
pub fn calc_checksum_ipv4_raw(
&self,
source_ip: &[u8],
destination_ip: &[u8],
payload: &[u8]
) -> Result<u16, ValueError>
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>
[src]
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..
pub fn calc_checksum_ipv6_raw(
&self,
source: &[u8],
destination: &[u8],
payload: &[u8]
) -> Result<u16, ValueError>
[src]
pub fn calc_checksum_ipv6_raw(
&self,
source: &[u8],
destination: &[u8],
payload: &[u8]
) -> Result<u16, ValueError>
Calculates the checksum for the current header in ipv6 mode and returns the result. This does NOT set the checksum.
Trait Implementations
impl<'a> Clone for TcpHeaderSlice<'a>
[src]
impl<'a> Clone for TcpHeaderSlice<'a>
fn clone(&self) -> TcpHeaderSlice<'a>
[src]
fn clone(&self) -> TcpHeaderSlice<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a> Debug for TcpHeaderSlice<'a>
[src]
impl<'a> Debug for TcpHeaderSlice<'a>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a> Eq for TcpHeaderSlice<'a>
[src]
impl<'a> Eq for TcpHeaderSlice<'a>
impl<'a> PartialEq for TcpHeaderSlice<'a>
[src]
impl<'a> PartialEq for TcpHeaderSlice<'a>
fn eq(&self, other: &TcpHeaderSlice<'a>) -> bool
[src]
fn eq(&self, other: &TcpHeaderSlice<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &TcpHeaderSlice<'a>) -> bool
[src]
fn ne(&self, other: &TcpHeaderSlice<'a>) -> bool
This method tests for !=
.
Auto Trait Implementations
impl<'a> Send for TcpHeaderSlice<'a>
impl<'a> Send for TcpHeaderSlice<'a>
impl<'a> Sync for TcpHeaderSlice<'a>
impl<'a> Sync for TcpHeaderSlice<'a>