Skip to main content

Ipv4PacketBuilder

Struct Ipv4PacketBuilder 

Source
pub struct Ipv4PacketBuilder<'buffer, 'input> { /* private fields */ }
Expand description

Caller-buffer IPv4 builder.

Implementations§

Source§

impl<'buffer, 'input> Ipv4PacketBuilder<'buffer, 'input>

Source

pub fn new(buffer: &'buffer mut [u8], payload: usize) -> Self

Starts a builder with untouched payload bytes.

Source

pub fn source(self, v: Ipv4Address) -> Self

Supplies source.

Source

pub fn destination(self, v: Ipv4Address) -> Self

Supplies destination.

Source

pub fn protocol(self, v: Ipv4Protocol) -> Self

Supplies protocol.

Source

pub fn ttl(self, v: u8) -> Self

Supplies TTL.

Source

pub fn identification(self, v: u16) -> Self

Supplies identification.

Source

pub fn flags_fragment_offset(self, v: u16) -> Self

Supplies flags and offset.

Source

pub fn dscp_ecn(self, v: u8) -> Self

Supplies DSCP/ECN.

Source

pub fn options(self, v: &'input [u8]) -> Self

Supplies copied options.

Source

pub fn build(self) -> Result<Ipv4PacketMut<'buffer>, Ipv4PacketBuildError>

Validates before all writes, writes/header-checksums only the header, and preserves payload and trailing capacity.

Auto Trait Implementations§

§

impl<'buffer, 'input> !UnwindSafe for Ipv4PacketBuilder<'buffer, 'input>

§

impl<'buffer, 'input> Freeze for Ipv4PacketBuilder<'buffer, 'input>

§

impl<'buffer, 'input> RefUnwindSafe for Ipv4PacketBuilder<'buffer, 'input>

§

impl<'buffer, 'input> Send for Ipv4PacketBuilder<'buffer, 'input>

§

impl<'buffer, 'input> Sync for Ipv4PacketBuilder<'buffer, 'input>

§

impl<'buffer, 'input> Unpin for Ipv4PacketBuilder<'buffer, 'input>

§

impl<'buffer, 'input> UnsafeUnpin for Ipv4PacketBuilder<'buffer, 'input>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.