oem ibm: infrastructure for oem handlers

1. This commit adds the framework for an oem handler
which can be used by specific oem use-cases
for implementing various commands.

2. This commit adds implementation for getStateSensorReadings
and setStateEffecterStates commands for oem state sets.

3. Also adds implementation for inband code update.

Change-Id: Ib38a66ee381dd06b93f6a9313d51de1c23e6ee65
Signed-off-by: Sampa Misra <sampmisr@in.ibm.com>
diff --git a/libpldmresponder/platform.hpp b/libpldmresponder/platform.hpp
index ef2434d..09418cd 100644
--- a/libpldmresponder/platform.hpp
+++ b/libpldmresponder/platform.hpp
@@ -13,6 +13,7 @@
 #include "host-bmc/host_pdr_handler.hpp"
 #include "libpldmresponder/pdr.hpp"
 #include "libpldmresponder/pdr_utils.hpp"
+#include "oem_handler.hpp"
 #include "pldmd/handler.hpp"
 
 #include <stdint.h>
@@ -55,12 +56,14 @@
             const std::string& pdrJsonsDir, pldm_pdr* repo,
             HostPDRHandler* hostPDRHandler,
             DbusToPLDMEvent* dbusToPLDMEventHandler, fru::Handler* fruHandler,
+            pldm::responder::oem_platform::Handler* oemPlatformHandler,
             bool buildPDRLazily = false,
             const std::optional<EventMap>& addOnHandlersMap = std::nullopt) :
         pdrRepo(repo),
         hostPDRHandler(hostPDRHandler),
         dbusToPLDMEventHandler(dbusToPLDMEventHandler), fruHandler(fruHandler),
-        dBusIntf(dBusIntf), pdrJsonsDir(pdrJsonsDir), pdrCreated(false)
+        dBusIntf(dBusIntf), oemPlatformHandler(oemPlatformHandler),
+        pdrJsonsDir(pdrJsonsDir), pdrCreated(false)
     {
         if (!buildPDRLazily)
         {
@@ -441,10 +444,49 @@
     DbusToPLDMEvent* dbusToPLDMEventHandler;
     fru::Handler* fruHandler;
     const pldm::utils::DBusHandler* dBusIntf;
+    pldm::responder::oem_platform::Handler* oemPlatformHandler;
     std::string pdrJsonsDir;
     bool pdrCreated;
 };
 
+/** @brief Function to check if a sensor falls in OEM range
+ *         A sensor is considered to be oem if either of entity
+ *         type or state set or both falls in oem range
+ *
+ *  @param[in] handler - the interface object
+ *  @param[in] sensorId - sensor id
+ *  @param[in] sensorRearmCount - sensor rearm count
+ *  @param[out] compSensorCnt - composite sensor count
+ *  @param[out] entityType - entity type
+ *  @param[out] entityInstance - entity instance number
+ *  @param[out] stateSetId - state set id
+ *
+ *  @return true if the sensor is OEM. All out parameters are invalid
+ *               for a non OEM sensor
+ */
+bool isOemStateSensor(Handler& handler, uint16_t sensorId,
+                      uint8_t sensorRearmCount, uint8_t& compSensorCnt,
+                      uint16_t& entityType, uint16_t& entityInstance,
+                      uint16_t& stateSetId);
+
+/** @brief Function to check if an effecter falls in OEM range
+ *         An effecter is considered to be oem if either of entity
+ *         type or state set or both falls in oem range
+ *
+ *  @param[in] handler - the interface object
+ *  @param[in] effecterId - effecter id
+ *  @param[in] compEffecterCnt - composite effecter count
+ *  @param[out] entityType - entity type
+ *  @param[out] entityInstance - entity instance number
+ *  @param[out] stateSetId - state set id
+ *
+ *  @return true if the effecter is OEM. All out parameters are invalid
+ *               for a non OEM effecter
+ */
+bool isOemStateEffecter(Handler& handler, uint16_t effecterId,
+                        uint8_t compEffecterCnt, uint16_t& entityType,
+                        uint16_t& entityInstance, uint16_t& stateSetId);
+
 } // namespace platform
 } // namespace responder
 } // namespace pldm