Struct MQDevice

Source
pub struct MQDevice(/* private fields */);
Expand description

Represents a multiqueue TUN/TAP device.

Contains the shared code between MQTun and MQTap.

Implementations§

Source§

impl MQDevice

Source

pub fn attach(&self) -> Result<()>

Attaches the multiqueue.

§Returns
  • Ok: If attaching was succesful.
  • Err: Otherwise.
Source

pub fn detach(&self) -> Result<()>

Detaches the multiqueue.

§Returns
  • Ok: If detaching was succesful.
  • Err: Otherwise.

Methods from Deref<Target = Device>§

Source

pub fn name(&self) -> String

Returns The name of the device chosen by the kernel.

Source

pub fn flags(&self) -> Result<Flags>

Returns the active flags of the interface.

Source

pub fn bring_up(&self) -> Result<()>

Brings the device up which makes it ready to send and receive packets.

Source

pub fn bring_down(&self) -> Result<()>

Brings the device down which makes it unable to send and receive packets.

Source

pub fn set_mtu(&self, mtu: i32) -> Result<()>

Sets the MTU of the device.

Source

pub fn get_mtu(&self) -> Result<i32>

Returns the MTU of the device.

Source

pub fn set_netmask(&self, netmask: Ipv4Addr) -> Result<()>

Sets the netmask of the device.

Source

pub fn get_netmask(&self) -> Result<Ipv4Addr>

Sets the netmask of the device.

Source

pub fn get_index(&self) -> Result<i32>

Returns the index of the interface.

Source

pub fn set_ipv6_addr(&self, addr: Ipv6Addr) -> Result<()>

Adds the specified addr to the list of IPv6 addresses of the interface.

Source

pub fn get_ipv6_addrs(&self) -> Result<Vec<Ipv6Addr>>

Returns the list of IPv6 addresses of the interface.

Source

pub fn del_ipv6_addr(&self, addr: Ipv6Addr) -> Result<()>

Deletes the specified IPv6 address from the interface.

Source

pub fn set_addr(&self, addr: Ipv4Addr) -> Result<()>

Sets the IPv4 address of the device.

Source

pub fn get_addr(&self) -> Result<Ipv4Addr>

Returns the IPv4 address of the device.

Source

pub fn del_addr(&self) -> Result<()>

Deletes the IPv4 address of the interface.

Source

pub fn set_brd_addr(&self, addr: Ipv4Addr) -> Result<()>

Sets the broadcast IPv4 address of the device.

Source

pub fn get_brd_addr(&self) -> Result<Ipv4Addr>

Returns the broadcast IPv4 address of the device.

Source

pub fn set_dst_addr(&self, addr: Ipv4Addr) -> Result<()>

Sets the destination IPv4 address of the device.

Source

pub fn get_dst_addr(&self) -> Result<Ipv4Addr>

Returns the destination IPv4 address of the device.

Source

pub fn send(&self, buf: &[u8]) -> Result<usize>

Writes the data in buf into the device.

Source

pub fn recv(&self, buf: &mut [u8]) -> Result<usize>

Reads the data from device into buf.

Trait Implementations§

Source§

impl Debug for MQDevice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for MQDevice

Source§

type Target = Device

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for MQDevice

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.