Enum TriggerAction

Source
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.

Fields

§machine: MachineId
§timer: Timer
§

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.

Fields

§timeout: T::Duration
§bypass: bool
§replace: bool
§machine: MachineId
§

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.

Fields

§timeout: T::Duration
§duration: T::Duration
§bypass: bool
§replace: bool
§machine: MachineId
§

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.

Fields

§duration: T::Duration
§replace: bool
§machine: MachineId

Trait Implementations§

Source§

impl<T: Clone + Instant> Clone for TriggerAction<T>
where T::Duration: Clone,

Source§

fn clone(&self) -> TriggerAction<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Instant> Debug for TriggerAction<T>
where T::Duration: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for TriggerAction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: PartialEq + Instant> PartialEq for TriggerAction<T>
where T::Duration: PartialEq,

Source§

fn eq(&self, other: &TriggerAction<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Eq + Instant> Eq for TriggerAction<T>
where T::Duration: Eq,

Source§

impl<T: Instant> StructuralPartialEq for TriggerAction<T>

Auto Trait Implementations§

§

impl<T> Freeze for TriggerAction<T>
where <T as Instant>::Duration: Freeze,

§

impl<T> RefUnwindSafe for TriggerAction<T>

§

impl<T> Send for TriggerAction<T>
where <T as Instant>::Duration: Send,

§

impl<T> Sync for TriggerAction<T>
where <T as Instant>::Duration: Sync,

§

impl<T> Unpin for TriggerAction<T>
where <T as Instant>::Duration: Unpin,

§

impl<T> UnwindSafe for TriggerAction<T>
where <T as Instant>::Duration: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V