Module RelayModel.ModuleConfig

Expand source code
import logging

# Defines the level of the logger
RELAY_LOG_LEVEL = logging.WARNING
"""int: Holds the logging level of all loggers in this module.

Normally this is set to logging.WARNING
"""

# Defines the timeout period of a relay layer
RELAY_LAYER_TIMEOUT_PERIOD = 1
"""float: Defines the timeout period of a relay layer.

Normally this is set to 1 second.
"""

# Defines the timeout period of a node
NODE_TIMEOUT_PERIOD = 1
"""float: Defines the timeout period of a node.

Normally this is set to 1 second.
"""

# Timeout for polling receiving messages when sending in link layer
POLL_TIMEOUT = 300
"""int: Timeout in milliseconds for polling receiving messages when sending in link layer.

Normally this is set to 300 ms.
"""

# Tries until the receiving sockets is considered as closed
POLL_TRIES = 3
"""int: Tries until the receiving socket is considered as closed.

Normally this is set to 3 tries.
"""

# Consider link layer as closed if message discarded
CONSIDER_AS_CLOSED = False
"""bool: Stores the flag if the link layer should send closed messages if one link layer is not reachable.

If this is set to False it will only discard the messages after the retries. Otherwise it will send In- and 
OutRelayClosed Actions.
Normally this is set to False.
"""

# Analyse statemonitor address
STATE_MONITOR_PORT = 1999
"""Defines the port of the StateMonitor

Normally this is set to port 1999.
"""

STATE_MONITOR_ADDRESS = "localhost:" + str(STATE_MONITOR_PORT)
"""Defines the full address of the StateMonitor including ip and port.

Normally the ip of the address is localhost.
"""

# Activate DoS detection
DOS_DETECTION_ACTIVATED = True
"""Stores the flag if the dos detection should be used.

If this is set to True the RelayLayer is watching transmit rates and try to detect dos attacks.
Normally this is set to True.
"""

# DoS Window Size
WINDOW_SIZE = 20
"""Defines the window size for the dos detection.

This should be a value that is dividable by 2.
Normally this is set to 20.
"""

# DoS change detection alpha
CHANGE_ALPHA = -10
"""Defines the change rate threshold for a dos attack detection.

This value should always be lower than 0. Otherwise falling transmit rates get detected as dos attacks.
Normally this is set to -10.
"""

# Actions that are not tracked and should only be used for relay layer messages
NO_MONITOR_ACTIONS = ['Probe', 'ProbeFail', 'NotAuthorized', 'Ping', 'InRelayClosed', 'OutRelayClosed']
"""Stores the actions that are standard actions from the RelayLayer.

This actions are not monitored on transmission because a node should not have access to this actions.
It is stored in a list where each entry has the action name set.
Normally this is set to ['Probe', 'ProbeFail', 'NotAuthorized', 'Ping', 'InRelayClosed', 'OutRelayClosed']
"""

# Results folder
RESULTS_FOLDER = "results/"
"""Defines the folder where the StateMonitor should write result files to.

Normally this is set to the folder named "results/".
"""

Global variables

var CHANGE_ALPHA

Defines the change rate threshold for a dos attack detection.

This value should always be lower than 0. Otherwise falling transmit rates get detected as dos attacks. Normally this is set to -10.

var CONSIDER_AS_CLOSED

bool: Stores the flag if the link layer should send closed messages if one link layer is not reachable.

If this is set to False it will only discard the messages after the retries. Otherwise it will send In- and OutRelayClosed Actions. Normally this is set to False.

var DOS_DETECTION_ACTIVATED

Stores the flag if the dos detection should be used.

If this is set to True the RelayLayer is watching transmit rates and try to detect dos attacks. Normally this is set to True.

var NODE_TIMEOUT_PERIOD

float: Defines the timeout period of a node.

Normally this is set to 1 second.

var NO_MONITOR_ACTIONS

Stores the actions that are standard actions from the RelayLayer.

This actions are not monitored on transmission because a node should not have access to this actions. It is stored in a list where each entry has the action name set. Normally this is set to ['Probe', 'ProbeFail', 'NotAuthorized', 'Ping', 'InRelayClosed', 'OutRelayClosed']

var POLL_TIMEOUT

int: Timeout in milliseconds for polling receiving messages when sending in link layer.

Normally this is set to 300 ms.

var POLL_TRIES

int: Tries until the receiving socket is considered as closed.

Normally this is set to 3 tries.

var RELAY_LAYER_TIMEOUT_PERIOD

float: Defines the timeout period of a relay layer.

Normally this is set to 1 second.

var RELAY_LOG_LEVEL

int: Holds the logging level of all loggers in this module.

Normally this is set to logging.WARNING

var RESULTS_FOLDER

Defines the folder where the StateMonitor should write result files to.

Normally this is set to the folder named "results/".

var STATE_MONITOR_ADDRESS

Defines the full address of the StateMonitor including ip and port.

Normally the ip of the address is localhost.

var STATE_MONITOR_PORT

Defines the port of the StateMonitor

Normally this is set to port 1999.

var WINDOW_SIZE

Defines the window size for the dos detection.

This should be a value that is dividable by 2. Normally this is set to 20.