packet_formats::icmp

Struct IcmpPacketBuilder

Source
pub struct IcmpPacketBuilder<I: IcmpIpExt, M: IcmpMessage<I>> { /* private fields */ }
Expand description

A builder for ICMP packets.

Implementations§

Source§

impl<I: IcmpIpExt, M: IcmpMessage<I>> IcmpPacketBuilder<I, M>

Source

pub fn new<S: Into<I::Addr>, D: Into<I::Addr>>( src_ip: S, dst_ip: D, code: M::Code, msg: M, ) -> IcmpPacketBuilder<I, M>

Construct a new IcmpPacketBuilder.

Source

pub fn message(&self) -> &M

Returns the message in the ICMP packet.

Source

pub fn message_mut(&mut self) -> &mut M

Returns a mutable reference to the message in the ICMP packet.

Source

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

Sets the source IP address of the ICMP packet.

Source

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

Sets the destination IP address of the ICMP packet.

Trait Implementations§

Source§

impl<I: Debug + IcmpIpExt, M: Debug + IcmpMessage<I>> Debug for IcmpPacketBuilder<I, M>
where I::Addr: Debug, M::Code: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<I: IcmpIpExt, M: IcmpMessage<I>> PacketBuilder for IcmpPacketBuilder<I, M>

Source§

fn constraints(&self) -> PacketConstraints

Gets the constraints for this PacketBuilder.
Source§

fn serialize( &self, target: &mut SerializeTarget<'_>, message_body: FragmentedBytesMut<'_, '_>, )

Serializes this packet into an existing buffer. Read more
Source§

impl<I: PartialEq + IcmpIpExt, M: PartialEq + IcmpMessage<I>> PartialEq for IcmpPacketBuilder<I, M>
where I::Addr: PartialEq, M::Code: PartialEq,

Source§

fn eq(&self, other: &IcmpPacketBuilder<I, M>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<I: IcmpIpExt, M: IcmpMessage<I>> StructuralPartialEq for IcmpPacketBuilder<I, M>

Auto Trait Implementations§

§

impl<I, M> Freeze for IcmpPacketBuilder<I, M>
where <I as Ip>::Addr: Freeze, <M as IcmpMessage<I>>::Code: Freeze, M: Freeze,

§

impl<I, M> RefUnwindSafe for IcmpPacketBuilder<I, M>

§

impl<I, M> Send for IcmpPacketBuilder<I, M>
where <M as IcmpMessage<I>>::Code: Send, M: Send,

§

impl<I, M> Sync for IcmpPacketBuilder<I, M>
where <M as IcmpMessage<I>>::Code: Sync, M: Sync,

§

impl<I, M> Unpin for IcmpPacketBuilder<I, M>
where <I as Ip>::Addr: Unpin, <M as IcmpMessage<I>>::Code: Unpin, M: Unpin,

§

impl<I, M> UnwindSafe for IcmpPacketBuilder<I, M>
where <I as Ip>::Addr: UnwindSafe, <M as IcmpMessage<I>>::Code: UnwindSafe, M: UnwindSafe,

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.