pub struct RawSocketDriver { /* private fields */ }Expand description
A driver over a packet socket bound to a host interface, sending and receiving whole frames.
Ethernet interfaces carry Ethernet frames (Medium::Ethernet), wpan
interfaces carry IEEE 802.15.4 frames (Medium::Ieee802154). Linux and
Android only.
Implementations§
Source§impl RawSocketDriver
impl RawSocketDriver
Sourcepub fn new(
name: &str,
hardware_addr: HardwareAddress,
) -> Result<RawSocketDriver>
pub fn new( name: &str, hardware_addr: HardwareAddress, ) -> Result<RawSocketDriver>
Open a packet socket bound to the interface called name.
hardware_addr is the address the interface reports to the stack, and picks the
medium: an Ethernet address for an Ethernet interface, an IEEE 802.15.4 one for a
wpan interface. It must match the address the host interface is configured with.
This requires superuser privileges or a corresponding capability bit set on the executable.
Errors:
- the OS error if the socket cannot be opened or bound, or the interface does not exist.
UnsupportedforHardwareAddress::Ip, and for an IEEE 802.15.4 address that is not an extended address.
Trait Implementations§
Source§impl AsRawFd for RawSocketDriver
impl AsRawFd for RawSocketDriver
Source§impl Debug for RawSocketDriver
impl Debug for RawSocketDriver
Source§impl Driver for RawSocketDriver
impl Driver for RawSocketDriver
Source§fn capabilities(&self) -> Capabilities
fn capabilities(&self) -> Capabilities
Get a description of the device’s capabilities.
Source§fn hardware_address(&self) -> HardwareAddress
fn hardware_address(&self) -> HardwareAddress
Get the device’s hardware address. Read more
Source§fn transmit(&mut self, buf: PacketBuf) -> Result<(), PacketBuf>
fn transmit(&mut self, buf: PacketBuf) -> Result<(), PacketBuf>
Queue a frame for transmission, transferring ownership of the buffer to the driver. Read more
Source§fn can_transmit(&mut self) -> bool
fn can_transmit(&mut self) -> bool
Whether the device can transmit one frame right now. Read more
Source§fn link_state(&mut self) -> LinkState
fn link_state(&mut self) -> LinkState
Get the link state. Read more
Source§fn poll_tx_timestamp(&mut self) -> Option<TxTimestamp>
fn poll_tx_timestamp(&mut self) -> Option<TxTimestamp>
Poll for the timestamp of an already-transmitted packet. Read more
Source§impl Drop for RawSocketDriver
impl Drop for RawSocketDriver
Auto Trait Implementations§
impl Freeze for RawSocketDriver
impl RefUnwindSafe for RawSocketDriver
impl Send for RawSocketDriver
impl Sync for RawSocketDriver
impl Unpin for RawSocketDriver
impl UnsafeUnpin for RawSocketDriver
impl UnwindSafe for RawSocketDriver
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