1//! The network simulation.
2//!
3//! This contains code that simulates the Internet and upstream routers. It does not contain any
4//! emulation of Linux networking behaviour, which exists in the [`crate::host`] module.
56use std::net::Ipv4Addr;
78use crate::network::packet::PacketRc;
910pub mod dns;
11pub mod graph;
12pub mod packet;
13pub mod relay;
14pub mod router;
1516pub trait PacketDevice {
17fn get_address(&self) -> Ipv4Addr;
18fn pop(&self) -> Option<PacketRc>;
19fn push(&self, packet: PacketRc);
20}
2122#[cfg(test)]
23mod tests {
24use shadow_shim_helper_rs::{emulated_time::EmulatedTime, simulation_time::SimulationTime};
2526pub fn mock_time_millis(millis_since_sim_start: u64) -> EmulatedTime {
27let simtime = SimulationTime::from_millis(millis_since_sim_start);
28 EmulatedTime::from_abs_simtime(simtime)
29 }
30}