| #pragma once |
| |
| #include "common/types.hpp" |
| #include "common/utils.hpp" |
| #include "libpldmresponder/pdr_utils.hpp" |
| #include "pldmd/handler.hpp" |
| |
| namespace pldm |
| { |
| namespace responder |
| { |
| namespace oem_platform |
| { |
| class Handler : public CmdHandler |
| { |
| public: |
| Handler(const pldm::utils::DBusHandler* dBusIntf) : dBusIntf(dBusIntf) {} |
| |
| /** @brief Interface to get the state sensor readings requested by pldm |
| * requester for OEM types. Each specific type should implement a handler |
| * of it's own |
| * |
| * @param[in] entityType - entity type corresponding to the sensor |
| * @param[in] entityInstance - entity instance number |
| * @param[in] entityContainerID - container id |
| * @param[in] stateSetId - state set id |
| * @param[in] compSensorCnt - composite sensor count |
| * @param[in] sensorId - sensor ID |
| * @param[out] stateField - The state field data for each of the states, |
| * equal to composite sensor count in number |
| * |
| * @return - Success or failure in getting the states. Returns failure in |
| * terms of PLDM completion codes if fetching at least one state |
| * fails |
| */ |
| virtual int getOemStateSensorReadingsHandler( |
| pldm::pdr::EntityType entityType, |
| pldm::pdr::EntityInstance entityInstance, |
| pldm::pdr::ContainerID entityContainerId, |
| pldm::pdr::StateSetId stateSetId, |
| pldm::pdr::CompositeCount compSensorCnt, uint16_t sensorId, |
| std::vector<get_sensor_state_field>& stateField) = 0; |
| |
| /** @brief Interface to set the effecter requested by pldm requester |
| * for OEM types. Each individual oem type should implement |
| * it's own handler. |
| * |
| * @param[in] entityType - entity type corresponding to the effecter id |
| * @param[in] entityInstance - entity instance |
| * @param[in] stateSetId - state set id |
| * @param[in] compEffecterCnt - composite effecter count |
| * @param[in] stateField - The state field data for each of the states, |
| * equal to compEffecterCnt in number |
| * @param[in] effecterId - Effecter id |
| * |
| * @return - Success or failure in setting the states.Returns failure in |
| * terms of PLDM completion codes if at least one state fails to |
| * be set |
| */ |
| virtual int oemSetStateEffecterStatesHandler( |
| uint16_t entityType, uint16_t entityInstance, uint16_t stateSetId, |
| uint8_t compEffecterCnt, |
| std::vector<set_effecter_state_field>& stateField, |
| uint16_t effecterId) = 0; |
| |
| /** @brief Interface to generate the OEM PDRs |
| * |
| * @param[in] repo - instance of concrete implementation of Repo |
| */ |
| virtual void buildOEMPDR(pldm::responder::pdr_utils::Repo& repo) = 0; |
| |
| /** @brief Interface to check if setEventReceiver is sent to host already. |
| * If sent then then disableWatchDogTimer() would be called to |
| * disable the watchdog timer */ |
| virtual void checkAndDisableWatchDog() = 0; |
| |
| /** @brief Interface to check if the watchdog timer is running |
| * |
| * @return - true if watchdog is running, false otherwise |
| * */ |
| virtual bool watchDogRunning() = 0; |
| |
| /** @brief Interface to reset the watchdog timer */ |
| virtual void resetWatchDogTimer() = 0; |
| |
| /** @brief Interface to disable the watchdog timer */ |
| virtual void disableWatchDogTimer() = 0; |
| |
| /** @brief Interface to keep track of how many times setEventReceiver |
| * is sent to host */ |
| virtual void countSetEventReceiver() = 0; |
| |
| /** @brief Interface to check the BMC state */ |
| virtual int checkBMCState() = 0; |
| |
| /** @brief update the dbus object paths */ |
| virtual void updateOemDbusPaths(std::string& dbusPath) = 0; |
| |
| /** @brief Interface to fetch the last BMC record from the PDR repository |
| * |
| * @param[in] repo - pointer to BMC's primary PDR repo |
| * |
| * @return the last BMC record from the repo |
| */ |
| virtual const pldm_pdr_record* fetchLastBMCRecord(const pldm_pdr* repo) = 0; |
| |
| /** @brief Interface to check if the record handle passed is in remote PDR |
| * record handle range |
| * |
| * @param[in] record_handle - record handle of the PDR |
| * |
| * @return true if record handle passed is in host PDR record handle range |
| */ |
| virtual bool checkRecordHandleInRange(const uint32_t& record_handle) = 0; |
| |
| /** @brief Interface to the process setEventReceiver*/ |
| virtual void processSetEventReceiver() = 0; |
| |
| /** @brief Interface to monitor the surveillance pings from remote terminus |
| * |
| * @param[in] tid - TID of the remote terminus |
| * @param[in] value - true or false, to indicate if the timer is |
| * running or not |
| * */ |
| virtual void setSurvTimer(uint8_t tid, bool value) = 0; |
| |
| virtual ~Handler() = default; |
| |
| protected: |
| const pldm::utils::DBusHandler* dBusIntf; |
| }; |
| |
| } // namespace oem_platform |
| |
| namespace oem_fru |
| { |
| |
| class Handler : public CmdHandler |
| { |
| public: |
| Handler() {} |
| |
| /** @brief Process OEM FRU record |
| * |
| * @param[in] fruData - the data of the fru |
| * |
| * @return success or failure |
| */ |
| virtual int processOEMFRUTable(const std::vector<uint8_t>& fruData) = 0; |
| |
| virtual ~Handler() = default; |
| }; |
| |
| } // namespace oem_fru |
| |
| namespace oem_utils |
| { |
| using namespace pldm::utils; |
| |
| class Handler : public CmdHandler |
| { |
| public: |
| Handler(const pldm::utils::DBusHandler* dBusIntf) : dBusIntf(dBusIntf) {} |
| |
| /** @brief Collecting core count data and setting to Dbus properties |
| * |
| * @param[in] associations - the data of entity association |
| * @param[in] entityMaps - the mapping of entity to DBus string |
| * |
| */ |
| virtual int setCoreCount(const EntityAssociations& associations, |
| const EntityMaps entityMaps) = 0; |
| |
| virtual ~Handler() = default; |
| |
| protected: |
| const pldm::utils::DBusHandler* dBusIntf; |
| }; |
| |
| } // namespace oem_utils |
| |
| } // namespace responder |
| |
| } // namespace pldm |