CPD Results

The following document contains the results of PMD's CPD[1] 7.17.0.

Duplications

File Line
org/metricshub/ipmi/core/sm/states/OpenSessionWaiting.java 61[2]
org/metricshub/ipmi/core/sm/states/Rakp3Waiting.java 83[3]
stateMachine.setCurrent(new OpenSessionComplete());
		} else if (machineEvent instanceof Timeout) {
			stateMachine.setCurrent(new Authcap());
		} else {
			stateMachine.doExternalAction(new ErrorAction(new IllegalArgumentException("Invalid transition")));
		}
	}

	@Override
	public void doAction(StateMachine stateMachine, RmcpMessage message) {
		if (ProtocolDecoder.decodeAuthenticationType(message) != AuthenticationType.RMCPPlus) {
			return; // this isn't IPMI v2.0 message so we ignore it
		}
		PlainCommandv20Decoder decoder = new PlainCommandv20Decoder(CipherSuite.getEmpty());
		if (Protocolv20Decoder.decodePayloadType(message.getData()[1]) != PayloadType.RmcpOpenSessionResponse) {
File Line
org/metricshub/ipmi/core/coding/commands/sdr/GetSdr.java 87[4]
org/metricshub/ipmi/core/coding/commands/sel/GetSelEntry.java 63[5]
}

	@Override
	public NetworkFunction getNetworkFunction() {
		return NetworkFunction.StorageRequest;
	}

	@Override
	protected IpmiPayload preparePayload(int sequenceNumber) throws NoSuchAlgorithmException, InvalidKeyException {
		byte[] payload = new byte[6];

		byte[] buffer = TypeConverter.intToByteArray(reservationId);

		payload[0] = buffer[3];
		payload[1] = buffer[2]; // reservation ID

		buffer = TypeConverter.intToByteArray(recordId);

		payload[2] = buffer[3];
		payload[3] = buffer[2]; // record ID

		payload[4] = TypeConverter.intToByte(offset);
File Line
org/metricshub/ipmi/core/sm/states/OpenSessionWaiting.java 61[2]
org/metricshub/ipmi/core/sm/states/Rakp1Waiting.java 71[6]
org/metricshub/ipmi/core/sm/states/Rakp3Waiting.java 83[3]
stateMachine.setCurrent(new OpenSessionComplete());
		} else if (machineEvent instanceof Timeout) {
			stateMachine.setCurrent(new Authcap());
		} else {
			stateMachine.doExternalAction(new ErrorAction(new IllegalArgumentException("Invalid transition")));
		}
	}

	@Override
	public void doAction(StateMachine stateMachine, RmcpMessage message) {
		if (ProtocolDecoder.decodeAuthenticationType(message) != AuthenticationType.RMCPPlus) {
			return; // this isn't IPMI v2.0 message so we ignore it
		}
		PlainCommandv20Decoder decoder = new PlainCommandv20Decoder(CipherSuite.getEmpty());
		if (Protocolv20Decoder.decodePayloadType(message.getData()[1]) != PayloadType.RmcpOpenSessionResponse) {
File Line
org/metricshub/ipmi/core/coding/commands/fru/record/BoardInfo.java 104[7]
org/metricshub/ipmi/core/coding/commands/fru/record/ProductInfo.java 92[8]
int currentOffset = offset;
		int currentPartNumber = partNumber;

		while (currentPartNumber != 0xc1 && currentOffset < fruData.length) {

			int partType = (currentPartNumber & 0xc0) >> 6;

			int partDataLength = currentPartNumber & 0x3f;

			if (partDataLengthWithinBounds(fruData, currentOffset, partDataLength)) {

				byte[] partNumberData = new byte[partDataLength];

				System.arraycopy(fruData, currentOffset, partNumberData, 0, partDataLength);

				currentOffset += partDataLength;

				switch (index) {
				case 0:
File Line
org/metricshub/ipmi/core/coding/commands/sdr/GetSdr.java 126[9]
org/metricshub/ipmi/core/coding/commands/sel/GetSelEntry.java 101[10]
GetSdrResponseData responseData = new GetSdrResponseData();

		byte[] buffer = new byte[4];

		buffer[0] = raw[0];
		buffer[1] = raw[1];
		buffer[2] = 0;
		buffer[3] = 0;

		responseData.setNextRecordId(TypeConverter.littleEndianByteArrayToInt(buffer));

		byte[] recordData = new byte[raw.length - 2];

		System.arraycopy(raw, 2, recordData, 0, recordData.length);

		responseData.setSensorRecordData(recordData);
File Line
org/metricshub/ipmi/core/coding/commands/sdr/record/FruDeviceLocatorRecord.java 85[11]
org/metricshub/ipmi/core/coding/commands/sdr/record/GenericDeviceLocatorRecord.java 77[12]
setFruEntityInstance(TypeConverter.byteToInt(recordData[13]));

		byte[] nameData = new byte[recordData.length - 16];

		System.arraycopy(recordData, 16, nameData, 0, nameData.length);

		setName(decodeName(recordData[15], nameData));
	}

	/**
	 * Returns the slave address of the controller used to access the FRU device, in its 7-bit form (byte 6 bits 7:1 of
	 * the record), 0 when the device is directly on the IPMB.
	 * {@link org.metricshub.ipmi.core.coding.commands.app.SendMessage} takes the slave address in its 8-bit form: this
	 * value shifted left by one.
	 *
	 * @return the 7-bit slave address of the controller
	 */
	public int getDeviceAccessAddress() {
		return deviceAccessAddress;
	}

	/**
	 * Sets the slave address of the controller used to access the FRU device.
	 *
	 * @param deviceAccessAddress the 7-bit slave address of the controller
	 */
	public void setDeviceAccessAddress(int deviceAccessAddress) {
		this.deviceAccessAddress = deviceAccessAddress;
	}

	/**
	 * Returns the FRU device ID of a logical FRU device (byte 7 of the record), the ID that the FRU commands of its
	 * controller take, or the 7-bit I2C slave address of a non-logical FRU device (byte 7 bits 7:1).
	 *
	 * @return the FRU device ID, or the 7-bit slave address of a non-logical FRU device
	 */
	public int getDeviceId() {
File Line
org/metricshub/ipmi/core/coding/commands/sdr/record/GenericDeviceLocatorRecord.java 149[13]
org/metricshub/ipmi/core/coding/commands/sdr/record/ManagementControllerDeviceLocatorRecord.java 204[14]
}

	public int getEntityId() {
		return entityId;
	}

	public void setEntityId(int entityId) {
		this.entityId = entityId;
	}

	public int getEntityInstance() {
		return entityInstance;
	}

	public void setEntityInstance(int entityInstance) {
		this.entityInstance = entityInstance;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
File Line
org/metricshub/ipmi/core/coding/commands/sdr/record/GenericDeviceLocatorRecord.java 74[15]
org/metricshub/ipmi/core/coding/commands/sdr/record/ManagementControllerDeviceLocatorRecord.java 112[16]
setDeviceTypeModifier(TypeConverter.byteToInt(recordData[11]));

		setEntityId(TypeConverter.byteToInt(recordData[12]));
		setEntityInstance(TypeConverter.byteToInt(recordData[13]));

		// Byte 16 is the ID string type/length, the string starts at byte 17 (Table 43-10)
		byte[] nameData = new byte[recordData.length - 16];

		System.arraycopy(recordData, 16, nameData, 0, nameData.length);

		setName(decodeName(recordData[15], nameData));
	}

	public int getDeviceAccessAddress() {
File Line
org/metricshub/ipmi/core/coding/commands/fru/record/DcLoadInfo.java 54[17]
org/metricshub/ipmi/core/coding/commands/fru/record/DcOutputInfo.java 48[18]
public DcLoadInfo(byte[] fruData, int offset) {
		super();

		outputNumber = TypeConverter.byteToInt(fruData[offset]) & 0xf;

		nominalVoltage = TypeConverter.byteToInt(fruData[offset + 1]);
		nominalVoltage |= TypeConverter.byteToInt(fruData[offset + 2]) << 8;
		nominalVoltage = TypeConverter.decode2sComplement(nominalVoltage, 15);
File Line
org/metricshub/ipmi/core/sm/states/Rakp1Complete.java 71[19]
org/metricshub/ipmi/core/sm/states/Uninitialized.java 71[20]
stateMachine.doExternalAction(new GetSikAction(rakp1.calculateSik(event.getRakp1ResponseData())));
			} catch (Exception e) {
				stateMachine.setCurrent(this);
				stateMachine.doExternalAction(new ErrorAction(e));
			}
		} else {
			stateMachine.doExternalAction(new ErrorAction(new IllegalArgumentException("Invalid transition")));
		}

	}

	@Override
	public void doAction(StateMachine stateMachine, RmcpMessage message) {
		// No action is needed
	}

}
File Line
org/metricshub/ipmi/core/coding/commands/session/GetChannelAuthenticationCapabilities.java 72[21]
org/metricshub/ipmi/core/coding/commands/session/GetChannelCipherSuites.java 59[22]
public void setChannelNumber(int channelNumber) {
		if (channelNumber < 0 || channelNumber > 0xF || channelNumber == 0xC || channelNumber == 0xD) {
			throw new IllegalArgumentException("Invalid channel number");
		}
		this.channelNumber = TypeConverter.intToByte(channelNumber);
	}

	public int getChannelNumber() {
		return TypeConverter.byteToInt(channelNumber);
	}
File Line
org/metricshub/ipmi/core/coding/commands/session/OpenSession.java 142[23]
org/metricshub/ipmi/core/coding/commands/session/Rakp1.java 233[24]
message.setPayloadType(PayloadType.RmcpOpenSessionRequest);
		message.setSessionID(0);
		message.setSessionSequenceNumber(0);
		message.setAuthenticationType(getAuthenticationType());
		message.setPayloadAuthenticated(false);
		message.setPayloadEncrypted(false);
		message.setPayload(preparePayload(messageSequenceNumber));

		return message;
	}

	@Override
	protected IpmiPayload preparePayload(int sequenceNumber) {
		byte[] payload = new byte[32];
File Line
org/metricshub/ipmi/core/coding/commands/sdr/ReserveSdrRepository.java 73[25]
org/metricshub/ipmi/core/coding/commands/sel/ReserveSel.java 74[26]
ReserveSdrRepositoryResponseData responseData = new ReserveSdrRepositoryResponseData();

		byte[] buffer = new byte[4];

		buffer[0] = raw[0];
		buffer[1] = raw[1];
		buffer[2] = 0;
		buffer[3] = 0;

		responseData.setReservationId(TypeConverter.littleEndianByteArrayToInt(buffer));

		return responseData;
	}

}
File Line
org/metricshub/ipmi/core/coding/commands/session/OpenSession.java 64[27]
org/metricshub/ipmi/core/coding/commands/session/SetSessionPrivilegeLevel.java 125[28]
switch (requestedPrivilegeLevel) {
		case MaximumAvailable:
			return 0;
		case Callback:
			return TypeConverter.intToByte(0x1);
		case User:
			return TypeConverter.intToByte(0x2);
		case Operator:
			return TypeConverter.intToByte(0x3);
		case Administrator:
			return TypeConverter.intToByte(0x4);
		default:
			throw new IllegalArgumentException("Invalid privilege level");
		}
	}
File Line
org/metricshub/ipmi/core/coding/commands/sdr/record/FruDeviceLocatorRecord.java 85[11]
org/metricshub/ipmi/core/coding/commands/sdr/record/ManagementControllerDeviceLocatorRecord.java 116[29]
setFruEntityInstance(TypeConverter.byteToInt(recordData[13]));

		byte[] nameData = new byte[recordData.length - 16];

		System.arraycopy(recordData, 16, nameData, 0, nameData.length);

		setName(decodeName(recordData[15], nameData));
	}

	/**
	 * Returns the slave address of the controller used to access the FRU device, in its 7-bit form (byte 6 bits 7:1 of
	 * the record), 0 when the device is directly on the IPMB.
	 * {@link org.metricshub.ipmi.core.coding.commands.app.SendMessage} takes the slave address in its 8-bit form: this
	 * value shifted left by one.
	 *
	 * @return the 7-bit slave address of the controller
	 */
	public int getDeviceAccessAddress() {
File Line
org/metricshub/ipmi/core/coding/commands/fru/record/BaseCompatibilityInfo.java 53[30]
org/metricshub/ipmi/core/coding/commands/fru/record/OemInfo.java 46[31]
public BaseCompatibilityInfo(byte[] fruData, int offset, int length) {
		super();

		byte[] buffer = new byte[4];

		System.arraycopy(fruData, offset, buffer, 0, 3);
		buffer[3] = 0;

		manufacturerId = TypeConverter.littleEndianByteArrayToInt(buffer);
File Line
org/metricshub/ipmi/core/coding/commands/payload/DeactivatePayload.java 74[32]
org/metricshub/ipmi/core/coding/commands/payload/GetPayloadActivationStatus.java 63[33]
}

	@Override
	public NetworkFunction getNetworkFunction() {
		return NetworkFunction.ApplicationRequest;
	}

	@Override
	protected IpmiPayload preparePayload(int sequenceNumber) throws NoSuchAlgorithmException, InvalidKeyException {
		// We put just 2 bytes into the 6-bytes array, as specification for this command says to leave the rest 4 bytes as
		// zeros
		byte[] message = MessageComposer.get(REQUEST_DATA_LENGTH)
				.appendField(TypeConverter.intToByte(payloadType.getCode()))
				.appendField(TypeConverter.intToByte(payloadInstance))
File Line
org/metricshub/ipmi/core/coding/commands/fru/record/OemInfo.java 58[34]
org/metricshub/ipmi/core/coding/commands/sdr/record/OemRecord.java 68[35]
System.arraycopy(fruData, offset + 3, oemData, 0, length - 3);

	}

	/**
	 * Returns the manufacturer ID of the record, which identifies the vendor that defines it.
	 *
	 * @return the IANA manufacturer ID (3 bytes in the record, least significant byte first)
	 */
	public int getManufacturerId() {
		return manufacturerId;
	}

	/**
	 * Sets the manufacturer ID of the record.
	 *
	 * @param manufacturerId the IANA manufacturer ID
	 */
	public void setManufacturerId(int manufacturerId) {
		this.manufacturerId = manufacturerId;
	}

	/**
	 * Returns the OEM data of the record.
	 *
	 * @return the bytes that follow the manufacturer ID
	 */
	public byte[] getOemData() {
		return oemData;
	}

	/**
	 * Sets the OEM data of the record.
	 *
	 * @param oemData the bytes that follow the manufacturer ID
	 */
	public void setOemData(byte[] oemData) {
		this.oemData = oemData;
	}

}
File Line
org/metricshub/ipmi/core/coding/commands/sdr/GetSdrRepositoryInfo.java 52[36]
org/metricshub/ipmi/core/coding/commands/sdr/ReserveSdrRepository.java 50[37]
org/metricshub/ipmi/core/coding/commands/sel/GetSelInfo.java 50[38]
org/metricshub/ipmi/core/coding/commands/sel/GetSelTimeUtcOffset.java 53[39]
org/metricshub/ipmi/core/coding/commands/sel/ReserveSel.java 50[40]
}

	@Override
	public NetworkFunction getNetworkFunction() {
		return NetworkFunction.StorageRequest;
	}

	@Override
	protected IpmiPayload preparePayload(int sequenceNumber) throws NoSuchAlgorithmException, InvalidKeyException {
		return new IpmiLanRequest(getNetworkFunction(), getCommandCode(), null, TypeConverter.intToByte(sequenceNumber));
	}

	@Override
	public GetSdrRepositoryInfoResponseData getResponseData(IpmiMessage message)
File Line
org/metricshub/ipmi/core/coding/commands/sdr/GetSdrRepositoryInfo.java 77[41]
org/metricshub/ipmi/core/coding/commands/sel/GetSelInfo.java 75[42]
responseData.setSdrVersion(TypeConverter.littleEndianBcdByteToInt(raw[0]));

		byte[] buffer = new byte[4];

		buffer[0] = raw[1];
		buffer[1] = raw[2];
		buffer[2] = 0;
		buffer[3] = 0;

		responseData.setRecordCount(TypeConverter.littleEndianByteArrayToInt(buffer));
File Line
org/metricshub/ipmi/core/coding/commands/sel/SelRecord.java 155[43]
org/metricshub/ipmi/core/coding/commands/sel/SelRecord.java 182[44]
System.arraycopy(data, 3, buffer, 0, 4);
			record.setTimestamp(TypeConverter.decodeDate(TypeConverter.littleEndianByteArrayToInt(buffer)));
			buffer[0] = data[7];
			buffer[1] = data[8];
			buffer[2] = data[9];
File Line
org/metricshub/ipmi/core/coding/commands/sdr/record/DeviceRelativeEntityAssiciationRecord.java 151[45]
org/metricshub/ipmi/core/coding/commands/sdr/record/EntityAssociationRecord.java 114[46]
setEntityRangeInstance4(TypeConverter.byteToInt(recordData[25]));
	}

	public int getContainerEntityId() {
		return containerEntityId;
	}

	public void setContainerEntityId(int containerEntityId) {
		this.containerEntityId = containerEntityId;
	}

	public int getContainerEntityInstance() {
		return containerEntityInstance;
	}

	public void setContainerEntityInstance(int containerEntityInstance) {
		this.containerEntityInstance = containerEntityInstance;
	}

	public int getContainerEntityDeviceAddress() {
File Line
org/metricshub/ipmi/core/sm/states/CiphersWaiting.java 89[47]
org/metricshub/ipmi/core/sm/states/OpenSessionWaiting.java 63[48]
org/metricshub/ipmi/core/sm/states/Rakp1Waiting.java 73[49]
org/metricshub/ipmi/core/sm/states/Rakp3Waiting.java 85[50]
stateMachine.setCurrent(new Ciphers());
		} else {
			stateMachine.doExternalAction(new ErrorAction(new IllegalArgumentException("Invalid transition")));
		}
	}

	@Override
	public void doAction(StateMachine stateMachine, RmcpMessage message) {
		if (ProtocolDecoder.decodeAuthenticationType(message) != AuthenticationType.RMCPPlus) {
			return; // this isn't IPMI v2.0 message so we ignore it
		}
ipmi bmc rmcp+ sensors fru sdr sel system event log chassis serial over lan java hardware monitoring
Links:
  • [1] https://pmd.github.io/latest/pmd_userdocs_cpd.html
  • [2] ./xref/org/metricshub/ipmi/core/sm/states/OpenSessionWaiting.html#L61
  • [3] ./xref/org/metricshub/ipmi/core/sm/states/Rakp3Waiting.html#L83
  • [4] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/GetSdr.html#L87
  • [5] ./xref/org/metricshub/ipmi/core/coding/commands/sel/GetSelEntry.html#L63
  • [6] ./xref/org/metricshub/ipmi/core/sm/states/Rakp1Waiting.html#L71
  • [7] ./xref/org/metricshub/ipmi/core/coding/commands/fru/record/BoardInfo.html#L104
  • [8] ./xref/org/metricshub/ipmi/core/coding/commands/fru/record/ProductInfo.html#L92
  • [9] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/GetSdr.html#L126
  • [10] ./xref/org/metricshub/ipmi/core/coding/commands/sel/GetSelEntry.html#L101
  • [11] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/FruDeviceLocatorRecord.html#L85
  • [12] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/GenericDeviceLocatorRecord.html#L77
  • [13] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/GenericDeviceLocatorRecord.html#L149
  • [14] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/ManagementControllerDeviceLocatorRecord.html#L204
  • [15] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/GenericDeviceLocatorRecord.html#L74
  • [16] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/ManagementControllerDeviceLocatorRecord.html#L112
  • [17] ./xref/org/metricshub/ipmi/core/coding/commands/fru/record/DcLoadInfo.html#L54
  • [18] ./xref/org/metricshub/ipmi/core/coding/commands/fru/record/DcOutputInfo.html#L48
  • [19] ./xref/org/metricshub/ipmi/core/sm/states/Rakp1Complete.html#L71
  • [20] ./xref/org/metricshub/ipmi/core/sm/states/Uninitialized.html#L71
  • [21] ./xref/org/metricshub/ipmi/core/coding/commands/session/GetChannelAuthenticationCapabilities.html#L72
  • [22] ./xref/org/metricshub/ipmi/core/coding/commands/session/GetChannelCipherSuites.html#L59
  • [23] ./xref/org/metricshub/ipmi/core/coding/commands/session/OpenSession.html#L142
  • [24] ./xref/org/metricshub/ipmi/core/coding/commands/session/Rakp1.html#L233
  • [25] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/ReserveSdrRepository.html#L73
  • [26] ./xref/org/metricshub/ipmi/core/coding/commands/sel/ReserveSel.html#L74
  • [27] ./xref/org/metricshub/ipmi/core/coding/commands/session/OpenSession.html#L64
  • [28] ./xref/org/metricshub/ipmi/core/coding/commands/session/SetSessionPrivilegeLevel.html#L125
  • [29] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/ManagementControllerDeviceLocatorRecord.html#L116
  • [30] ./xref/org/metricshub/ipmi/core/coding/commands/fru/record/BaseCompatibilityInfo.html#L53
  • [31] ./xref/org/metricshub/ipmi/core/coding/commands/fru/record/OemInfo.html#L46
  • [32] ./xref/org/metricshub/ipmi/core/coding/commands/payload/DeactivatePayload.html#L74
  • [33] ./xref/org/metricshub/ipmi/core/coding/commands/payload/GetPayloadActivationStatus.html#L63
  • [34] ./xref/org/metricshub/ipmi/core/coding/commands/fru/record/OemInfo.html#L58
  • [35] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/OemRecord.html#L68
  • [36] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/GetSdrRepositoryInfo.html#L52
  • [37] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/ReserveSdrRepository.html#L50
  • [38] ./xref/org/metricshub/ipmi/core/coding/commands/sel/GetSelInfo.html#L50
  • [39] ./xref/org/metricshub/ipmi/core/coding/commands/sel/GetSelTimeUtcOffset.html#L53
  • [40] ./xref/org/metricshub/ipmi/core/coding/commands/sel/ReserveSel.html#L50
  • [41] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/GetSdrRepositoryInfo.html#L77
  • [42] ./xref/org/metricshub/ipmi/core/coding/commands/sel/GetSelInfo.html#L75
  • [43] ./xref/org/metricshub/ipmi/core/coding/commands/sel/SelRecord.html#L155
  • [44] ./xref/org/metricshub/ipmi/core/coding/commands/sel/SelRecord.html#L182
  • [45] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/DeviceRelativeEntityAssiciationRecord.html#L151
  • [46] ./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/EntityAssociationRecord.html#L114
  • [47] ./xref/org/metricshub/ipmi/core/sm/states/CiphersWaiting.html#L89
  • [48] ./xref/org/metricshub/ipmi/core/sm/states/OpenSessionWaiting.html#L63
  • [49] ./xref/org/metricshub/ipmi/core/sm/states/Rakp1Waiting.html#L73
  • [50] ./xref/org/metricshub/ipmi/core/sm/states/Rakp3Waiting.html#L85
Searching...
No results.