Transport Layer#

class icspacket.proto.dnp3.transport.TPDU(final_segment: bool = False, first_segment: bool = False, sequence: int = 0, app_fragment: bytes = b'')[source]#

Transport Protocol Data Unit (TPDU) representation for DNP3.

This class models the Transport Header defined in IEEE 1815 (DNP3 Specification), Section 8.2.1, as a single-byte prefix that this library attaches to the front of every transport segment, ahead of the Application Layer data it carries.

Its flag bits and sequence number are what let this layer keep segments in order and reassemble them into a complete Application Layer message.

final_segment: bool = False#

True when this segment is the last one making up the message.

first_segment: bool = False#

True when this segment is the first one making up the message.

sequence: int = 0#

Six-bit counter identifying this segment’s place in the sequence, used by the receiver to keep segments in order.

app_fragment: bytes = b''#

Chunk of Application Layer data carried inside this TPDU.

Changed in version 0.2.0: Changed type to bytes in order to support segmentation.

property real_sequence: int#

Return the transport sequence number normalized to the 0-63 range used on the wire, applying the rollover behavior required according to Section 8.2.1.3 of the DNP3 Specification.

Returns:

Normalized sequence number (0-63).

Return type:

int

property apdu: APDU#

Parses the APDU contained in the TPDU.

Added in version 0.2.0.