Trait icmp_socket::socket::IcmpSocket
source · [−]pub trait IcmpSocket {
type AddrType;
type PacketType;
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.
Associated Types
type PacketType
type PacketType
The type of packet this socket handles.
Required methods
fn set_timeout(&mut self, timeout: Option<Duration>)
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.
fn set_max_hops(&mut self, hops: u32)
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.
Binds this socket to an address.
Sends the packet to the given destination.