public class SCSIResponseParser extends TargetMessageParser
This class parses a SCSI Response message defined in the iSCSI Standard (RFC3720).
1 for every response/status sent on a connection except for responses sent as a
result of a retry or SNACK. In the case of responses sent due to a retransmission request, the StatSN MUST
be the same as the first time the PDU was sent unless the connection has since been restarted.
MaxCmdSN + 1 indicates that the target cannot accept new
commands.
ExpCmdSN - 1, this indicates to the
initiator that the target cannot receive any additional commands. When MaxCmdSN changes at the target while
the target has no pending PDUs to convey this information to the initiator, it MUST generate a NOP-IN to
carry the new MaxCmdSN.
iSCSI targets MUST support and enable autosense. If Status is CHECK CONDITION (0x02), then the
Data Segment MUST contain sense data for the failed command. | Modifier and Type | Class and Description |
|---|---|
static class |
SCSIResponseParser.ServiceResponse
This enumerations defines all valid service responses, which are defined
in the iSCSI Standard (RFC 3720).
|
expectedCommandSequenceNumber, maximumCommandSequenceNumber, statusSequenceNumberlogicalUnitNumber, protocolDataUnit| Constructor and Description |
|---|
SCSIResponseParser(ProtocolDataUnit initProtocolDataUnit)
Default constructor, creates a new, empty
SCSIResponseParser object. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkIntegrity()
This method checks, if all parsed fields are valid.
|
void |
clear()
This method sets all settings to their initial values.
|
protected void |
deserializeBytes1to3(int line)
Parse the bytes
1 till 3 in the Basic Header
Segment. |
protected void |
deserializeBytes20to23(int line)
Parse the bytes
20 till 23 in the Basic Header
Segment. |
protected void |
deserializeBytes36to39(int line)
Parse the bytes
36 till 39 in the Basic Header
Segment. |
protected void |
deserializeBytes40to43(int line)
Parse the bytes
40 till 43 in the Basic Header
Segment. |
protected void |
deserializeBytes44to47(int line)
Parse the bytes
44 till 47 in the Basic Header
Segment. |
int |
getBidirectionalReadResidualCount()
The Bidirectional Read Residual Count field MUST be valid in the case
where either the u bit or the o bit is set.
|
DataSegmentFactory.DataSegmentFormat |
getDataSegmentFormat()
If this method returns
true, hen it indicates that the data
segment data is interpreted as binary data. |
int |
getExpectedDataSequenceNumber()
The number of R2T and Data-In (read) PDUs the target has sent for the
command.
|
int |
getResidualCount()
The Residual Count field MUST be valid in the case where either the U bit
or the O bit is set.
|
SCSIResponseParser.ServiceResponse |
getResponse()
This field contains the iSCSI service response.
|
int |
getSNACKTag()
This field contains a copy of the SNACK Tag of the last SNACK Tag
accepted by the target on the same connection and for the command for
which the response is issued.
|
SCSIStatus |
getStatus()
The Status field is used to report the SCSI status of the command (as
specified in [SAM2]) and is only valid if the Response Code is Command
Completed at target.
|
boolean |
isBidirectionalReadResidualOverflow()
Returns the status of the Bidirectional Read Residual Overflow flag.
|
boolean |
isBidirectionalReadResidualUnderflow()
Returns the status of the Bidirectional Read Residual Underflow flag.
|
boolean |
isResidualOverflow()
Returns the status of the Residual Overflow flag.
|
boolean |
isResidualUnderflow()
Returns the status of the Residual Underflow flag.
|
protected int |
serializeBytes1to3()
Serializes the bytes
1 till 3 in the Basic
Header Segment. |
protected int |
serializeBytes20to23()
Serializes the bytes
20 till 23 in the Basic
Header Segment. |
protected int |
serializeBytes36to39()
Serializes the bytes
36 till 39 in the Basic
Header Segment. |
protected int |
serializeBytes40to43()
Serializes the bytes
40 till 43 in the Basic
Header Segment. |
protected int |
serializeBytes44to47()
Serializes the bytes
44 till 47 in the Basic
Header Segment. |
void |
setBidirectionalReadResidualCount(int bidirectionalReadResidualCount) |
void |
setBidirectionalReadResidualOverflow(boolean bidirectionalReadResidualOverflow) |
void |
setBidirectionalReadResidualUnderflow(boolean bidirectionalReadResidualUnderflow) |
void |
setExpectedDataSequenceNumber(int expectedDataSequenceNumber) |
void |
setResidualCount(int residualCount) |
void |
setResidualOverflow(boolean residualOverflow) |
void |
setResidualUnderflow(boolean residualUnderflow) |
void |
setResponse(SCSIResponseParser.ServiceResponse response) |
void |
setSNACKTag(int snackTag) |
void |
setStatus(SCSIStatus status) |
String |
toString()
This method concatenate all the fields of a derived parser to allow an
easy generation of debug informations.
|
deserializeBytes24to27, deserializeBytes28to31, deserializeBytes32to35, getExpectedCommandSequenceNumber, getMaximumCommandSequenceNumber, getShortInfo, getStatusSequenceNumber, incrementSequenceNumber, serializeBytes24to27, serializeBytes28to31, serializeBytes32to35, setExpectedCommandSequenceNumber, setMaximumCommandSequenceNumber, setStatusSequenceNumbercanContainAdditionalHeaderSegments, canHaveDigests, deserializeBytes12to15, deserializeBytes8to11, getLogicalUnitNumber, serializeBytes12to15, serializeBytes8to11, setLogicalUnitNumberpublic SCSIResponseParser(ProtocolDataUnit initProtocolDataUnit)
SCSIResponseParser object.initProtocolDataUnit - The reference ProtocolDataUnit instance, which
contains this SCSIResponseParser subclass object.public final String toString()
toString in class TargetMessageParserpublic final DataSegmentFactory.DataSegmentFormat getDataSegmentFormat()
true, hen it indicates that the data
segment data is interpreted as binary data. Else the data segment data
must be interpreted as Text Format.getDataSegmentFormat in class AbstractMessageParserDataSegmentFactory.DataSegmentFormatpublic final void clear()
clear in class TargetMessageParserpublic final int getBidirectionalReadResidualCount()
SCSIResponseParser object.public final int getExpectedDataSequenceNumber()
This field MUST be 0 if the response code is not Command Completed at Target or the target
sent no Data-In PDUs for the command.
SCSIResponseParser object.public final boolean isBidirectionalReadResidualOverflow()
true, if it is set; else false.public final boolean isBidirectionalReadResidualUnderflow()
true, if it is set; else false.public final int getResidualCount()
SCSIResponseParser object.public final boolean isResidualOverflow()
true, if it is set; else false.public final boolean isResidualUnderflow()
true, if it is set; else false.public final SCSIResponseParser.ServiceResponse getResponse()
All other response codes are reserved.
The Response is used to report a Service Response. The mapping of the response code into a SCSI service response code value, if needed, is outside the scope of this document. However, in symbolic terms response value 0x00 maps to the SCSI service response (see [SAM2] and [SPC3]) of TASK COMPLETE or LINKED COMMAND COMPLETE. All other Response values map to the SCSI service response of SERVICE DELIVERY OR TARGET FAILURE.
If a PDU that includes SCSI status (Response PDU or Data-In PDU including status) does not arrive before the session is terminated, the SCSI service response is SERVICE DELIVERY OR TARGET FAILURE. A non-zero Response field indicates a failure to execute the command in which case the Status and Flag fields are undefined.
SCSIResponseParser object.SCSIResponseParser.ServiceResponsepublic final int getSNACKTag()
0.
After issuing a R-Data SNACK the initiator must discard any SCSI status unless contained in an SCSI Response PDU carrying the same SNACK Tag as the last issued R-Data SNACK for the SCSI command on the current connection.
For a detailed discussion on R-Data SNACK see Section 10.16 SNACK Request.
SCSIResponseParser object.public final SCSIStatus getStatus()
SCSIResponseParser object.SCSIStatuspublic final void setBidirectionalReadResidualCount(int bidirectionalReadResidualCount)
public final void setBidirectionalReadResidualOverflow(boolean bidirectionalReadResidualOverflow)
public final void setBidirectionalReadResidualUnderflow(boolean bidirectionalReadResidualUnderflow)
public final void setExpectedDataSequenceNumber(int expectedDataSequenceNumber)
public final void setResidualCount(int residualCount)
public final void setResidualOverflow(boolean residualOverflow)
public final void setResidualUnderflow(boolean residualUnderflow)
public void setResponse(SCSIResponseParser.ServiceResponse response)
public final void setSNACKTag(int snackTag)
public final void setStatus(SCSIStatus status)
protected final void deserializeBytes1to3(int line)
throws InternetSCSIException
1 till 3 in the Basic Header
Segment.deserializeBytes1to3 in class TargetMessageParserline - The actual lineInternetSCSIException - If any violation of the iSCSI-Standard emerge.protected final void deserializeBytes20to23(int line)
throws InternetSCSIException
20 till 23 in the Basic Header
Segment.deserializeBytes20to23 in class TargetMessageParserline - The actual lineInternetSCSIException - If any violation of the iSCSI-Standard emerge.protected final void deserializeBytes36to39(int line)
throws InternetSCSIException
36 till 39 in the Basic Header
Segment.deserializeBytes36to39 in class TargetMessageParserline - The actual lineInternetSCSIException - If any violation of the iSCSI-Standard emerge.protected final void deserializeBytes40to43(int line)
throws InternetSCSIException
40 till 43 in the Basic Header
Segment.deserializeBytes40to43 in class TargetMessageParserline - The actual lineInternetSCSIException - If any violation of the iSCSI-Standard emerge.protected final void deserializeBytes44to47(int line)
throws InternetSCSIException
44 till 47 in the Basic Header
Segment.deserializeBytes44to47 in class TargetMessageParserline - The actual lineInternetSCSIException - If any violation of the iSCSI-Standard emerge.protected final void checkIntegrity()
throws InternetSCSIException
checkIntegrity in class AbstractMessageParserInternetSCSIException - If the integrity is violated.protected final int serializeBytes1to3()
1 till 3 in the Basic
Header Segment.serializeBytes1to3 in class TargetMessageParserprotected final int serializeBytes20to23()
20 till 23 in the Basic
Header Segment.serializeBytes20to23 in class TargetMessageParserprotected final int serializeBytes36to39()
36 till 39 in the Basic
Header Segment.serializeBytes36to39 in class TargetMessageParserprotected final int serializeBytes40to43()
40 till 43 in the Basic
Header Segment.serializeBytes40to43 in class TargetMessageParserprotected final int serializeBytes44to47()
44 till 47 in the Basic
Header Segment.serializeBytes44to47 in class TargetMessageParserCopyright © 2013 University of Konstanz, Distributed Systems Group. All Rights Reserved.