Skip to main content

SourceDestLayer

Trait SourceDestLayer 

Source
pub trait SourceDestLayer<T> {
    // Required methods
    fn source(&self) -> Option<T>;
    fn dest(&self) -> Option<T>;
}
Expand description

Trait for extracting source and destination fields from packet headers.

This trait provides a generic interface for accessing source and destination information from different types of network headers, regardless of whether they contain IP addresses, ports, or other address types.

§Type Parameters

  • T - The type of address/port information to extract (e.g., Ipv4Addr, Ipv6Addr, u16)

Required Methods§

Source

fn source(&self) -> Option<T>

Extracts the source address/port from the header.

Returns None if the header doesn’t contain source information or if the source field is not applicable for this header type.

Source

fn dest(&self) -> Option<T>

Extracts the destination address/port from the header.

Returns None if the header doesn’t contain destination information or if the destination field is not applicable for this header type.

Implementors§