Enum Action

Source
pub enum Action {
    Cancel {
        timer: Timer,
    },
    SendPadding {
        bypass: bool,
        replace: bool,
        timeout: Dist,
        limit: Option<Dist>,
    },
    BlockOutgoing {
        bypass: bool,
        replace: bool,
        timeout: Dist,
        duration: Dist,
        limit: Option<Dist>,
    },
    UpdateTimer {
        replace: bool,
        duration: Dist,
        limit: Option<Dist>,
    },
}
Expand description

An Action happens upon transition to a State. All actions (except Cancel) can be limited. The limit is the maximum number of times the action can be taken upon repeated transitions to the same state.

Variants§

§

Cancel

Cancel a timer.

Fields

§timer: Timer
§

SendPadding

Schedule padding to be sent after a timeout.

The bypass flag determines if the padding packet MUST bypass any existing blocking that was triggered with the bypass flag set.

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.

Fields

§bypass: bool
§replace: bool
§timeout: Dist
§limit: Option<Dist>
§

BlockOutgoing

Schedule blocking of outgoing traffic after a timeout.

The bypass flag determines if padding actions are allowed to bypass this blocking action. This allows for machines that can fail closed (never bypass blocking) while simultaneously providing support for constant-rate defenses, when set along with the replace flag.

The replace flag determines if the action duration MUST replace any existing blocking. Note that the blocking with the replace flag is always allowed if blocking is currently active, regardless of any limits set. This is to make it possible to create a machine that is guaranteed to prevent indefinite blocking (but comes at the cost of making it possible for a machine that indefinitely refresh blocking by using the replace flag).

Fields

§bypass: bool
§replace: bool
§timeout: Dist
§duration: Dist
§limit: Option<Dist>
§

UpdateTimer

Update the timer duration for a machine.

The replace flag determines if the action duration MUST replace the current timer duration, if the timer has already been set.

Fields

§replace: bool
§duration: Dist
§limit: Option<Dist>

Implementations§

Source§

impl Action

Source

pub fn validate(&self) -> Result<(), Error>

Validate all distributions contained in this action, if any.

Trait Implementations§

Source§

impl Clone for Action

Source§

fn clone(&self) -> Action

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 Debug for Action

Source§

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

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

impl<'de> Deserialize<'de> for Action

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Action

Source§

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

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

impl PartialEq for Action

Source§

fn eq(&self, other: &Action) -> 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 Serialize for Action

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Action

Source§

impl StructuralPartialEq for Action

Auto Trait Implementations§

§

impl Freeze for Action

§

impl RefUnwindSafe for Action

§

impl Send for Action

§

impl Sync for Action

§

impl Unpin for Action

§

impl UnwindSafe for Action

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

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,