[][src]Enum etherparse::TransportHeader

pub enum TransportHeader {
    Udp(UdpHeader),
    Tcp(TcpHeader),
}

The possible headers on the transport layer

Variants

Methods

impl TransportHeader[src]

pub fn udp(self) -> Option<UdpHeader>[src]

Returns Result::Some containing the udp header if self has the value Udp. Otherwise None is returned.

pub fn mut_udp(&mut self) -> Option<&mut UdpHeader>[src]

Returns Result::Some containing the udp header if self has the value Udp. Otherwise None is returned.

pub fn tcp(self) -> Option<TcpHeader>[src]

Returns Result::Some containing the tcp header if self has the value Tcp. Otherwise None is returned.

pub fn mut_tcp(&mut self) -> Option<&mut TcpHeader>[src]

Returns Result::Some containing a mutable refernce to the tcp header if self has the value Tcp. Otherwise None is returned.

pub fn header_len(&self) -> usize[src]

Returns the size of the transport header (in case of UDP fixed, in case of TCP cotanining the options).dd

pub fn update_checksum_ipv4(
    &mut self,
    ip_header: &Ipv4Header,
    payload: &[u8]
) -> Result<(), ValueError>
[src]

Calculates the checksum for the transport header & sets it in the header for an ipv4 header.

pub fn update_checksum_ipv6(
    &mut self,
    ip_header: &Ipv6Header,
    payload: &[u8]
) -> Result<(), ValueError>
[src]

Calculates the checksum for the transport header & sets it in the header for an ipv6 header.

pub fn write<T: Write + Sized>(&self, writer: &mut T) -> Result<(), WriteError>[src]

Write the transport header to the given writer.

Trait Implementations

impl Clone for TransportHeader[src]

impl Eq for TransportHeader[src]

impl PartialEq<TransportHeader> for TransportHeader[src]

impl Debug for TransportHeader[src]

impl StructuralPartialEq for TransportHeader[src]

impl StructuralEq for TransportHeader[src]

Auto Trait Implementations

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]