Fundamentals of distributed network protocol 99 TSDU 1 - 2048 Bytes Data block from application layer. This is a fragment. TPDU TPDU TH TH 1 249 1 249 This TSDU is broken down into multiple TPDUs each containing a 1 byte header and up to 249 bytes of user data. Each TPDU will fit into one frame format in the DataLlink Layer. Figure 5.19 Transport protocol data unit In a receiving, or secondary station, the incoming TPDUs are reformed into the TSDU for use by the application layer. The transport header bytes are stripped off and the TSDU is reformed from the multiple TPDMs. The transport layer is responsible for ensuring that the TSDU is reassembled in the correct sequence. 5.5.3 The transport header The single byte transport header contains two bits that identify the start and end of a sequence of frames (TPDUs), plus a six-bit sequence counter. FIN FIR SEQUENCE Bit 7 6 5 4 3 2 1 0 FIN FIR Final Frame First Frame FIN FIR 0 1 0 0 1 0 1 1 First of Multiple Frames Not First , Not Last Final Frame One Frame Message Figure 5.20 Transport header byte Rules • If a secondary station receives a frame with the FIR bit set, any previous incomplete sequence of frames is discarded • If a frame is received without the FIR bit set, and no sequence is in progress, then this frame is ignored
100 Practical Modern SCADA Protocols: DNP3, 60870.5 andRelatedSystems • Sequence number may be any value 0–63 for first frame, and must increment for each frame in the sequence thereafter • Sequence number rolls over from 63 to 0 5.5.4 Summary of transport layer Summary • Takes TSDU fragments up to 2048 bytes and breaks them into multiple TPDUs • Includes a 1 byte header • TPDU can carry 249 bytes of user data • The TPDU can fit into one FT3 frame format (LSDU) • Header has FIR and FIN bits and 6-bit sequence number • Passes TPDUs to and from data link layer • Assembles incoming TPDUs into TSDU 5.6 Application layer message handling 5.6.1 Description of the application layer The application layer is the highest level of the protocol, and communicates directly with the user application program. Master stations generate application level request messages for transmission to outstations, and outstations generate application level responses for transmission to the master station. These messages may contain commands, or requests for provision of data, or they may perform other functions such as time synchronization. Summary • Forms request messages to outstations • Request messages may be commands, send data, or request data • Accepts data from user application to send to master or to outstation • Breaks user data down into multiple ASDUs • Adds control information (APCI) to form APDUs • Multiple APDUs are called fragments • Fragments do not exceed 2048 bytes • Fragments contain data objects • Each fragment must be processable on its own The fragment size and data content requirements have been specified so that a fragment is always processable on its own. This means that a fragment buffer size of 2048 bytes should be sufficient to allow receipt of a fully processable piece of information. The buffer can then be left empty for receipt of the next fragment. 5.6.2 Application message sequences At the application level, there are two basic message types in DNP3. These are requests and responses. Only a master station can send a request, and only an outstation can send a response. However, there is a special class of response called an ‘unsolicited response’. This allows an outstation to send information to a master station or to a peer (another nonmaster station).