示例#1
0
  /** {@inheritDoc} */
  @Override
  public final String toString() {

    final StringBuilder sb = new StringBuilder(Constants.LOG_INITIAL_SIZE);

    Utils.printField(sb, "Reson Code", reasonCode.value(), 1);
    Utils.printField(sb, "CID", connectionID, 1);
    sb.append(super.toString());

    return sb.toString();
  }
示例#2
0
  /** {@inheritDoc} */
  @Override
  protected final void checkIntegrity() throws InternetSCSIException {

    String exceptionMessage;
    do {
      Utils.isReserved(logicalUnitNumber);

      if (reasonCode == LogoutReasonCode.CLOSE_SESSION && connectionID != 0) {
        exceptionMessage = "The CID field must be zero, if close session is requested.";
        break;
      }

      if (protocolDataUnit.getBasicHeaderSegment().getTotalAHSLength() != 0) {
        exceptionMessage = "TotalAHSLength must be 0!";
        break;
      }

      if (protocolDataUnit.getBasicHeaderSegment().getDataSegmentLength() != 0) {
        exceptionMessage = "DataSegmentLength must be 0!";
        break;
      }

      // message is checked correctly
      return;
    } while (false);

    throw new InternetSCSIException(exceptionMessage);
  }
示例#3
0
  /** {@inheritDoc} */
  @Override
  protected final void deserializeBytes1to3(final int line) throws InternetSCSIException {

    reasonCode =
        LogoutReasonCode.valueOf(
            (byte) ((line & Constants.SECOND_BYTE_MASK) >>> Constants.TWO_BYTES_SHIFT));
    Utils.isReserved(line & Constants.LAST_TWO_BYTES_MASK);
  }
示例#4
0
  /** {@inheritDoc} */
  @Override
  protected final void deserializeBytes20to23(final int line) throws InternetSCSIException {

    connectionID = (short) ((line & Constants.FIRST_TWO_BYTES_MASK) >>> Constants.TWO_BYTES_SHIFT);
    Utils.isReserved(line & Constants.LAST_TWO_BYTES_MASK);
  }