common: Add util APIs to find all the effecter IDs and PDRs
This util API is used to find all the effecter IDs based on
the pldm_entity given. Another util API is added to get all
the PDRs based on the entity type.
Change-Id: I4f5b0ca05dfbad641f1ecfbaec5ebf63f54e500d
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/common/utils.hpp b/common/utils.hpp
index b2b5c3c..23db119 100644
--- a/common/utils.hpp
+++ b/common/utils.hpp
@@ -205,6 +205,8 @@
using SensorPDR = std::vector<uint8_t>;
using SensorPDRs = std::vector<SensorPDR>;
+using EffecterPDR = std::vector<uint8_t>;
+using EffecterPDRs = std::vector<EffecterPDR>;
/**
* @brief The interface for DBusHandler
@@ -536,6 +538,29 @@
const pldm_pdr* pdrRepo, uint16_t entityType, uint16_t entityInstance,
uint16_t containerId);
+/** @brief Method to find all state effecter PDRs by type
+ *
+ * @param[in] entityType - the entity type
+ * @param[in] repo - opaque pointer acting as a PDR repo handle
+ *
+ * @return vector of vector of all state effecter PDRs
+ */
+EffecterPDRs getStateEffecterPDRsByType(uint16_t entityType,
+ const pldm_pdr* repo);
+
+/** @brief method to find effecter IDs based on the pldm_entity
+ *
+ * @param[in] pdrRepo - opaque pointer acting as a PDR repo handle
+ * @param[in] entityType - the entity type
+ * @param[in] entityInstance - the entity instance number
+ * @param[in] containerId - the container ID
+ *
+ * @return vector of all effecter IDs
+ */
+std::vector<pldm::pdr::EffecterID> findEffecterIds(
+ const pldm_pdr* pdrRepo, uint16_t entityType, uint16_t entityInstance,
+ uint16_t containerId);
+
/** @brief Emit the sensor event signal
*
* @param[in] tid - the terminus id