Examples of IDataSegment


Examples of org.jscsi.parser.datasegment.IDataSegment

        scsi.setExpectedDataTransferLength(expectedDataTransferLength);

        final int maxRecvDataSegmentLength = connection.getSettingAsInt(OperationalTextKey.MAX_RECV_DATA_SEGMENT_LENGTH);
        scsi.setCommandDescriptorBlock(SCSICommandDescriptorBlockParser.createWriteMessage(logicalBlockAddress, transferLength));

        final IDataSegment dataSegment = DataSegmentFactory.create(buffer, bufferPosition, expectedDataTransferLength, DataSegmentFormat.BINARY, maxRecvDataSegmentLength);
        final IDataSegmentIterator iterator = dataSegment.iterator();
        int bufferOffset = 0;

        if (connection.getSettingAsBoolean(OperationalTextKey.IMMEDIATE_DATA)) {
            final int min = Math.min(maxRecvDataSegmentLength, connection.getSettingAsInt(OperationalTextKey.FIRST_BURST_LENGTH));
            protocolDataUnit.setDataSegment(iterator.next(min));
View Full Code Here

Examples of org.jscsi.parser.datasegment.IDataSegment

     *
     * @param etherealLog A <code>ByteBuffer</code>, which contains an Ethereal log.
     */
    protected final void testDataSegment (final ByteBuffer etherealLog) {

        IDataSegment dataSegment = DataSegmentFactory.create(etherealLog, recognizedParser.getDataSegmentFormat(), chunkSize);

        testDataSegment(dataSegment);
    }
View Full Code Here

Examples of org.jscsi.parser.datasegment.IDataSegment

     * @param expectedDataSegment Uses this data segment for comparsion.
     *
     */
    protected final void testDataSegment (final IDataSegment expectedDataSegment) {

        IDataSegment testDataSegment = DataSegmentFactory.create(protocolDataUnit.getDataSegment(), recognizedParser.getDataSegmentFormat(), chunkSize);
        assertTrue(expectedDataSegment.equals(testDataSegment));
    }
View Full Code Here

Examples of org.jscsi.parser.datasegment.IDataSegment

        final TextRequestParser parser = (TextRequestParser) protocolDataUnit.getBasicHeaderSegment().getParser();

        final SettingsMap settings = new SettingsMap();
        settings.add(OperationalTextKey.SEND_TARGETS, "");

        final IDataSegment dataSegment = DataSegmentFactory.create(settings.asByteBuffer(), DataSegmentFormat.TEXT, connection.getSettingAsInt(OperationalTextKey.MAX_RECV_DATA_SEGMENT_LENGTH));

        int bytes2Process = dataSegment.getLength();
        for (IDataSegmentIterator dataSegmentIterator = dataSegment.iterator(); dataSegmentIterator.hasNext();) {
            IDataSegmentChunk dataSegmentChunk = dataSegmentIterator.next(bytes2Process);
            protocolDataUnit.setDataSegment(dataSegmentChunk);
            parser.setTargetTransferTag(0xFFFFFFFF);
        }
View Full Code Here

Examples of org.jscsi.parser.datasegment.IDataSegment

    /** {@inheritDoc} */
    public final void execute () throws InternetSCSIException {

        ProtocolDataUnit protocolDataUnit;
        final IDataSegment loginResponse = DataSegmentFactory.create(DataSegmentFormat.TEXT, connection.getSettingAsInt(OperationalTextKey.MAX_RECV_DATA_SEGMENT_LENGTH));

        do {
            protocolDataUnit = connection.receive();

            if (!(protocolDataUnit.getBasicHeaderSegment().getParser() instanceof LoginResponseParser)) {
                break;
            }

            loginResponse.append(protocolDataUnit.getDataSegment(), protocolDataUnit.getBasicHeaderSegment().getDataSegmentLength());
        } while (!protocolDataUnit.getBasicHeaderSegment().isFinalFlag());
        // extract Target Session Handle Identifying Handle
        final LoginResponseParser parser = (LoginResponseParser) protocolDataUnit.getBasicHeaderSegment().getParser();
        connection.getSession().setTargetSessionIdentifyingHandle(parser.getTargetSessionIdentifyingHandle());
        // Set the Expected Status Sequence Number to the initial value received
        // from the target. Then add the constant 2 to this value, because the
        // incrementExpectedStatusSequence() method was already invoked.
        connection.setExpectedStatusSequenceNumber(parser.getStatusSequenceNumber() + 1);// TODO was +2

        // check parameters....
        LOGGER.info("Retrieving these login parameters:\n" + loginResponse.getSettings());

        connection.update(loginResponse.getSettings());

        LOGGER.info("Updated settings to these:\n" + connection.getSettings());
        LOGGER.info("Nextstage is : " + nextStage);

        // is a transit to the next stage possible
View Full Code Here

Examples of org.jscsi.parser.datasegment.IDataSegment

        LoginRequestParser loginRequest;
        boolean continueFlag;
        // here the finalFlag represents the transitFlag
        boolean finalFlag;
        final IDataSegment dataSegment = DataSegmentFactory.create(loginParameters.asByteBuffer(), DataSegmentFormat.TEXT, maxRecvDataSegmentLength);
        final IDataSegmentIterator iterator = dataSegment.iterator();
        final Queue<ProtocolDataUnit> protocolDataUnits = new LinkedList<ProtocolDataUnit>();

        IDataSegmentChunk dataSegmentChunk;
        ProtocolDataUnit protocolDataUnit;
        int bytes2Transfer = dataSegment.getLength();

        while (bytes2Transfer > 0 && iterator.hasNext()) {

            if (bytes2Transfer <= maxRecvDataSegmentLength) {
                // last PDU to send...
View Full Code Here

Examples of org.jscsi.parser.datasegment.IDataSegment

    /** {@inheritDoc} */
    public void execute () throws InternetSCSIException {

        ProtocolDataUnit protocolDataUnit;
        final IDataSegment textResponse = DataSegmentFactory.create(DataSegmentFormat.TEXT, connection.getSettingAsInt(OperationalTextKey.MAX_RECV_DATA_SEGMENT_LENGTH));

        do {
            protocolDataUnit = connection.receive();

            if (!(protocolDataUnit.getBasicHeaderSegment().getParser() instanceof TextResponseParser)) {
                break;
            }

            textResponse.append(protocolDataUnit.getDataSegment(), protocolDataUnit.getBasicHeaderSegment().getDataSegmentLength());
        } while (!protocolDataUnit.getBasicHeaderSegment().isFinalFlag());

        // extract Target Session Handle Identifying Handle
        // final TextResponseParser parser = (TextResponseParser)
        // protocolDataUnit.getBasicHeaderSegment().getParser();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.