Struct virtual_nic::VirtualNic

source ·
pub struct VirtualNic<S, T, U, V>where
    S: RxQueueRegisters + 'static,
    T: RxDescriptor + 'static,
    U: TxQueueRegisters + 'static,
    V: TxDescriptor + 'static,{ /* private fields */ }
Expand description

A structure that contains a set of RxQueues and TxQueues that can be used to send and receive packets.

Implementations§

source§

impl<S, T, U, V> VirtualNic<S, T, U, V>where S: RxQueueRegisters + 'static, T: RxDescriptor + 'static, U: TxQueueRegisters + 'static, V: TxDescriptor + 'static,

source

pub fn new( rx_queues: Vec<RxQueue<S, T>>, default_rx_queue: usize, tx_queues: Vec<TxQueue<U, V>>, default_tx_queue: usize, mac_address: [u8; 6], physical_nic_ref: &'static IrqSafeMutex<dyn PhysicalNic<S, T, U, V> + Send> ) -> Result<VirtualNic<S, T, U, V>, &'static str>

Create a new VirtualNIC with the given parameters. For now we require that there is at least one Rx and one Tx queue.

source

pub fn id(&self) -> u8

source

pub fn send_packet_on_queue( &mut self, qid: usize, transmit_buffer: TransmitBuffer ) -> Result<(), &'static str>

Send a packet on the specified queue.

Trait Implementations§

source§

impl<S, T, U, V> Drop for VirtualNic<S, T, U, V>where S: RxQueueRegisters + 'static, T: RxDescriptor + 'static, U: TxQueueRegisters + 'static, V: TxDescriptor + 'static,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<S, T, U, V> NetworkDevice for VirtualNic<S, T, U, V>where S: RxQueueRegisters + Send + Sync + 'static, T: RxDescriptor + Send + Sync + 'static, U: TxQueueRegisters + Send + Sync + 'static, V: TxDescriptor + Send + Sync + 'static,

source§

fn send(&mut self, buf: TransmitBuffer)

Sends a buffer on the device. Read more
source§

fn receive(&mut self) -> Option<ReceivedFrame>

Receives a frame from the device.
source§

fn mac_address(&self) -> [u8; 6]

Returns the MAC address.
§

fn capabilities(&self) -> DeviceCapabilities

Returns the device capabilities.

Auto Trait Implementations§

§

impl<S, T, U, V> !RefUnwindSafe for VirtualNic<S, T, U, V>

§

impl<S, T, U, V> Send for VirtualNic<S, T, U, V>where S: Send, T: Send, U: Send, V: Send,

§

impl<S, T, U, V> Sync for VirtualNic<S, T, U, V>where S: Sync, T: Sync, U: Sync, V: Sync,

§

impl<S, T, U, V> Unpin for VirtualNic<S, T, U, V>where S: Unpin, T: Unpin, U: Unpin, V: Unpin,

§

impl<S, T, U, V> !UnwindSafe for VirtualNic<S, T, U, V>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V