netstack3_ip

Trait IpHeaderInfo

Source
pub trait IpHeaderInfo<I> {
    // Required methods
    fn dscp_and_ecn(&self) -> DscpAndEcn;
    fn hop_limit(&self) -> u8;
    fn router_alert(&self) -> bool;
}
Expand description

Abstracts extracting information from IP headers for upper layers.

Implemented for the combination of fixed header and options of IPv4 and IPv6 packets, so we can ensure this information is always extracted from packets, including when they’re rewritten by filters.

This is a trait so:

  • We’re gating here and acknowledging all the information necessary by upper layers.
  • A fake implementation can be provided without constructing a full IPv4/IPv6 packet.

Required Methods§

Source

fn dscp_and_ecn(&self) -> DscpAndEcn

DSCP and ECN values received in Traffic Class or TOS field.

Source

fn hop_limit(&self) -> u8

The TTL (IPv4) or Hop Limit (IPv6) of the received packet.

Source

fn router_alert(&self) -> bool

Returns true if the router alert option (IPv4) or extension header (IPv6) is present on the packet.

Implementors§