| 1 | |
package org.jscsi.target.connection.stage.fullfeature; |
| 2 | |
|
| 3 | |
|
| 4 | |
import java.io.IOException; |
| 5 | |
import java.security.DigestException; |
| 6 | |
|
| 7 | |
import org.jscsi.exception.InternetSCSIException; |
| 8 | |
import org.jscsi.parser.BasicHeaderSegment; |
| 9 | |
import org.jscsi.parser.InitiatorMessageParser; |
| 10 | |
import org.jscsi.parser.ProtocolDataUnit; |
| 11 | |
import org.jscsi.target.connection.phase.TargetFullFeaturePhase; |
| 12 | |
import org.jscsi.target.scsi.cdb.ScsiOperationCode; |
| 13 | |
import org.jscsi.target.scsi.sense.senseDataDescriptor.senseKeySpecific.FieldPointerSenseKeySpecificData; |
| 14 | |
import org.jscsi.target.settings.SettingsException; |
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
public class UnsupportedOpCodeStage extends TargetFullFeatureStage { |
| 27 | |
|
| 28 | |
public UnsupportedOpCodeStage (TargetFullFeaturePhase targetFullFeaturePhase) { |
| 29 | 0 | super(targetFullFeaturePhase); |
| 30 | 0 | } |
| 31 | |
|
| 32 | |
@Override |
| 33 | |
public void execute (ProtocolDataUnit pdu) throws IOException , InterruptedException , InternetSCSIException , DigestException , SettingsException { |
| 34 | |
|
| 35 | 0 | final BasicHeaderSegment bhs = pdu.getBasicHeaderSegment(); |
| 36 | 0 | final InitiatorMessageParser parser = (InitiatorMessageParser) bhs.getParser(); |
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | 0 | final FieldPointerSenseKeySpecificData fp = new FieldPointerSenseKeySpecificData(true, |
| 41 | |
true, |
| 42 | |
false, |
| 43 | |
0, |
| 44 | |
0); |
| 45 | |
|
| 46 | 0 | final FieldPointerSenseKeySpecificData[] fpArray = new FieldPointerSenseKeySpecificData[] { fp }; |
| 47 | |
|
| 48 | |
|
| 49 | 0 | int essn = -1; |
| 50 | |
|
| 51 | 0 | if (parser != null) { |
| 52 | 0 | essn = parser.getExpectedStatusSequenceNumber(); |
| 53 | |
} |
| 54 | |
|
| 55 | 0 | final ProtocolDataUnit responsePdu = createFixedFormatErrorPdu(fpArray, |
| 56 | |
bhs.getInitiatorTaskTag(), |
| 57 | |
essn); |
| 58 | |
|
| 59 | |
|
| 60 | 0 | connection.sendPdu(responsePdu); |
| 61 | 0 | } |
| 62 | |
|
| 63 | |
} |