[−][src]Struct ethox::nic::external::External
An interface with buffers managed externally.
This implementation can be used in a number of ways. Firstly, it is good to mock a real interface in tests, allowing full control over the behaviour between operations. Secondly, it can be used as a temporary software buffer for virtualization purposes.
Methods
impl<T> External<T>
[src]
pub fn set_one_past_receive(&mut self, at: usize)
[src]
Set the index of the last to-receive buffer.
pub fn reset_send(&mut self)
[src]
Reset sending, resending into the first buffer.
pub fn reset_receive(&mut self)
[src]
Reset receiving, receiving the first buffer again.
impl<T, P> External<T> where
T: Deref<Target = [P]>,
[src]
T: Deref<Target = [P]>,
pub fn new_send(buffer: T) -> Self
[src]
A new external nic, only sending packets.
pub fn new_recv(buffer: T) -> Self
[src]
A new external nic, only receiving packets.
pub fn to_recv(&self) -> usize
[src]
Remaining number of buffers to receive.
pub fn to_send(&self) -> usize
[src]
Remaining number of buffers to send.
pub fn receive_all(&mut self)
[src]
Change the buffer state such that all packets are pending to be received.
pub fn send_all(&mut self)
[src]
Change the buffer state such that all packets are pending to be sent.
pub fn get(&self, idx: usize) -> Option<&P>
[src]
Get a reference to the buffer as the specified index.
pub fn get_mut(&mut self, idx: usize) -> Option<&mut P> where
T: DerefMut,
[src]
T: DerefMut,
Get a mutable reference to the buffer as the specified index.
pub fn set_current_time(&mut self, instant: Instant)
[src]
Update the timestamp on all future received packets.
Trait Implementations
impl<T, P> Device for External<T> where
T: Deref<Target = [P]> + DerefMut,
P: Payload,
[src]
T: Deref<Target = [P]> + DerefMut,
P: Payload,
type Handle = Handle
The control handle type also providing packet meta information.
type Payload = P
The payload buffer type of this device. Read more
fn personality(&self) -> Personality
[src]
fn tx(
&mut self,
max: usize,
sender: impl Send<Self::Handle, Self::Payload>
) -> Result<usize>
[src]
&mut self,
max: usize,
sender: impl Send<Self::Handle, Self::Payload>
) -> Result<usize>
fn rx(
&mut self,
max: usize,
receptor: impl Recv<Self::Handle, Self::Payload>
) -> Result<usize>
[src]
&mut self,
max: usize,
receptor: impl Recv<Self::Handle, Self::Payload>
) -> Result<usize>
Auto Trait Implementations
impl<T> Send for External<T> where
T: Send,
T: Send,
impl<T> Sync for External<T> where
T: Sync,
T: Sync,
impl<T> Unpin for External<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,