Fr Tp Frames Module
- class mtf.network_port.iso_tp.custom_fr_tp.fr_tp_frames.BaseFrame
working with frames
- TGT_ADDR_OFFSET
- SRC_ADDR_OFFSET
- PCI_OFFSET
- abstract to_payload() List[int]
- Returns:
FramePayload: List[int]
- abstract from_payload(payload: List[int]) bool
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool
- property address_information
Create a list called payload initialized with zeros
- Returns:
list[int]: contains address information formatted in a specific way
- property source_address
Provides read access to the _source_address attribute
- Returns:
int: source address
- property target_address
Provides read access to the _target_address attribute
- Returns:
int: target address
- classmethod get_source_address(payload: List[int]) Tuple[bool, int]
Extract a source address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted source address (if the extraction is successful), otherwise 0
- classmethod get_target_address(payload: List[int]) Tuple[bool, int]
Extract a target address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted target address (if the extraction is successful), otherwise 0
- classmethod get_pci_type(payload: List[int])
Extract and return the PCI type from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
int: returns an integer representing the PCI type, or 0 if the extraction fails
- parse_address_information(payload: List[int]) bool
Extract address information from a FramePayload and update the object’s attributes
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: Returns True if all extraction and update operations were successful
- class mtf.network_port.iso_tp.custom_fr_tp.fr_tp_frames.StartFrame
Inherits from the BaseFrame class and represents a specific type of frame
- PCI_SIZE
- FPL_OFFSET
- LENGTH_OFFSET
- PAYLOAD_OFFSET
- __init__(source_address: int = 0, target_address: int = 0, acknowledge: SfAckValues = 0, message_length: int = 0, payload: List[int] = []) None
- to_payload() List[int]
Convert the attributes of a StartFrame instance into a binary representation as a FramePayload
- Returns:
list[int]
- from_payload(payload: List[int]) bool
Extract and initialize the attributes of a StartFrame instance from a FramePayload object
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: If this extraction fails, the method returns False
- property message_length
Provides read access to the _message_length attribute
- Returns:
int: message length
- property acknowledge
Provides read access to the _acknowledge attribute
- Returns:
SfAckValues: acknowledge
- property payload_data
Provides read access to the _payload attribute
- Returns:
list[int]: payload
- property frame_payload_length
Provides read access to the _fpl attribute
- Returns:
int: fpl
- classmethod max_payload_length(pdu_length: int)
Calculate the maximum length of the payload that a frame can contain
- Args:
pdu_length (int)
- Returns:
int: maximum length of the payload
- PCI_OFFSET
- SRC_ADDR_OFFSET
- TGT_ADDR_OFFSET
- property address_information
Create a list called payload initialized with zeros
- Returns:
list[int]: contains address information formatted in a specific way
- classmethod get_pci_type(payload: List[int])
Extract and return the PCI type from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
int: returns an integer representing the PCI type, or 0 if the extraction fails
- classmethod get_source_address(payload: List[int]) Tuple[bool, int]
Extract a source address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted source address (if the extraction is successful), otherwise 0
- classmethod get_target_address(payload: List[int]) Tuple[bool, int]
Extract a target address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted target address (if the extraction is successful), otherwise 0
- parse_address_information(payload: List[int]) bool
Extract address information from a FramePayload and update the object’s attributes
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: Returns True if all extraction and update operations were successful
- property source_address
Provides read access to the _source_address attribute
- Returns:
int: source address
- property target_address
Provides read access to the _target_address attribute
- Returns:
int: target address
- class mtf.network_port.iso_tp.custom_fr_tp.fr_tp_frames.LastFrame
Inherits from the BaseFrame class and represents a specific type of frame
- PCI_SIZE
- FPL_OFFSET
- LENGTH_OFFSET
- PAYLOAD_OFFSET
- __init__(source_address: int = 0, target_address: int = 0, message_length: int = 0, payload: List[int] = []) None
- to_payload() List[int]
Convert the attributes of a LastFrame instance into a binary representation as a FramePayload
- Returns:
list[int]
- from_payload(payload: List[int]) bool
Extract and initialize the attributes of a LastFrame instance from a FramePayload object
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: If this extraction fails, the method returns False
- property Frame_Payload_Length
Provides read access to the _fpl attribute
- Returns:
int: fpl
- property Message_Length
Provides read access to the _message_length attribute
- Returns:
int: message length
- property Payload_Data
Provides read access to the _payload attribute
- Returns:
list[int]: payload
- classmethod max_payload_length(pdu_length: int)
Calculate the maximum length of the payload that a frame can contain
- Args:
pdu_length (int)
- Returns:
int: maximum length of the payload
- PCI_OFFSET
- SRC_ADDR_OFFSET
- TGT_ADDR_OFFSET
- property address_information
Create a list called payload initialized with zeros
- Returns:
list[int]: contains address information formatted in a specific way
- classmethod get_pci_type(payload: List[int])
Extract and return the PCI type from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
int: returns an integer representing the PCI type, or 0 if the extraction fails
- classmethod get_source_address(payload: List[int]) Tuple[bool, int]
Extract a source address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted source address (if the extraction is successful), otherwise 0
- classmethod get_target_address(payload: List[int]) Tuple[bool, int]
Extract a target address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted target address (if the extraction is successful), otherwise 0
- parse_address_information(payload: List[int]) bool
Extract address information from a FramePayload and update the object’s attributes
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: Returns True if all extraction and update operations were successful
- property source_address
Provides read access to the _source_address attribute
- Returns:
int: source address
- property target_address
Provides read access to the _target_address attribute
- Returns:
int: target address
- class mtf.network_port.iso_tp.custom_fr_tp.fr_tp_frames.ConsecutiveFrame
Inherits from the BaseFrame class and represents a specific type of frame
- PCI_SIZE
- FPL_OFFSET
- PAYLOAD_OFFSET
- __init__(source_address: int = 0, target_address: int = 0, sequence_number: int = 0, payload: List[int] = [], pci_type=FrPciType.CONSECUTIVE_FRAME_1) None
- to_payload() List[int]
Convert the attributes of a ConsecutiveFrame instance into a binary representation as a FramePayload
- Returns:
list[int]
- from_payload(payload: List[int]) bool
Extract and initialize the attributes of a ConsecutiveFrame instance from a FramePayload object
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: If this extraction fails, the method returns False
- property sequence_number
Provides read access to the _sequence_number attribute
- Returns:
int: sequence number
- property payload_data
Provides read access to the _payload attribute
- Returns:
list[int]: payload
- property frame_payload_length
Provides read access to the _fpl attribute
- Returns:
int: fpl
- classmethod next_sequence_number(sequence_number: int) int
Calculate the next sequence number in a context where sequence numbers are cyclic with a range of 16 values (0 to 15)
- Args:
sequence_number (int)
- Returns:
int
- classmethod max_payload_length(pdu_length: int)
Calculate the maximum length of the payload that a frame can contain
- Args:
pdu_length (int)
- Returns:
int: maximum length of the payload
- PCI_OFFSET
- SRC_ADDR_OFFSET
- TGT_ADDR_OFFSET
- property address_information
Create a list called payload initialized with zeros
- Returns:
list[int]: contains address information formatted in a specific way
- classmethod get_pci_type(payload: List[int])
Extract and return the PCI type from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
int: returns an integer representing the PCI type, or 0 if the extraction fails
- classmethod get_source_address(payload: List[int]) Tuple[bool, int]
Extract a source address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted source address (if the extraction is successful), otherwise 0
- classmethod get_target_address(payload: List[int]) Tuple[bool, int]
Extract a target address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted target address (if the extraction is successful), otherwise 0
- parse_address_information(payload: List[int]) bool
Extract address information from a FramePayload and update the object’s attributes
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: Returns True if all extraction and update operations were successful
- property source_address
Provides read access to the _source_address attribute
- Returns:
int: source address
- property target_address
Provides read access to the _target_address attribute
- Returns:
int: target address
- class mtf.network_port.iso_tp.custom_fr_tp.fr_tp_frames.FlowControl
Inherits from the BaseFrame class and represents a specific type of frame
- PCI_SIZE_CTS
- PCI_SIZE_ACK_RET
- BC_OFFSET
- BFS_OFFSET
- ACKNOWLEDGE_OFFSET
- BYTE_POSITION_OFFSET
- __init__(source_address: int = 0, target_address: int = 0, flow_status: FrFlowStatus = FrFlowStatus.CTS) None
- to_payload() List[int]
Convert the attributes of a FlowControl instance into a binary representation as a FramePayload
- Returns:
list[int]
- from_payload(payload: List[int]) bool
Extract and initialize the attributes of a FlowFrame instance from a FramePayload object
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: If this extraction fails, the method returns False
- property flow_status
Provides read access to the _flow_status attribute
- Returns:
FrFlowStatus: flow status
- property bandwidth_control
Provides read access to the _bandwidth_control attribute
- Returns:
int: bandwidth control
- property buffer_size
Provides read access to the _buffer_size attribute
- Returns:
int: buffer size
- property acknowledge
provides read access to the _acknowledge attribute
- Returns:
SfAckValues: acknowledge
- property byte_position
Provides read access to the _byte_position attribute
- Returns:
int: byte position
- PCI_OFFSET
- SRC_ADDR_OFFSET
- TGT_ADDR_OFFSET
- property address_information
Create a list called payload initialized with zeros
- Returns:
list[int]: contains address information formatted in a specific way
- classmethod get_pci_type(payload: List[int])
Extract and return the PCI type from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
int: returns an integer representing the PCI type, or 0 if the extraction fails
- classmethod get_source_address(payload: List[int]) Tuple[bool, int]
Extract a source address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted source address (if the extraction is successful), otherwise 0
- classmethod get_target_address(payload: List[int]) Tuple[bool, int]
Extract a target address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted target address (if the extraction is successful), otherwise 0
- parse_address_information(payload: List[int]) bool
Extract address information from a FramePayload and update the object’s attributes
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: Returns True if all extraction and update operations were successful
- property source_address
Provides read access to the _source_address attribute
- Returns:
int: source address
- property target_address
Provides read access to the _target_address attribute
- Returns:
int: target address
- class mtf.network_port.iso_tp.custom_fr_tp.fr_tp_frames.CTSFlowControl
Represent a specific type of flow control in a communication protocol
- __init__(source_address: int = 0, target_address: int = 0, bandwidth_control: int = 0, buffer_size: int = 0)
- ACKNOWLEDGE_OFFSET
- BC_OFFSET
- BFS_OFFSET
- BYTE_POSITION_OFFSET
- PCI_OFFSET
- PCI_SIZE_ACK_RET
- PCI_SIZE_CTS
- SRC_ADDR_OFFSET
- TGT_ADDR_OFFSET
- property acknowledge
provides read access to the _acknowledge attribute
- Returns:
SfAckValues: acknowledge
- property address_information
Create a list called payload initialized with zeros
- Returns:
list[int]: contains address information formatted in a specific way
- property bandwidth_control
Provides read access to the _bandwidth_control attribute
- Returns:
int: bandwidth control
- property buffer_size
Provides read access to the _buffer_size attribute
- Returns:
int: buffer size
- property byte_position
Provides read access to the _byte_position attribute
- Returns:
int: byte position
- property flow_status
Provides read access to the _flow_status attribute
- Returns:
FrFlowStatus: flow status
- from_payload(payload: List[int]) bool
Extract and initialize the attributes of a FlowFrame instance from a FramePayload object
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: If this extraction fails, the method returns False
- classmethod get_pci_type(payload: List[int])
Extract and return the PCI type from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
int: returns an integer representing the PCI type, or 0 if the extraction fails
- classmethod get_source_address(payload: List[int]) Tuple[bool, int]
Extract a source address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted source address (if the extraction is successful), otherwise 0
- classmethod get_target_address(payload: List[int]) Tuple[bool, int]
Extract a target address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted target address (if the extraction is successful), otherwise 0
- parse_address_information(payload: List[int]) bool
Extract address information from a FramePayload and update the object’s attributes
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: Returns True if all extraction and update operations were successful
- property source_address
Provides read access to the _source_address attribute
- Returns:
int: source address
- property target_address
Provides read access to the _target_address attribute
- Returns:
int: target address
- to_payload() List[int]
Convert the attributes of a FlowControl instance into a binary representation as a FramePayload
- Returns:
list[int]
- class mtf.network_port.iso_tp.custom_fr_tp.fr_tp_frames.AckRetFlowControl
Represent a specific type of flow control in a communication protocol
- __init__(source_address: int = 0, target_address: int = 0, acknowledge: SfAckValues = 0, byte_position: int = 0)
- ACKNOWLEDGE_OFFSET
- BC_OFFSET
- BFS_OFFSET
- BYTE_POSITION_OFFSET
- PCI_OFFSET
- PCI_SIZE_ACK_RET
- PCI_SIZE_CTS
- SRC_ADDR_OFFSET
- TGT_ADDR_OFFSET
- property acknowledge
provides read access to the _acknowledge attribute
- Returns:
SfAckValues: acknowledge
- property address_information
Create a list called payload initialized with zeros
- Returns:
list[int]: contains address information formatted in a specific way
- property bandwidth_control
Provides read access to the _bandwidth_control attribute
- Returns:
int: bandwidth control
- property buffer_size
Provides read access to the _buffer_size attribute
- Returns:
int: buffer size
- property byte_position
Provides read access to the _byte_position attribute
- Returns:
int: byte position
- property flow_status
Provides read access to the _flow_status attribute
- Returns:
FrFlowStatus: flow status
- from_payload(payload: List[int]) bool
Extract and initialize the attributes of a FlowFrame instance from a FramePayload object
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: If this extraction fails, the method returns False
- classmethod get_pci_type(payload: List[int])
Extract and return the PCI type from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
int: returns an integer representing the PCI type, or 0 if the extraction fails
- classmethod get_source_address(payload: List[int]) Tuple[bool, int]
Extract a source address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted source address (if the extraction is successful), otherwise 0
- classmethod get_target_address(payload: List[int]) Tuple[bool, int]
Extract a target address from a FramePayload
- Args:
payload (FramePayload): The payload to be sent
- Returns:
- Tuple[bool, int]: bool: Indicates whether the extraction was successful or not
int: The extracted target address (if the extraction is successful), otherwise 0
- parse_address_information(payload: List[int]) bool
Extract address information from a FramePayload and update the object’s attributes
- Args:
payload (FramePayload): The payload to be sent
- Returns:
bool: Returns True if all extraction and update operations were successful
- property source_address
Provides read access to the _source_address attribute
- Returns:
int: source address
- property target_address
Provides read access to the _target_address attribute
- Returns:
int: target address
- to_payload() List[int]
Convert the attributes of a FlowControl instance into a binary representation as a FramePayload
- Returns:
list[int]