⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

NetworkDevice

Trait NetworkDevice 

Source
pub trait NetworkDevice: Send {
    // Required methods
    fn name(&self) -> &str;
    fn mac_address(&self) -> MacAddress;
    fn capabilities(&self) -> DeviceCapabilities;
    fn state(&self) -> DeviceState;
    fn set_state(&mut self, state: DeviceState) -> Result<(), KernelError>;
    fn statistics(&self) -> DeviceStatistics;
    fn transmit(&mut self, packet: &Packet) -> Result<(), KernelError>;
    fn receive(&mut self) -> Result<Option<Packet>, KernelError>;

    // Provided method
    fn mtu(&self) -> usize { ... }
}
Expand description

Network device trait

Required Methods§

Source

fn name(&self) -> &str

Get device name

Source

fn mac_address(&self) -> MacAddress

Get device MAC address

Source

fn capabilities(&self) -> DeviceCapabilities

Get device capabilities

Source

fn state(&self) -> DeviceState

Get device state

Source

fn set_state(&mut self, state: DeviceState) -> Result<(), KernelError>

Set device state

Source

fn statistics(&self) -> DeviceStatistics

Get device statistics

Source

fn transmit(&mut self, packet: &Packet) -> Result<(), KernelError>

Transmit a packet

Source

fn receive(&mut self) -> Result<Option<Packet>, KernelError>

Receive a packet (non-blocking)

Provided Methods§

Source

fn mtu(&self) -> usize

Get MTU

Implementors§