pub struct IcmpSocket4 { /* private fields */ }Expand description
An ICMPv4 socket.
Implementations§
Source§impl IcmpSocket4
impl IcmpSocket4
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Construct a new raw socket. The socket must be bound to an address using bind_to
before it can be used to send and receive packets.
Sourcepub fn new_dgram_socket() -> Result<Self>
pub fn new_dgram_socket() -> Result<Self>
Construct a new dgram socket. The socket must be bound to an address using bind_to
before it can be used to send and receive packets.
Trait Implementations§
Source§impl IcmpSocket for IcmpSocket4
impl IcmpSocket for IcmpSocket4
Source§type PacketType = Icmpv4Packet
type PacketType = Icmpv4Packet
The type of packet this socket handles.
Source§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.
Source§fn bind<A: Into<Self::AddrType>>(&mut self, addr: A) -> Result<()>
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<()>
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)>
fn rcv_from(&mut self) -> Result<(Self::PacketType, SockAddr)>
Receive a packet on this socket.
Source§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 bind_device(&mut self, interface_name: &str) -> Result<()>
Auto Trait Implementations§
impl Freeze for IcmpSocket4
impl RefUnwindSafe for IcmpSocket4
impl Send for IcmpSocket4
impl Sync for IcmpSocket4
impl Unpin for IcmpSocket4
impl UnsafeUnpin for IcmpSocket4
impl UnwindSafe for IcmpSocket4
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more