pub enum TransportLayer<'a> {
Tcp(TcpHeaderOpt<'a>),
Udp(&'a UdpHeader),
Sctp(&'a SctpHeader),
Icmp(&'a IcmpHeader),
Icmp6(&'a Icmp6Header),
}Variants§
Tcp(TcpHeaderOpt<'a>)
Udp(&'a UdpHeader)
Sctp(&'a SctpHeader)
Icmp(&'a IcmpHeader)
Icmp6(&'a Icmp6Header)
Implementations§
Source§impl TransportLayer<'_>
impl TransportLayer<'_>
Sourcepub fn ports(&self) -> (u16, u16)
pub fn ports(&self) -> (u16, u16)
Extracts the source and destination ports from the transport layer header.
For TCP, UDP, and SCTP headers, returns the actual source and destination ports. For ICMP and ICMPv6 headers, which don’t have port numbers, returns (0, 0).
§Returns
A tuple containing (source_port, destination_port). For protocols without port numbers, both values will be 0.
Trait Implementations§
Source§impl<'a> Clone for TransportLayer<'a>
impl<'a> Clone for TransportLayer<'a>
Source§fn clone(&self) -> TransportLayer<'a>
fn clone(&self) -> TransportLayer<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for TransportLayer<'a>
impl<'a> Debug for TransportLayer<'a>
Source§impl Display for TransportLayer<'_>
impl Display for TransportLayer<'_>
Source§impl SourceDestLayer<u16> for TransportLayer<'_>
impl SourceDestLayer<u16> for TransportLayer<'_>
Auto Trait Implementations§
impl<'a> Freeze for TransportLayer<'a>
impl<'a> RefUnwindSafe for TransportLayer<'a>
impl<'a> Send for TransportLayer<'a>
impl<'a> Sync for TransportLayer<'a>
impl<'a> Unpin for TransportLayer<'a>
impl<'a> UnsafeUnpin for TransportLayer<'a>
impl<'a> UnwindSafe for TransportLayer<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more