Class IpmiCommandCoder<R extends ResponseData>

java.lang.Object
org.metricshub.ipmi.core.coding.PayloadCoder
org.metricshub.ipmi.core.coding.commands.IpmiCommandCoder<R>
Type Parameters:
R - the type of the response data of the command
Direct Known Subclasses:
ActivatePayload, ChassisControl, ChassisIdentify, CloseSession, DeactivatePayload, GetChannelAuthenticationCapabilities, GetChannelCipherSuites, GetChannelPayloadSupport, GetChassisStatus, GetDeviceId, GetDeviceSdrInfo, GetFruInventoryAreaInfo, GetPayloadActivationStatus, GetPayloadInstanceInfo, GetSdr, GetSdrRepositoryInfo, GetSelEntry, GetSelInfo, GetSelTimeUtcOffset, GetSensorReading, GetSensorReadingFactors, GetSessionInfo, OpenSession, Rakp1, Rakp3, ReadFruData, ReserveSdrRepository, ReserveSel, SendMessage, SetSessionPrivilegeLevel

public abstract class IpmiCommandCoder<R extends ResponseData> extends PayloadCoder
A wrapper for an IPMI command: encodes its request and decodes its response, of type R. The session the command is sent in sets its IPMI version, cipher suite and authentication type (PayloadCoder.setSessionParameters(IpmiVersion, CipherSuite, AuthenticationType)) when it encodes the request.
  • Method Details

    • getSupportedPayloadType

      public PayloadType getSupportedPayloadType()
      Specified by:
      getSupportedPayloadType in class PayloadCoder
    • getResponseData

      public abstract R getResponseData(IpmiMessage message) throws IPMIException, NoSuchAlgorithmException, InvalidKeyException
      Description copied from class: PayloadCoder
      Retrieves payload-specific response data from IPMI message
      Specified by:
      getResponseData in class PayloadCoder
      Parameters:
      message - - IPMI message
      Returns:
      response data
      Throws:
      IPMIException - when response completion code isn't OK.
      NoSuchAlgorithmException - when authentication, confidentiality or integrity algorithm fails.
      InvalidKeyException - when creating of the authentication algorithm key fails
    • isCommandResponse

      public boolean isCommandResponse(IpmiMessage message)
      Checks if given message contains response command specific for this class.
      Parameters:
      message - IpmiMessage wrapping the IPMI message
      Returns:
      True if message contains response command specific for this class, false otherwise.
    • answers

      public boolean answers(IpmiLanMessage reply)
      Tells whether a reply received under the tag of this request answers it: the same command code, under the response network function of the request (the request one plus one, IPMI 2.0 section 5.1). The codes are compared as numbers, so that the reply to a request of a network function NetworkFunction does not list (Transport 0Ch, Group Extension 2Ch, OEM 30h-3Eh) is matched like any other. A reply that does not answer the request (the late reply of an older request that had the same tag) is ignored, and the request keeps waiting.
      Parameters:
      reply - the IPMI message received under the tag of this request
      Returns:
      whether the reply answers this request
    • getCommandCode

      public abstract byte getCommandCode()
      Retrieves command code specific for command represented by this class
      Returns:
      command code
    • getNetworkFunction

      public abstract NetworkFunction getNetworkFunction()
      Retrieves network function specific for command represented by this class.
      Returns:
      network function, or null for a command of a network function NetworkFunction does not list, which overrides getNetworkFunctionCode() instead
      See Also:
    • getNetworkFunctionCode

      public int getNetworkFunctionCode()
      Returns the network function code of the request (6 bits, IPMI 2.0 table 5-1): the code of getNetworkFunction() by default. A command of a network function NetworkFunction does not list (Transport 0Ch, Group Extension 2Ch such as DCMI, OEM/Group 2Eh, controller-specific OEM 30h-3Eh) overrides it and builds its request with IpmiLanRequest(int, byte, byte[], byte): its reply is the one under this code plus one.
      Returns:
      the network function code of the request, an even number from 00h to 3Eh