ping

Trait 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§