pub struct TunTapDevice { /* private fields */ }Expand description
A TUN/TAP device, wrapped in an async interface.
Implementations§
Source§impl TunTapDevice
impl TunTapDevice
Sourcepub fn new(name: &str) -> Result<TunTapDevice>
pub fn new(name: &str) -> Result<TunTapDevice>
Create a new TUN/TAP device.
Sourcepub fn set_hardware_address(&mut self, hardware_address: [u8; 6])
pub fn set_hardware_address(&mut self, hardware_address: [u8; 6])
Sets the MAC address of the TAP device.
Note that this can not be completely random; for example, choosing a multicast address (least significant bit of the first octet is 1) would cause xarxa to crash.
Trait Implementations§
Source§impl Driver for TunTapDevice
impl Driver for TunTapDevice
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 link_state(&mut self) -> LinkState
fn link_state(&mut self) -> LinkState
Get the link state. Read more
Source§fn register_waker(&mut self, waker: &Waker) -> Result<(), NotSupported>
fn register_waker(&mut self, waker: &Waker) -> Result<(), NotSupported>
Register a waker. 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 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
§fn set_multicast_filter(&mut self, addrs: &[[u8; 6]])
fn set_multicast_filter(&mut self, addrs: &[[u8; 6]])
Set the device’s multicast hardware address filter. Read more
Auto Trait Implementations§
impl Freeze for TunTapDevice
impl RefUnwindSafe for TunTapDevice
impl Send for TunTapDevice
impl Sync for TunTapDevice
impl Unpin for TunTapDevice
impl UnsafeUnpin for TunTapDevice
impl UnwindSafe for TunTapDevice
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