Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="message">The reason for the exception.</param>
 /// <param name="innerException">The inner exception.</param>
 public ScsiCommandException(string message, Exception innerException)
     : base(message, innerException)
 {
     _status = ScsiStatus.Good;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="status">The SCSI status code.</param>
 /// <param name="message">The reason for the exception.</param>
 /// <param name="senseData">The SCSI sense data.</param>
 public ScsiCommandException(ScsiStatus status, string message, byte[] senseData)
     : base(message)
 {
     _status = status;
     _senseData = senseData;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="status">The SCSI status code.</param>
 /// <param name="message">The reason for the exception.</param>
 public ScsiCommandException(ScsiStatus status, string message)
     : base(message)
 {
     _status = status;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="message">The reason for the exception.</param>
 public ScsiCommandException(string message)
     : base(message)
 {
     _status = ScsiStatus.Good;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="status">The SCSI status code.</param>
 public ScsiCommandException(ScsiStatus status)
 {
     _status = status;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 public ScsiCommandException()
 {
     _status = ScsiStatus.Good;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="status">The SCSI status code.</param>
 /// <param name="message">The reason for the exception.</param>
 /// <param name="innerException">The inner exception.</param>
 public ScsiCommandException(ScsiStatus status, string message, Exception innerException)
     : base(message, innerException)
 {
     _status = status;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="status">The SCSI status code.</param>
 /// <param name="message">The reason for the exception.</param>
 /// <param name="innerException">The inner exception.</param>
 public ScsiCommandException(ScsiStatus status, string message, Exception innerException)
     : base(message, innerException)
 {
     _status = status;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="message">The reason for the exception.</param>
 /// <param name="innerException">The inner exception.</param>
 public ScsiCommandException(string message, Exception innerException)
     : base(message, innerException)
 {
     _status = ScsiStatus.Good;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="status">The SCSI status code.</param>
 /// <param name="message">The reason for the exception.</param>
 /// <param name="senseData">The SCSI sense data.</param>
 public ScsiCommandException(ScsiStatus status, string message, byte[] senseData)
     : base(message)
 {
     _status    = status;
     _senseData = senseData;
 }
Exemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="status">The SCSI status code.</param>
 /// <param name="message">The reason for the exception.</param>
 public ScsiCommandException(ScsiStatus status, string message)
     : base(message)
 {
     _status = status;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="message">The reason for the exception.</param>
 public ScsiCommandException(string message)
     : base(message)
 {
     _status = ScsiStatus.Good;
 }
Exemplo n.º 17
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="status">The SCSI status code.</param>
 public ScsiCommandException(ScsiStatus status)
 {
     _status = status;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 public ScsiCommandException()
 {
     _status = ScsiStatus.Good;
 }
Exemplo n.º 19
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="info">The serialization info.</param>
 /// <param name="context">Ther context.</param>
 protected ScsiCommandException(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _status = (ScsiStatus)info.GetByte("status");
     _senseData = (byte[])info.GetValue("senseData", typeof(byte[]));
 }
Exemplo n.º 20
0
 /// <summary>
 /// Initializes a new instance of the ScsiCommandException class.
 /// </summary>
 /// <param name="info">The serialization info.</param>
 /// <param name="context">Ther context.</param>
 protected ScsiCommandException(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _status    = (ScsiStatus)info.GetByte("status");
     _senseData = (byte[])info.GetValue("senseData", typeof(byte[]));
 }