//..............................................................................
//
// Modbus TCP stream parser
//

class ModbusTcpParser: ModbusBinParserBase {
public:
	construct(ModbusInfoSet* infoSet) {
		basetype.construct(io.ModbusProtocol.Tcp, infoSet);
	}

protected:
	override jnc.Promise* layoutPacket() {
		return io.layoutModbusAdu(m_packet, io.ModbusProtocol.Tcp, m_modbusRole);
	}

	override uint64_t getPacketRecordCode() {
		return m_modbusRole == io.ModbusRole.Master ?
			ModbusLogRecordCode.Packet_tcp_master  :
			ModbusLogRecordCode.Packet_tcp_slave;
	}
}

//..............................................................................
