Struct netsim::wire::Ipv4Plug
[−]
[src]
pub struct Ipv4Plug { pub tx: UnboundedSender<Ipv4Packet>, pub rx: UnboundedReceiver<Ipv4Packet>, }
One end of an Ipv4 connection that can be used to read/write packets to/from the other end.
Fields
tx: UnboundedSender<Ipv4Packet>
The sender
rx: UnboundedReceiver<Ipv4Packet>
The receiver.
Methods
impl Ipv4Plug
[src]
pub fn new_wire() -> (Ipv4Plug, Ipv4Plug)
[src]
Create a new Ipv4 connection, connecting the two returned plugs.
pub fn with_latency(
self,
handle: &Handle,
min_latency: Duration,
mean_additional_latency: Duration
) -> Ipv4Plug
[src]
self,
handle: &Handle,
min_latency: Duration,
mean_additional_latency: Duration
) -> Ipv4Plug
Add latency to the end of this connection.
min_latency
is the baseline for the amount of delay added to a packet travelling on this
connection. mean_additional_latency
controls the amount of extra, random latency added to
any given packet on this connection. A non-zero mean_additional_latency
can cause packets
to be re-ordered.
pub fn with_hops(self, handle: &Handle, num_hops: u32) -> Ipv4Plug
[src]
Add extra hops to the end of this connection. Packets travelling through this plug will have their TTL decremented by the amount of hops given.
pub fn with_packet_loss(
self,
handle: &Handle,
loss_rate: f64,
mean_loss_duration: Duration
) -> Ipv4Plug
[src]
self,
handle: &Handle,
loss_rate: f64,
mean_loss_duration: Duration
) -> Ipv4Plug
Add packet loss to the connection. Loss happens in burst, rather than on an individual
packet basis. mean_loss_duration
controls the burstiness of the loss.