Trait ping::IcmpSocket

source ·
pub trait IcmpSocket<I>: Unpin
where I: IpExt,
{ // Required methods fn async_recv_from( &self, buf: &mut [u8], cx: &mut Context<'_> ) -> Poll<Result<(usize, I::SockAddr)>>; fn async_send_to_vectored( &self, bufs: &[IoSlice<'_>], addr: &I::SockAddr, cx: &mut Context<'_> ) -> Poll<Result<usize>>; fn bind_device(&self, interface: Option<&[u8]>) -> Result<()>; }
Expand description

Async ICMP socket.

Required Methods§

source

fn async_recv_from( &self, buf: &mut [u8], cx: &mut Context<'_> ) -> Poll<Result<(usize, I::SockAddr)>>

Async method for receiving an ICMP packet.

Upon successful return, buf will contain an ICMP packet.

source

fn async_send_to_vectored( &self, bufs: &[IoSlice<'_>], addr: &I::SockAddr, cx: &mut Context<'_> ) -> Poll<Result<usize>>

Async method for sending an ICMP packet.

bufs must contain a valid ICMP packet.

source

fn bind_device(&self, interface: Option<&[u8]>) -> Result<()>

Binds this to an interface so that packets can only flow in/out via the specified interface.

If interface is None, the binding is removed.

Implementations on Foreign Types§

source§

impl<I> IcmpSocket<I> for DatagramSocket
where I: IpExt,

source§

fn async_recv_from( &self, buf: &mut [u8], cx: &mut Context<'_> ) -> Poll<Result<(usize, I::SockAddr)>>

Async method for receiving an ICMP packet.

See [fuchsia_async::net::DatagramSocket::recv_from()].

source§

fn async_send_to_vectored( &self, bufs: &[IoSlice<'_>], addr: &I::SockAddr, cx: &mut Context<'_> ) -> Poll<Result<usize>>

Async method for sending an ICMP packet.

See [fuchsia_async::net::DatagramSocket::send_to_vectored()].

source§

fn bind_device(&self, interface: Option<&[u8]>) -> Result<()>

Binds this to an interface so that packets can only flow in/out via the specified interface.

Implemented by setting the SO_BINDTODEVICE socket option.

See [fuchsia_async::net::DatagramSocket::bind_device()].

Implementors§