public final class SNACKRequestParser extends InitiatorMessageParser
This class parses a SNACK Request message defined in the iSCSI Standard (RFC3720).
If the implementation supports ErrorRecoveryLevel greater than zero, it MUST support all SNACK types.
The SNACK is used by the initiator to request the retransmission of numbered-responses, data, or R2T PDUs
from the target. The SNACK request indicates the numbered-responses or data "runs" whose retransmission is
requested by the target, where the run starts with the first StatSN, DataSN, or R2TSN whose retransmission
is requested and indicates the number of Status, Data, or R2T PDUs requested including the first.
0 has special meaning when used as a starting number and length:
The numbered Data-In PDUs, requested by a Data SNACK MUST be delivered as exact replicas of the ones that the target transmitted originally except for the fields ExpCmdSN and MaxCmdSN, which MUST carry the current values and except for resegmentation (see Section 10.16.3 Resegmentation).
Any SNACK that requests a numbered-response, Data, or R2T that was not sent by the target or was already acknowledged by the initiator, MUST be rejected with a reason code of "Protocol error".
1 or higher, it
MUST issue a SNACK of type DataACK after receiving a Data-In PDU with the A bit set to 1.
However, if the initiator has detected holes in the input sequence, it MUST postpone issuing the SNACK of
type DataACK until the holes are filled. An initiator MAY ignore the A bit if it deems that the bit is
being set aggressively by the target (i.e., before the MaxBurstLength limit is reached).
The DataACK is used to free resources at the target and not to request or imply data retransmission.
An initiator MUST NOT request retransmission for any data it had already acknowledged.
A target that has received a R-Data SNACK MUST return a SCSI Response that contains a copy of the SNACK Tag field from the R-Data SNACK in the SCSI Response SNACK Tag field as its last or only Response. For example, if it has already sent a response containing another value in the SNACK Tag field or had the status included in the last Data-In PDU, it must send a new SCSI Response PDU. If a target sends more than one SCSI Response PDU due to this rule, all SCSI responses must carry the same StatSN (see Section 10.4.4 SNACK Tag). If an initiator attempts to recover a lost SCSI Response (with a Status SNACK, see Section 10.16.1 Type) when more than one response has been sent, the target will send the SCSI Response with the latest content known to the target, including the last SNACK Tag for the command.
For considerations in allegiance reassignment of a task to a connection with a different MaxRecvDataSegmentLength, refer to Section 6.2.2 Allegiance Reassignment.
0xffffffff. In all other cases, the Initiator Task Tag field MUST be set to the
Initiator Task Tag of the referenced command.
| Modifier and Type | Class and Description |
|---|---|
static class |
SNACKRequestParser.SNACKType
This enumeration defines all valid SNACK types.
|
commandSequenceNumber, expectedStatusSequenceNumberlogicalUnitNumber, protocolDataUnit| Constructor and Description |
|---|
SNACKRequestParser(ProtocolDataUnit initProtocolDataUnit)
Default constructor, creates a new, empty
SNACKRequestParser 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 |
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 |
getBegRun()
The
DataSN, R2TSN, or StatSN of
the first PDU whose retransmission is requested (Data/R2T and Status
SNACK), or the next expected DataSN (DataACK SNACK). |
DataSegmentFactory.DataSegmentFormat |
getDataSegmentFormat()
If this method returns
true, hen it indicates that the data
segment data is interpreted as binary data. |
int |
getRunLength()
The number of PDUs whose retransmission is requested.
|
int |
getTargetTransferTag()
For an R-Data SNACK, this field MUST contain a value that is different
from
0 or 0xffffffff and is unique for the task
(identified by the Initiator Task Tag). |
SNACKRequestParser.SNACKType |
getType()
Returns the SNACK Function Code of this
SNACKRequestParser object. |
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 |
serializeBytes24to27()
Serializes the bytes
24 till 27 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 |
setBegRun(int newBegRun)
Sets the
begRun variable to the given new value. |
void |
setRunLength(int newRunLength)
Sets the Run Length to the given value.
|
void |
setTargetTransferTag(int newTargetTransferTag)
Sets the Target Transfer Tag to the given value.
|
void |
setType(SNACKRequestParser.SNACKType newType)
Sets the type of this SNACKRequest to the given value.
|
String |
toString()
This method concatenate all the fields of a derived parser to allow an
easy generation of debug informations.
|
deserializeBytes24to27, deserializeBytes28to31, deserializeBytes32to35, deserializeBytes36to39, getCommandSequenceNumber, getExpectedStatusSequenceNumber, getShortInfo, incrementSequenceNumber, serializeBytes28to31, serializeBytes32to35, serializeBytes36to39, setCommandSequenceNumber, setExpectedStatusSequenceNumbercanContainAdditionalHeaderSegments, canHaveDigests, deserializeBytes12to15, deserializeBytes8to11, getLogicalUnitNumber, serializeBytes12to15, serializeBytes8to11, setLogicalUnitNumberpublic SNACKRequestParser(ProtocolDataUnit initProtocolDataUnit)
SNACKRequestParser object.initProtocolDataUnit - The reference ProtocolDataUnit instance, which
contains this SNACKRequestParser subclass object.public final int getBegRun()
DataSN, R2TSN, or StatSN of
the first PDU whose retransmission is requested (Data/R2T and Status
SNACK), or the next expected DataSN (DataACK SNACK).
BegRun 0 when used in conjunction with RunLength 0
means resend all unacknowledged Data-In, R2T or Response PDUs.
BegRun MUST be 0 for a R-Data SNACK.
SNACKRequestParser obejct.public final int getRunLength()
RunLength 0 signals that all Data-In, R2T, or Response PDUs carrying the
numbers equal to or greater than BegRun have to be resent.
The RunLength MUST also be 0 for a DataACK SNACK in addition to R-Data SNACK.
SNACKRequestParser object.public final int getTargetTransferTag()
0 or 0xffffffff and is unique for the task
(identified by the Initiator Task Tag). This value MUST be copied by the
iSCSI target in the last or only SCSI Response PDU it issues for the
command.
For DataACK, the Target Transfer Tag MUST contain a copy of the Target Transfer Tag and
LUN provided with the SCSI Data-In PDU with the A bit set to 1.
In all other cases, the Target Transfer Tag field MUST be set to the reserved value of
0xffffffff.
SNACKRequestParser object.public final SNACKRequestParser.SNACKType getType()
SNACKRequestParser object.SNACKRequestParser object.SNACKRequestParser.SNACKTypepublic final void setBegRun(int newBegRun)
begRun variable to the given new value.newBegRun - The new value.public final void setRunLength(int newRunLength)
newRunLength - The new value.public final void setTargetTransferTag(int newTargetTransferTag)
newTargetTransferTag - The new value.public final void setType(SNACKRequestParser.SNACKType newType)
newType - The new value.public final String toString()
toString in class InitiatorMessageParserpublic 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 InitiatorMessageParserprotected final void deserializeBytes1to3(int line)
throws InternetSCSIException
1 till 3 in the Basic Header
Segment.deserializeBytes1to3 in class InitiatorMessageParserline - 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 InitiatorMessageParserline - 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 InitiatorMessageParserline - 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 InitiatorMessageParserline - 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 InitiatorMessageParserprotected final int serializeBytes20to23()
20 till 23 in the Basic
Header Segment.serializeBytes20to23 in class InitiatorMessageParserprotected final int serializeBytes24to27()
24 till 27 in the Basic
Header Segment.serializeBytes24to27 in class InitiatorMessageParserprotected final int serializeBytes40to43()
40 till 43 in the Basic
Header Segment.serializeBytes40to43 in class InitiatorMessageParserprotected final int serializeBytes44to47()
44 till 47 in the Basic
Header Segment.serializeBytes44to47 in class InitiatorMessageParserCopyright © 2013 University of Konstanz, Distributed Systems Group. All Rights Reserved.