pub struct EthernetDriver { /* private fields */ }Expand description
Ethernet driver implementation
Implementations§
Source§impl EthernetDriver
impl EthernetDriver
Sourcepub fn new(name: String, mac_address: [u8; 6], device_info: DeviceInfo) -> Self
pub fn new(name: String, mac_address: [u8; 6], device_info: DeviceInfo) -> Self
Create a new Ethernet driver
Sourcepub fn simulate_receive(&self, data: Vec<u8>)
pub fn simulate_receive(&self, data: Vec<u8>)
Simulate packet reception
Trait Implementations§
Source§impl Driver for EthernetDriver
impl Driver for EthernetDriver
Source§fn supported_classes(&self) -> Vec<DeviceClass>
fn supported_classes(&self) -> Vec<DeviceClass>
Get supported device classes
Source§fn supports_device(&self, device: &DeviceInfo) -> bool
fn supports_device(&self, device: &DeviceInfo) -> bool
Check if driver supports a device
Source§fn probe(&mut self, _device: &DeviceInfo) -> Result<(), KernelError>
fn probe(&mut self, _device: &DeviceInfo) -> Result<(), KernelError>
Probe device
Source§fn attach(&mut self, _device: &DeviceInfo) -> Result<(), KernelError>
fn attach(&mut self, _device: &DeviceInfo) -> Result<(), KernelError>
Attach to device
Source§fn detach(&mut self, _device: &DeviceInfo) -> Result<(), KernelError>
fn detach(&mut self, _device: &DeviceInfo) -> Result<(), KernelError>
Detach from device
Source§fn suspend(&mut self) -> Result<(), KernelError>
fn suspend(&mut self) -> Result<(), KernelError>
Suspend device
Source§fn resume(&mut self) -> Result<(), KernelError>
fn resume(&mut self) -> Result<(), KernelError>
Resume device
Source§fn handle_interrupt(&mut self, _irq: u8) -> Result<(), KernelError>
fn handle_interrupt(&mut self, _irq: u8) -> Result<(), KernelError>
Handle interrupt
Source§fn read(
&mut self,
_offset: u64,
buffer: &mut [u8],
) -> Result<usize, KernelError>
fn read( &mut self, _offset: u64, buffer: &mut [u8], ) -> Result<usize, KernelError>
Read from device
Source§fn write(&mut self, _offset: u64, data: &[u8]) -> Result<usize, KernelError>
fn write(&mut self, _offset: u64, data: &[u8]) -> Result<usize, KernelError>
Write to device
Source§fn ioctl(&mut self, cmd: u32, _arg: u64) -> Result<u64, KernelError>
fn ioctl(&mut self, cmd: u32, _arg: u64) -> Result<u64, KernelError>
Device control (ioctl)
Source§impl NetworkDevice for EthernetDriver
impl NetworkDevice for EthernetDriver
Source§fn get_config(&self) -> InterfaceConfig
fn get_config(&self) -> InterfaceConfig
Get interface configuration
Source§fn set_config(&mut self, config: InterfaceConfig) -> Result<(), KernelError>
fn set_config(&mut self, config: InterfaceConfig) -> Result<(), KernelError>
Set interface configuration
Source§fn up(&mut self) -> Result<(), KernelError>
fn up(&mut self) -> Result<(), KernelError>
Bring interface up
Source§fn down(&mut self) -> Result<(), KernelError>
fn down(&mut self) -> Result<(), KernelError>
Bring interface down
Source§fn send_packet(&mut self, packet: NetworkPacket) -> Result<(), KernelError>
fn send_packet(&mut self, packet: NetworkPacket) -> Result<(), KernelError>
Send a packet
Source§fn receive_packet(&mut self) -> Result<Option<NetworkPacket>, KernelError>
fn receive_packet(&mut self) -> Result<Option<NetworkPacket>, KernelError>
Receive a packet (non-blocking)
Source§fn get_stats(&self) -> NetworkStats
fn get_stats(&self) -> NetworkStats
Get interface statistics
Source§fn reset_stats(&mut self)
fn reset_stats(&mut self)
Reset interface statistics
Source§fn link_speed(&self) -> u32
fn link_speed(&self) -> u32
Get link speed in Mbps