Trait IcmpSocket

Source
pub trait IcmpSocket {
    type AddrType;
    type PacketType;

    // Required methods
    fn set_timeout(&mut self, timeout: Option<Duration>);
    fn set_max_hops(&mut self, hops: u32);
    fn bind<A: Into<Self::AddrType>>(&mut self, addr: A) -> Result<()>;
    fn send_to(
        &mut self,
        dest: Self::AddrType,
        packet: Self::PacketType,
    ) -> Result<()>;
    fn rcv_from(&mut self) -> Result<(Self::PacketType, SockAddr)>;
}
Expand description

Trait for an IcmpSocket implemented by Icmpv4Socket and Icmpv6Socket.

Required Associated Types§

Source

type AddrType

The type of address this socket operates on.

Source

type PacketType

The type of packet this socket handles.

Required Methods§

Source

fn set_timeout(&mut self, timeout: Option<Duration>)

Sets the timeout on the socket for rcv_from. A value of None will cause rcv_from to block.

Source

fn set_max_hops(&mut self, hops: u32)

Sets the ttl for packets sent on this socket. Controls the number of hops the packet will be allowed to traverse.

Source

fn bind<A: Into<Self::AddrType>>(&mut self, addr: A) -> Result<()>

Binds this socket to an address.

Source

fn send_to( &mut self, dest: Self::AddrType, packet: Self::PacketType, ) -> Result<()>

Sends the packet to the given destination.

Source

fn rcv_from(&mut self) -> Result<(Self::PacketType, SockAddr)>

Receive a packet on this socket.

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§