Enum etherparse::TransportHeader
source · pub enum TransportHeader {
Udp(UdpHeader),
Tcp(TcpHeader),
Icmpv4(Icmpv4Header),
Icmpv6(Icmpv6Header),
}
Expand description
The possible headers on the transport layer
Variants§
Implementations§
source§impl TransportHeader
impl TransportHeader
sourcepub fn udp(self) -> Option<UdpHeader>
pub fn udp(self) -> Option<UdpHeader>
Returns Result::Some containing the udp header if self has the value Udp. Otherwise None is returned.
sourcepub fn mut_udp(&mut self) -> Option<&mut UdpHeader>
pub fn mut_udp(&mut self) -> Option<&mut UdpHeader>
Returns Result::Some containing the udp header if self has the value Udp. Otherwise None is returned.
sourcepub fn tcp(self) -> Option<TcpHeader>
pub fn tcp(self) -> Option<TcpHeader>
Returns Result::Some containing the tcp header if self has the value Tcp. Otherwise None is returned.
sourcepub fn mut_tcp(&mut self) -> Option<&mut TcpHeader>
pub fn mut_tcp(&mut self) -> Option<&mut TcpHeader>
Returns Result::Some containing a mutable reference to the tcp header if self has the value Tcp. Otherwise None is returned.
sourcepub fn icmpv4(self) -> Option<Icmpv4Header>
pub fn icmpv4(self) -> Option<Icmpv4Header>
Returns Result::Some containing the ICMPv4 header if self has the value Icmpv4. Otherwise None is returned.
sourcepub fn mut_icmpv4(&mut self) -> Option<&mut Icmpv4Header>
pub fn mut_icmpv4(&mut self) -> Option<&mut Icmpv4Header>
Returns Result::Some containing the ICMPv4 header if self has the value Icmpv4. Otherwise None is returned.
sourcepub fn icmpv6(self) -> Option<Icmpv6Header>
pub fn icmpv6(self) -> Option<Icmpv6Header>
Returns Result::Some containing the ICMPv6 header if self has the value Icmpv6. Otherwise None is returned.
sourcepub fn mut_icmpv6(&mut self) -> Option<&mut Icmpv6Header>
pub fn mut_icmpv6(&mut self) -> Option<&mut Icmpv6Header>
Returns Result::Some containing the ICMPv6 header if self has the value Icmpv6. Otherwise None is returned.
sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Returns the size of the transport header (in case of UDP fixed, in case of TCP cotanining the options).
sourcepub fn update_checksum_ipv4(
&mut self,
ip_header: &Ipv4Header,
payload: &[u8]
) -> Result<(), TransportChecksumError>
pub fn update_checksum_ipv4( &mut self, ip_header: &Ipv4Header, payload: &[u8] ) -> Result<(), TransportChecksumError>
Calculates the checksum for the transport header & sets it in the header for an ipv4 header.
sourcepub fn update_checksum_ipv6(
&mut self,
ip_header: &Ipv6Header,
payload: &[u8]
) -> Result<(), ValueTooBigError<usize>>
pub fn update_checksum_ipv6( &mut self, ip_header: &Ipv6Header, payload: &[u8] ) -> Result<(), ValueTooBigError<usize>>
Calculates the checksum for the transport header & sets it in the header for an ipv6 header.
Trait Implementations§
source§impl Clone for TransportHeader
impl Clone for TransportHeader
source§fn clone(&self) -> TransportHeader
fn clone(&self) -> TransportHeader
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TransportHeader
impl Debug for TransportHeader
source§impl PartialEq for TransportHeader
impl PartialEq for TransportHeader
source§fn eq(&self, other: &TransportHeader) -> bool
fn eq(&self, other: &TransportHeader) -> bool
self
and other
values to be equal, and is used
by ==
.