packet_formats::ip

Trait IpPacketBuilder

Source
pub trait IpPacketBuilder<I: IpExt>:
    PacketBuilder
    + Clone
    + Debug {
    // Required methods
    fn new(src_ip: I::Addr, dst_ip: I::Addr, ttl: u8, proto: I::Proto) -> Self;
    fn src_ip(&self) -> I::Addr;
    fn set_src_ip(&mut self, addr: I::Addr);
    fn dst_ip(&self) -> I::Addr;
    fn set_dst_ip(&mut self, addr: I::Addr);
    fn proto(&self) -> I::Proto;
    fn set_dscp_and_ecn(&mut self, dscp_and_ecn: DscpAndEcn);
}
Expand description

A builder for IP packets.

Required Methods§

Source

fn new(src_ip: I::Addr, dst_ip: I::Addr, ttl: u8, proto: I::Proto) -> Self

Returns a new packet builder for an associated IP version with the given given source and destination IP addresses, TTL (IPv4)/Hop Limit (IPv4) and Protocol Number.

Source

fn src_ip(&self) -> I::Addr

Returns the source IP address for the builder.

Source

fn set_src_ip(&mut self, addr: I::Addr)

Sets the source IP address for the builder.

Source

fn dst_ip(&self) -> I::Addr

Returns the destination IP address for the builder.

Source

fn set_dst_ip(&mut self, addr: I::Addr)

Sets the destination IP address for the builder.

Source

fn proto(&self) -> I::Proto

Returns the IP protocol number for the builder.

Source

fn set_dscp_and_ecn(&mut self, dscp_and_ecn: DscpAndEcn)

Set DSCP & ECN fields.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§