/** {@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(); }
/** {@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); }
/** {@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); }
/** {@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); }