fw-update: Add support for canceling component updates

This commit implements the CancelUpdateComponent command functionality
to handle component update failures during firmware updates.
This change improves firmware update reliability by gracefully handling
component update failures and allowing partial updates to proceed when
possible by sending ActivateFirmware command if even one of the
component updates succeed.

Tests:
- Triggered a verification failure with a corrupted package. The
  relevant logs are seen in the journal

```
pldmd[24962]: Failed to verify component endpoint ID '16' and version
              'cec1736Ecfw-01.04.0022.0000' with transfer result - '149'
pldmd[24962]: Sending cancel update component request for endpoint ID 16
pldmd[24962]: Received cancel update component response from endpoint ID
              16
```

Change-Id: I7618045f3d3df3fc4f64c493fc39f2a0f7898b95
Signed-off-by: P Arun Kumar Reddy <arunpapannagari23@gmail.com>
diff --git a/fw-update/device_updater.hpp b/fw-update/device_updater.hpp
index 4613a7c..11570a1 100644
--- a/fw-update/device_updater.hpp
+++ b/fw-update/device_updater.hpp
@@ -15,6 +15,12 @@
 namespace fw_update
 {
 
+/** @brief Type alias for component update status tracking
+ *         Maps component index to its update completion status (true indicates
+ *         successful completion, false indicates cancellation)
+ */
+using ComponentUpdateStatusMap = std::map<size_t, bool>;
+
 class UpdateManager;
 
 /** @class DeviceUpdater
@@ -152,6 +158,15 @@
      */
     void activateFirmware(mctp_eid_t eid, const pldm_msg* response,
                           size_t respMsgLen);
+    /**
+     * @brief Handler for CancelUpdateComponent command response
+     *
+     * @param[in] eid - Remote MCTP endpoint
+     * @param[in] response - PLDM Response message
+     * @param[in] respMsgLen - Response message length
+     */
+    void cancelUpdateComponent(mctp_eid_t eid, const pldm_msg* response,
+                               size_t respMsgLen);
 
   private:
     /** @brief Send PassComponentTable command request
@@ -169,6 +184,11 @@
     /** @brief Send ActivateFirmware command request */
     void sendActivateFirmwareRequest();
 
+    /**
+     * @brief Send cancel update component request
+     */
+    void sendCancelUpdateComponentRequest();
+
     /** @brief Endpoint ID of the firmware device */
     mctp_eid_t eid;
 
@@ -207,6 +227,12 @@
 
     /** @brief To send a PLDM request after the current command handling */
     std::unique_ptr<sdeventplus::source::Defer> pldmRequest;
+
+    /**
+     * @brief Map to hold component update status. True - success, False -
+     *        cancelled
+     */
+    ComponentUpdateStatusMap componentUpdateStatus;
 };
 
 } // namespace fw_update