Protector

class mtf.network_port.e2e_protection.Protector

Base class for various E2EProtector implementations.

__init__() None
increment_counter(counter: int, step: int = 1) int

Increments the given counter by the specified step using the configured E2EProtector.

Args:

counter (int): The counter value to increment. step (int): The step by which to increment the counter. If the value is

greater than or equal to 0, the counter will increase. If the value is negative, the counter will decrease. Defaults to 1.

Returns:

int: The incremented counter value.

Raises:

NotConfiguredError: If the Protector is not configured.

check(payload: list[int]) bool

Check the payload integrity using the configured E2EProtector.

Args:

payload (list[int]): The payload to check.

Returns:

bool: True if the payload is valid, False if not.

Raises:

NotConfiguredError: If the Protector is not configured.

protect(payload: list[int]) bool

Protect the payload using the configured E2EProtector.

Args:

payload (list[int]): The payload to protect.

Returns:

bool: True if the payload is protected successfully, False if not.

Raises:

NotConfiguredError: If the Protector is not configured.

set_option(option: E2EProtectorOptions, is_set: bool = True) None

Set or unset a specific option for the configured E2EProtector.

Args:

option (E2EProtectorOptions): The option to set or unset. is_set (bool): True to set the option, False to unset.

Raises:

NotConfiguredError: If the Protector is not configured.

get_last_check_status() str

Get the last check status from the receiver state.

Returns:

str: The last check status as a string.