This commit is contained in:
Jeremy Soller 2016-11-22 21:44:52 -07:00
parent 67440cf835
commit 933086d390
4 changed files with 40 additions and 16 deletions

View file

@ -22,10 +22,6 @@ impl Interface for LoopbackInterface {
self.ip
}
fn arp_event(&mut self) -> Result<()> {
Ok(())
}
fn recv(&mut self) -> Result<Vec<Ipv4>> {
let mut ips = Vec::new();
@ -41,4 +37,12 @@ impl Interface for LoopbackInterface {
Ok(0)
}
fn arp_event(&mut self) -> Result<()> {
Ok(())
}
fn has_loopback_data(&self) -> bool {
! self.packets.is_empty()
}
}

View file

@ -9,7 +9,10 @@ mod loopback;
pub trait Interface {
fn ip(&self) -> Ipv4Addr;
fn arp_event(&mut self) -> Result<()>;
fn recv(&mut self) -> Result<Vec<Ipv4>>;
fn send(&mut self, ip: Ipv4) -> Result<usize>;
fn arp_event(&mut self) -> Result<()>;
fn has_loopback_data(&self) -> bool { false }
}