pub trait NetworkDevice: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn receive(&self, buf: &mut [u8]) -> Result<usize, NetError>;
fn transmit(&self, buf: &[u8]) -> Result<(), NetError>;
fn mac_address(&self) -> [u8; 6];
fn link_up(&self) -> bool;
// Provided method
fn handle_interrupt(&self) { ... }
}Expand description
Unified network device interface.
Kernel-resident drivers wrap their hardware-specific struct in a
SpinLock and implement this trait with interior mutability.
Future silo-hosted drivers expose the same interface via IPC.
Required Methods§
Sourcefn mac_address(&self) -> [u8; 6]
fn mac_address(&self) -> [u8; 6]
Performs the mac address operation.
Provided Methods§
Sourcefn handle_interrupt(&self)
fn handle_interrupt(&self)
Handles interrupt.