pub enum TriggerAction<T: Instant = Instant> {
Cancel {
machine: MachineId,
timer: Timer,
},
SendPadding {
timeout: T::Duration,
bypass: bool,
replace: bool,
machine: MachineId,
},
BlockOutgoing {
timeout: T::Duration,
duration: T::Duration,
bypass: bool,
replace: bool,
machine: MachineId,
},
UpdateTimer {
duration: T::Duration,
replace: bool,
machine: MachineId,
},
}
Expand description
The action to be taken by the framework user.
Variants§
Cancel
Cancel one or more timers for a machine.
Depending on the value of timer
, either the internal timer should be
cancelled, the external timer should be cancelled, or both.
Cancelling a timer does not cause a TriggerEvent::TimerEnd
event.
SendPadding
Schedule padding to be injected after the given timeout for a machine.
The bypass flag indicates if the padding packet MUST be sent despite active blocking of outgoing traffic. Note that this is only allowed if the active blocking was set with the bypass flag set to true.
The replace flag determines if the padding packet MAY be replaced by a packet already queued to be sent at the time the padding packet would be sent. This applies for data queued to be turned into normal (non-padding) packets AND any packet (padding or normal) in the egress queue yet to be sent (i.e., before the TunnelSent event is triggered). Such a packet could be in the queue due to ongoing blocking or just not being sent yet (e.g., due to CC). We assume that packets will be encrypted ASAP for the egress queue and we do not want to keep state around to distinguish padding and non-padding, hence, any packet. Similarly, this implies that a single blocked packet in the egress queue can replace multiple padding packets with the replace flag set.
If the bypass and replace flags are both set to true AND the active blocking may be bypassed, then non-padding packets MAY replace the padding packet AND bypass the active blocking.
When the padding is queued, a corresponding
TriggerEvent::PaddingSent
event SHOULD always be triggered, with a
matching MachineId, even if the padding packet is replaced by another
packet.
Note that, since only one action timer per machine can be pending at a
time, this SendPadding
action should replace any currently pending
SendPadding
or BlockOutgoing
action timer for this machine that has
not yet expired.
BlockOutgoing
Schedule blocking of outgoing traffic after the given timeout for a machine. The duration of the blocking is specified. Note that the blocking is framework scoped, i.e., if there are multiple machines running, then the blocking will affect all of them.
Whenever the given action timeout expires, a corresponding
TriggerEvent::BlockingBegin
event should be triggered with the same
MachineId, regardless of whether the current blocking was adjusted.
The bypass flag indicates if the blocking of outgoing traffic can be bypassed by padding packets with the bypass flag set to true.
The replace flag indicates if the duration MUST replace any other currently ongoing blocking of outgoing traffic. If the flag is false, the longest of the two durations MUST be used.
Whenever the blocking timer of outgoing traffic is replaced or adjusted, the “bypassable” status of the blocking is also replaced.
Note that, since only one action timer per machine can be pending at a
time, this BlockOutgoing
action should replace any currently pending
BlockOutgoing
or SendPadding
action timer for this machine that has
not yet expired.
UpdateTimer
Update the duration of the internal timer for a machine.
The replace flag specifies if the duration should replace the current timer duration. If the flag is false, the longest of the two durations MUST be used.
Whenever an internal timer is created, and whenever the timer’s duration
is changed, a corresponding TriggerEvent::TimerBegin
event should be
triggered, with a matching MachineId
.
Whenever an internal expires, a corresponding TriggerEvent::TimerEnd
event should be triggered. with a matching MachineId
.
Trait Implementations§
Source§impl<T: Clone + Instant> Clone for TriggerAction<T>
impl<T: Clone + Instant> Clone for TriggerAction<T>
Source§fn clone(&self) -> TriggerAction<T>
fn clone(&self) -> TriggerAction<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more