Enum Init

Source
pub enum Init {
    EchoRequest {
        source: Source,
        dst_addr: Address,
        ident: u16,
        seq_no: u16,
        payload: usize,
    },
}
Expand description

A helper struct for packet initialization.

In other layers the equivalent utilizes the endpoint itself for specialized initialization but the ICMP endpoint has almost no state. The [RawPacket::prepare] method thus mostly wraps packet buffer initialization that could be implemented by the user, in a slightly more ergonomic interface.

Variants§

§

EchoRequest

An initializer for an echo request, expecting an echo response by the identified remote party.

Fields

§source: Source

The network source address to use.

You likely want to use an address that was configured in the IP layer so that the response will actually be forwarded accordingly.

§dst_addr: Address

The network destination address to query.

§ident: u16

An arbitrary identifier for the requested.

§seq_no: u16

A sequence number for repeated requests.

§payload: usize

The length of user defined payload.

The content is likely ignored by the receiver, other than being echoed back.

Auto Trait Implementations§

§

impl Freeze for Init

§

impl RefUnwindSafe for Init

§

impl Send for Init

§

impl Sync for Init

§

impl Unpin for Init

§

impl UnwindSafe for Init

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.