oem ibm: marker LID validation

This commit adds code for writing marker LID
from Host and also send a PlatformEventMessage
after validation.

This commit also subscribes for the interface added
signal to fetch the new image id and sends the relevant
sensor event to host

Change-Id: I92476beca18e6dd255f372dd82d6eaeca18e282c
Signed-off-by: Sampa Misra <sampmisr@in.ibm.com>
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
index f8d261d..854c96b 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
@@ -17,6 +17,7 @@
 #define PLDM_OEM_IBM_BOOT_STATE 32769
 
 static constexpr auto PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE = 24577;
+static constexpr auto PLDM_OEM_IBM_VERIFICATION_STATE = 32770;
 constexpr uint16_t ENTITY_INSTANCE_0 = 0;
 constexpr uint16_t ENTITY_INSTANCE_1 = 1;
 
@@ -30,15 +31,23 @@
     REJECT = 0x6
 };
 
+enum VerificationStateValues
+{
+    VALID = 0x0,
+    ENTITLEMENT_FAIL = 0x1,
+    BANNED_PLATFORM_FAIL = 0x2,
+    MIN_MIF_FAIL = 0x4,
+};
+
 class Handler : public oem_platform::Handler
 {
   public:
     Handler(const pldm::utils::DBusHandler* dBusIntf,
             pldm::responder::CodeUpdate* codeUpdate, int mctp_fd,
-            uint8_t mctp_eid, Requester& requester) :
+            uint8_t mctp_eid, Requester& requester, sdeventplus::Event& event) :
         oem_platform::Handler(dBusIntf),
         codeUpdate(codeUpdate), platformHandler(nullptr), mctp_fd(mctp_fd),
-        mctp_eid(mctp_eid), requester(requester)
+        mctp_eid(mctp_eid), requester(requester), event(event)
     {
         codeUpdate->setVersions();
     }
@@ -48,7 +57,7 @@
         StateSetId stateSetId, CompositeCount compSensorCnt,
         std::vector<get_sensor_state_field>& stateField);
 
-    int OemSetStateEffecterStatesHandler(
+    int oemSetStateEffecterStatesHandler(
         uint16_t entityType, uint16_t entityInstance, uint16_t stateSetId,
         uint8_t compEffecterCnt,
         std::vector<set_effecter_state_field>& stateField, uint16_t effecterId);
@@ -104,6 +113,20 @@
      */
     int sendEventToHost(std::vector<uint8_t>& requestMsg);
 
+    /** @brief _processEndUpdate processes the actual work that needs
+     *  to be carried out after EndUpdate effecter is set. This is done async
+     *  after sending response for EndUpdate set effecter
+     *  @param[in] source - sdeventplus event source
+     */
+    void _processEndUpdate(sdeventplus::source::EventBase& source);
+
+    /** @brief _processStartUpdate processes the actual work that needs
+     *  to be carried out after StartUpdate effecter is set. This is done async
+     *  after sending response for StartUpdate set effecter
+     *  @param[in] source - sdeventplus event source
+     */
+    void _processStartUpdate(sdeventplus::source::EventBase& source);
+
     ~Handler() = default;
 
     pldm::responder::CodeUpdate* codeUpdate; //!< pointer to CodeUpdate object
@@ -120,6 +143,14 @@
      *  obtain PLDM instance id.
      */
     Requester& requester;
+    /** @brief sdeventplus event source */
+    std::unique_ptr<sdeventplus::source::Defer> assembleImageEvent;
+    std::unique_ptr<sdeventplus::source::Defer> startUpdateEvent;
+
+    /** @brief reference of main event loop of pldmd, primarily used to schedule
+     *  work
+     */
+    sdeventplus::Event& event;
 };
 
 /** @brief Method to encode code update event msg