Package org.jscsi.parser.nop

Examples of org.jscsi.parser.nop.NOPOutParser


    @Override
    public void execute (final ProtocolDataUnit pdu) throws IOException , InterruptedException , InternetSCSIException , DigestException , SettingsException {

        final BasicHeaderSegment bhs = pdu.getBasicHeaderSegment();
        final NOPOutParser parser = (NOPOutParser) bhs.getParser();

        if (parser.getTargetTransferTag() != RESERVED_TAG_VALUE) {
            /*
             * This is an error. The jSCSI Target does not send NOP-In ping messages, which would be the only legal
             * reason for the initiator sending a NOP-Out with the TargetTransferTag equal to 0xffffffff. And even if
             * the jSCSI Target was sending pings, the echo would be processed in a dedicated stage. Therefore, we treat
             * this as an error. Close the connection.
             */
            throw new InternetSCSIException("NOP-Out PDU TargetTransferTag = " + parser.getTargetTransferTag() + " in PingStage");
        }

        // decide whether or not response is necessary
        if (bhs.getInitiatorTaskTag() == RESERVED_TAG_VALUE) return;// send no response

        // else
        // prepare response data segment (copy up to initiator's
        // MaxRecvDataSegmentLength)
        final int dataSegmentLength = Math.min(pdu.getDataSegment().capacity(), settings.getMaxRecvDataSegmentLength());
        final ByteBuffer responseDataSegment = ByteBuffer.allocate(dataSegmentLength);
        responseDataSegment.put(pdu.getDataSegment().array(),// source array,
                0,// offset within the array of the first byte to be read
                dataSegmentLength);// length

        // send response
        final ProtocolDataUnit responsePdu = TargetPduFactory.createNopInPDU(0,// logicalUnitNumber,
                                                                               // reserved
                bhs.getInitiatorTaskTag(),// initiatorTaskTag
                RESERVED_TAG_VALUE,// targetTransferTag
                responseDataSegment, parser.getExpectedStatusSequenceNumber());
        connection.sendPdu(responsePdu);
    }
View Full Code Here


            case SCSI_DATA_OUT :
                return new DataOutParser(protocolDataUnit);
            case SCSI_DATA_IN :
                return new DataInParser(protocolDataUnit);
            case NOP_OUT :
                return new NOPOutParser(protocolDataUnit);
            case NOP_IN :
                return new NOPInParser(protocolDataUnit);
            case R2T :
                return new Ready2TransferParser(protocolDataUnit);
            case REJECT :
View Full Code Here

TOP

Related Classes of org.jscsi.parser.nop.NOPOutParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.