[][src]Struct etherparse::TcpHeaderSlice

pub struct TcpHeaderSlice<'a> { /* fields omitted */ }

A slice containing an tcp header of a network package.

Methods

impl<'a> TcpHeaderSlice<'a>[src]

pub fn from_slice(slice: &'a [u8]) -> Result<TcpHeaderSlice<'a>, ReadError>[src]

Creates a slice containing an tcp header.

pub fn slice(&self) -> &'a [u8][src]

Returns the slice containing the tcp header

pub fn source_port(&self) -> u16[src]

Read the destination port number.

pub fn destination_port(&self) -> u16[src]

Read the destination port number.

pub fn sequence_number(&self) -> u32[src]

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]

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]

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]

ECN-nonce - concealment protection (experimental: see RFC 3540)

pub fn fin(&self) -> bool[src]

Read the fin flag (no more data from sender).

pub fn syn(&self) -> bool[src]

Reads the syn flag (synchronize sequence numbers).

pub fn rst(&self) -> bool[src]

Reads the rst flag (reset the connection).

pub fn psh(&self) -> bool[src]

Reads the psh flag (push function).

pub fn ack(&self) -> bool[src]

Reads the ack flag (acknowledgment field significant).

pub fn urg(&self) -> bool[src]

Reads the urg flag (Urgent Pointer field significant).

pub fn ece(&self) -> bool[src]

Read the ECN-Echo flag (RFC 3168).

pub fn cwr(&self) -> bool[src]

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]

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]

Checksum (16 bit one's complement) of the pseudo ip header, this tcp header and the payload.

pub fn urgent_pointer(&self) -> u16[src]

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]

Options of the header

Important traits for TcpOptionsIterator<'a>
pub fn options_iterator(&self) -> TcpOptionsIterator[src]

Returns an iterator that allows to iterate through all known TCP header options.

pub fn to_header(&self) -> TcpHeader[src]

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]

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]

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]

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]

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> Eq for TcpHeaderSlice<'a>[src]

impl<'a> PartialEq<TcpHeaderSlice<'a>> for TcpHeaderSlice<'a>[src]

impl<'a> Debug for TcpHeaderSlice<'a>[src]

impl<'a> StructuralPartialEq for TcpHeaderSlice<'a>[src]

impl<'a> StructuralEq for TcpHeaderSlice<'a>[src]

Auto Trait Implementations

impl<'a> Send for TcpHeaderSlice<'a>

impl<'a> Sync for TcpHeaderSlice<'a>

impl<'a> Unpin for TcpHeaderSlice<'a>

impl<'a> UnwindSafe for TcpHeaderSlice<'a>

impl<'a> RefUnwindSafe for TcpHeaderSlice<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]