Reduce multiple oem_ibm entry points in pldmd
Abstract the custom method of `OEM-IBM` into the oem-ibm.hpp file
to prevent the continuous increase of custom code and reduce multiple
`OEM-IBM` entry points in pldmd.
Tested: enabled oem-ibm and built pldm successfully.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ieddb8d12281553e70bdb1c333bd29425c9d14fb0
diff --git a/libpldmresponder/platform.hpp b/libpldmresponder/platform.hpp
index 89eca61..b045d84 100644
--- a/libpldmresponder/platform.hpp
+++ b/libpldmresponder/platform.hpp
@@ -54,7 +54,6 @@
pldm_pdr* repo, HostPDRHandler* hostPDRHandler,
pldm::state_sensor::DbusToPLDMEvent* dbusToPLDMEventHandler,
fru::Handler* fruHandler,
- pldm::responder::oem_platform::Handler* oemPlatformHandler,
pldm::responder::platform_config::Handler* platformConfigHandler,
pldm::requester::Handler<pldm::requester::Request>* handler,
sdeventplus::Event& event, bool buildPDRLazily = false,
@@ -63,10 +62,9 @@
instanceIdDb(instanceIdDb), pdrRepo(repo),
hostPDRHandler(hostPDRHandler),
dbusToPLDMEventHandler(dbusToPLDMEventHandler), fruHandler(fruHandler),
- dBusIntf(dBusIntf), oemPlatformHandler(oemPlatformHandler),
- platformConfigHandler(platformConfigHandler), handler(handler),
- event(event), pdrJsonDir(pdrJsonDir), pdrCreated(false),
- pdrJsonsDir({pdrJsonDir})
+ dBusIntf(dBusIntf), platformConfigHandler(platformConfigHandler),
+ handler(handler), event(event), pdrJsonDir(pdrJsonDir),
+ pdrCreated(false), pdrJsonsDir({pdrJsonDir})
{
if (!buildPDRLazily)
{
@@ -211,6 +209,16 @@
*/
EventMap eventHandlers;
+ /* @brief Method to set the oem platform handler in platform handler class
+ *
+ * @param[in] handler - oem platform handler
+ */
+ inline void
+ setOemPlatformHandler(pldm::responder::oem_platform::Handler* handler)
+ {
+ oemPlatformHandler = handler;
+ }
+
/** @brief Handler for GetPDR
*
* @param[in] request - Request message payload
@@ -500,7 +508,7 @@
pldm::state_sensor::DbusToPLDMEvent* dbusToPLDMEventHandler;
fru::Handler* fruHandler;
const pldm::utils::DBusHandler* dBusIntf;
- pldm::responder::oem_platform::Handler* oemPlatformHandler;
+ pldm::responder::oem_platform::Handler* oemPlatformHandler = nullptr;
pldm::responder::platform_config::Handler* platformConfigHandler;
pldm::requester::Handler<pldm::requester::Request>* handler;
sdeventplus::Event& event;