Trait SendMagicPacket

Source
pub trait SendMagicPacket {
    // Required method
    fn send_magic_packet<A: ToSocketAddrs>(
        &self,
        mac_address: MacAddr6,
        secure_on: Option<[u8; 6]>,
        addr: A,
    ) -> Result<()>;
}
Expand description

A socket which supports sending a magic packet.

Required Methods§

Source

fn send_magic_packet<A: ToSocketAddrs>( &self, mac_address: MacAddr6, secure_on: Option<[u8; 6]>, addr: A, ) -> Result<()>

Send a magic packet for mac_address to addr over this socket.

§SecureON

In addition to the mac_address, you can optionally include a shared “SecureON” byte sequence in the magic packet.

See module documentation for more information.

§Target address

Normally, you would send the packet to the broadcast address (IPv4) or the link-local multicast address (IPv6), but you may specify any address as long as the target host will physically see the packet along its way to the target address.

Any target port will do, since the magic packet never makes it to the operating system where ports matter; the NIC will directly process it.

Port 9 (discard) is often a good choice, because no service will listen on this port.

§Errors

Return any errors from the underlying socket I/O.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SendMagicPacket for UdpSocket

Source§

fn send_magic_packet<A: ToSocketAddrs>( &self, mac_address: MacAddr6, secure_on: Option<[u8; 6]>, addr: A, ) -> Result<()>

Implementors§