public void Parse(byte[] headerData, int headerOffset, byte[] bodyData) { Header = new BasicHeaderSegment(); Header.ReadFrom(headerData, headerOffset); if (Header.OpCode != OpCode.ScsiDataIn) { throw new InvalidProtocolException("Invalid opcode in response, expected " + OpCode.ScsiDataIn + " was " + Header.OpCode); } UnpackFlags(headerData[headerOffset + 1]); if (StatusPresent) { Status = (ScsiStatus)headerData[headerOffset + 3]; } Lun = Utilities.ToUInt64BigEndian(headerData, headerOffset + 8); TargetTransferTag = Utilities.ToUInt32BigEndian(headerData, headerOffset + 20); StatusSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 24); ExpectedCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 28); MaxCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 32); DataSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 36); BufferOffset = Utilities.ToUInt32BigEndian(headerData, headerOffset + 40); ResidualCount = Utilities.ToUInt32BigEndian(headerData, headerOffset + 44); ReadData = bodyData; }
public void Parse(byte[] headerData, int headerOffset) { Header = new BasicHeaderSegment(); Header.ReadFrom(headerData, headerOffset); if (Header.OpCode != OpCode.Reject) { throw new InvalidProtocolException("Invalid opcode in response, expected " + OpCode.Reject + " was " + Header.OpCode); } Reason = (RejectReason)headerData[headerOffset + 2]; StatusSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 24); ExpectedCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 28); MaxCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 32); DataSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 36); }
public void Parse(byte[] headerData, int headerOffset) { BasicHeaderSegment _headerSegment = new BasicHeaderSegment(); _headerSegment.ReadFrom(headerData, headerOffset); if (_headerSegment.OpCode != OpCode.LogoutResponse) { throw new InvalidProtocolException("Invalid opcode in response, expected " + OpCode.LogoutResponse + " was " + _headerSegment.OpCode); } Response = (LogoutResponseCode)headerData[headerOffset + 2]; StatusSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 24); ExpectedCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 28); MaxCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 32); Time2Wait = Utilities.ToUInt16BigEndian(headerData, headerOffset + 40); Time2Retain = Utilities.ToUInt16BigEndian(headerData, headerOffset + 42); }
public void Parse(byte[] headerData, int headerOffset, byte[] bodyData) { BasicHeaderSegment _headerSegment = new BasicHeaderSegment(); _headerSegment.ReadFrom(headerData, headerOffset); if (_headerSegment.OpCode != OpCode.TextResponse) { throw new InvalidProtocolException("Invalid opcode in response, expected " + OpCode.TextResponse + " was " + _headerSegment.OpCode); } Continue = (headerData[headerOffset + 1] & 0x40) != 0; _lun = Utilities.ToUInt64BigEndian(headerData, headerOffset + 8); _targetTransferTag = Utilities.ToUInt32BigEndian(headerData, headerOffset + 20); StatusSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 24); ExpectedCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 28); MaxCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 32); TextData = bodyData; }
public void Parse(byte[] headerData, int headerOffset) { Header = new BasicHeaderSegment(); Header.ReadFrom(headerData, headerOffset); if (Header.OpCode != OpCode.ScsiResponse) { throw new InvalidProtocolException("Invalid opcode in response, expected " + OpCode.ScsiResponse + " was " + Header.OpCode); } ResponseCode = headerData[headerOffset + 2]; StatusPresent = true; Status = (ScsiStatus)headerData[headerOffset + 3]; StatusSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 24); ExpectedCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 28); MaxCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 32); ExpectedDataSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 36); BidiReadResidualCount = Utilities.ToUInt32BigEndian(headerData, headerOffset + 40); ResidualCount = Utilities.ToUInt32BigEndian(headerData, headerOffset + 44); }
public void Parse(byte[] headerData, int headerOffset) { StatusPresent = false; Header = new BasicHeaderSegment(); Header.ReadFrom(headerData, headerOffset); if (Header.OpCode != OpCode.ReadyToTransfer) { throw new InvalidProtocolException("Invalid opcode in response, expected " + OpCode.ReadyToTransfer + " was " + Header.OpCode); } Lun = Utilities.ToUInt64BigEndian(headerData, headerOffset + 8); TargetTransferTag = Utilities.ToUInt32BigEndian(headerData, headerOffset + 20); StatusSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 24); ExpectedCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 28); MaxCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 32); ReadyToTransferSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 36); BufferOffset = Utilities.ToUInt32BigEndian(headerData, headerOffset + 40); DesiredTransferLength = Utilities.ToUInt32BigEndian(headerData, headerOffset + 44); }
public void Parse(byte[] headerData, int headerOffset, byte[] bodyData) { BasicHeaderSegment _headerSegment = new BasicHeaderSegment(); _headerSegment.ReadFrom(headerData, headerOffset); if (_headerSegment.OpCode != OpCode.LoginResponse) { throw new InvalidProtocolException("Invalid opcode in response, expected " + OpCode.LoginResponse + " was " + _headerSegment.OpCode); } UnpackState(headerData[headerOffset + 1]); MaxVersion = headerData[headerOffset + 2]; ActiveVersion = headerData[headerOffset + 3]; TargetSessionId = Utilities.ToUInt16BigEndian(headerData, headerOffset + 14); StatusPresent = true; StatusSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 24); ExpectedCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 28); MaxCommandSequenceNumber = Utilities.ToUInt32BigEndian(headerData, headerOffset + 32); StatusClass = headerData[headerOffset + 36]; StatusCode = (LoginStatusCode)Utilities.ToUInt16BigEndian(headerData, headerOffset + 36); TextData = bodyData; }