Added Network trait that keeps track of network settings and has DHCP/Manual options for setting up options
This commit is contained in:
parent
7dd4c04fe4
commit
fd9e861dde
7 changed files with 145 additions and 21 deletions
29
src/network/dhcp.rs
Normal file
29
src/network/dhcp.rs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
use crate::bus::ActiveBus;
|
||||
use crate::network::{Network,NetworkSettings};
|
||||
use crate::MacAddress;
|
||||
|
||||
pub struct Dhcp {
|
||||
settings: NetworkSettings,
|
||||
current: NetworkSettings,
|
||||
}
|
||||
|
||||
impl Dhcp {
|
||||
pub fn new(mac: MacAddress) -> Self {
|
||||
let settings = NetworkSettings {
|
||||
mac,
|
||||
..NetworkSettings::default()
|
||||
};
|
||||
Self {
|
||||
settings,
|
||||
current: NetworkSettings::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Network for Dhcp {
|
||||
/// Gets (if necessary) and sets the network settings on the chip
|
||||
fn refresh<SpiBus: ActiveBus>(&mut self, _bus: &mut SpiBus) -> Result<(), SpiBus::Error> {
|
||||
// TODO actually negotiate settings from DHCP
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue