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/base.hpp b/libpldmresponder/base.hpp
index 7ccac27..ad41299 100644
--- a/libpldmresponder/base.hpp
+++ b/libpldmresponder/base.hpp
@@ -20,10 +20,7 @@
class Handler : public CmdHandler
{
public:
- Handler(sdeventplus::Event& event,
- pldm::responder::oem_platform::Handler* oemPlatformHandler) :
- event(event),
- oemPlatformHandler(oemPlatformHandler)
+ Handler(sdeventplus::Event& event) : event(event)
{
handlers.emplace(
PLDM_GET_PLDM_TYPES,
@@ -87,6 +84,16 @@
*/
Response getTID(const pldm_msg* request, size_t payloadLength);
+ /* @brief Method to set the oem platform handler in base handler class
+ *
+ * @param[in] handler - oem platform handler
+ */
+ inline void
+ setOemPlatformHandler(pldm::responder::oem_platform::Handler* handler)
+ {
+ oemPlatformHandler = handler;
+ }
+
private:
/** @brief reference of main event loop of pldmd, primarily used to schedule
* work
@@ -94,7 +101,7 @@
sdeventplus::Event& event;
/** @brief OEM platform handler */
- pldm::responder::oem_platform::Handler* oemPlatformHandler;
+ pldm::responder::oem_platform::Handler* oemPlatformHandler = nullptr;
/** @brief sdeventplus event source */
std::unique_ptr<sdeventplus::source::Defer> survEvent;