Trait icmp_socket::socket::IcmpSocket[][src]

pub trait IcmpSocket {
    type AddrType;
    type PacketType;
    fn set_timeout(&mut self, timeout: Duration) -> Result<()>;
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)>; }

Trait for an IcmpSocket implemented by Icmpv4Socket and Icmpv6Socket.

Associated Types

type AddrType[src]

The type of address this socket operates on.

type PacketType[src]

The type of packet this socket handles.

Loading content...

Required methods

fn set_timeout(&mut self, timeout: Duration) -> Result<()>[src]

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

fn set_max_hops(&mut self, hops: u32)[src]

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

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

Binds this socket to an address.

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

Sends the packet to the given destination.

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

Receive a packet on this socket.

Loading content...

Implementors

impl IcmpSocket for IcmpSocket4[src]

type AddrType = Ipv4Addr

type PacketType = Icmpv4Packet

impl IcmpSocket for IcmpSocket6[src]

type AddrType = Ipv6Addr

type PacketType = Icmpv6Packet

Loading content...