pub type RouterContext<'a, T> = Context<'a, T>;Expand description
An alias for the router context, to clearly separate it from other contexts
in the simulator. Code external to the router should probably prefer this
RouterContext to the Context syntax for clarity.
Aliased Type§
pub struct RouterContext<'a, T> {
pub now: EmulatedTime,
pub is_bootstrapping: bool,
pub send_packet_fn: fn(&'a T, PacketRc),
pub get_packet_device_fn: fn(&'a T, Ipv4Addr) -> Option<Ref<'a, dyn PacketDevice>>,
pub fn_arg: &'a T,
}Fields§
§now: EmulatedTimeThe current value of the runtime clock.
is_bootstrapping: boolIf the runtime is in bootstrapping mode, where rate limits are ignored.
send_packet_fn: fn(&'a T, PacketRc)The function the router will call when it needs to send a packet over the simulated network.
get_packet_device_fn: fn(&'a T, Ipv4Addr) -> Option<Ref<'a, dyn PacketDevice>>The function the router will call to obtain the underlying packet device
for the address configured in Router::attach_packet_device. The
underlying device is a src/stream for outgoing packets and a dst/sink
for incoming packets.
fn_arg: &'a TThe first argument that will be supplied when calling the
Context::send_packet_fn and Context::get_packet_device_fn
callback functions.