Trait net_util::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.

Object Safety§

This trait is not object safe.

Implementors§