Trait TapTCommon

Source
pub trait TapTCommon:
    Read
    + Write
    + AsRawDescriptor
    + Send
    + Sized {
Show 15 methods // Required methods fn new_with_name( name: &[u8], vnet_hdr: bool, multi_vq: bool, ) -> Result<Self>; fn new(vnet_hdr: bool, multi_vq: bool) -> Result<Self>; fn into_mq_taps(self, vq_pairs: u16) -> Result<Vec<Self>>; fn ip_addr(&self) -> Result<Ipv4Addr>; fn set_ip_addr(&self, ip_addr: Ipv4Addr) -> Result<()>; fn netmask(&self) -> Result<Ipv4Addr>; fn set_netmask(&self, netmask: Ipv4Addr) -> Result<()>; fn mtu(&self) -> Result<u16>; fn set_mtu(&self, mtu: u16) -> Result<()>; fn mac_address(&self) -> Result<MacAddress>; fn set_mac_address(&self, mac_addr: MacAddress) -> Result<()>; fn set_offload(&self, flags: c_uint) -> Result<()>; fn enable(&self) -> Result<()>; fn try_clone(&self) -> Result<Self>; unsafe fn from_raw_descriptor(descriptor: RawDescriptor) -> Result<Self>;
}

Required Methods§

Source

fn new_with_name(name: &[u8], vnet_hdr: bool, multi_vq: bool) -> Result<Self>

Create a new tap interface named name, or open it if it already exists with the same parameters.

Set the vnet_hdr flag to true to allow offloading on this tap, which will add an extra 12 byte virtio net header to incoming frames. Offloading cannot be used if vnet_hdr is false. Set ‘multi_vq’ to true, if tap have multi virt queue pairs

Source

fn new(vnet_hdr: bool, multi_vq: bool) -> Result<Self>

Create a new tap interface. Set the vnet_hdr flag to true to allow offloading on this tap, which will add an extra 12 byte virtio net header to incoming frames. Offloading cannot be used if vnet_hdr is false. Set ‘multi_vq’ to true if tap has multi virt queue pairs.

Source

fn into_mq_taps(self, vq_pairs: u16) -> Result<Vec<Self>>

Change the origin tap into multiqueue taps, this means create other taps based on the origin tap.

Source

fn ip_addr(&self) -> Result<Ipv4Addr>

Get the host-side IP address for the tap interface.

Source

fn set_ip_addr(&self, ip_addr: Ipv4Addr) -> Result<()>

Set the host-side IP address for the tap interface.

Source

fn netmask(&self) -> Result<Ipv4Addr>

Get the netmask for the tap interface’s subnet.

Source

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

Set the netmask for the subnet that the tap interface will exist on.

Source

fn mtu(&self) -> Result<u16>

Get the MTU for the tap interface.

Source

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

Set the MTU for the tap interface.

Source

fn mac_address(&self) -> Result<MacAddress>

Get the mac address for the tap interface.

Source

fn set_mac_address(&self, mac_addr: MacAddress) -> Result<()>

Set the mac address for the tap interface.

Source

fn set_offload(&self, flags: c_uint) -> Result<()>

Set the offload flags for the tap interface.

Source

fn enable(&self) -> Result<()>

Enable the tap interface.

Source

fn try_clone(&self) -> Result<Self>

Try to clone

Source

unsafe fn from_raw_descriptor(descriptor: RawDescriptor) -> Result<Self>

Convert raw descriptor to

§Safety

Caller must ensure that RawDescriptor stays valid as long as the lifetime of Self.

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.

Implementors§