pldmd: Migrate instance ID allocation to pldm::InstanceIdDb

This removes use of `pldm::dbus_api::Requester` from around the
code-base. This makes progress towards removing the DBus API entirely
once all its consumers are converted to the libpldm instance ID APIs.

There was never a good reason for the code using the class to have
knowledge that it was related to DBus anyway, so this is, in-effect, a
double clean up improving separation of concerns.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I2d9397cae1b3c8c251c32e36ca520aad9c9b8cf6
diff --git a/requester/handler.hpp b/requester/handler.hpp
index ece1382..9fa5c31 100644
--- a/requester/handler.hpp
+++ b/requester/handler.hpp
@@ -3,7 +3,7 @@
 #include "config.h"
 
 #include "common/types.hpp"
-#include "pldmd/dbus_impl_requester.hpp"
+#include "pldmd/instance_id.hpp"
 #include "request.hpp"
 
 #include <libpldm/base.h>
@@ -91,7 +91,7 @@
      *
      *  @param[in] fd - fd of MCTP communications socket
      *  @param[in] event - reference to PLDM daemon's main event loop
-     *  @param[in] requester - reference to Requester object
+     *  @param[in] instanceIdDb - reference to an InstanceIdDb
      *  @param[in] currentSendbuffSize - current send buffer size
      *  @param[in] verbose - verbose tracing flag
      *  @param[in] instanceIdExpiryInterval - instance ID expiration interval
@@ -99,7 +99,7 @@
      *  @param[in] responseTimeOut - time to wait between each retry
      */
     explicit Handler(
-        int fd, sdeventplus::Event& event, pldm::dbus_api::Requester& requester,
+        int fd, sdeventplus::Event& event, pldm::InstanceIdDb& instanceIdDb,
         int currentSendbuffSize, bool verbose,
         std::chrono::seconds instanceIdExpiryInterval =
             std::chrono::seconds(INSTANCE_ID_EXPIRATION_INTERVAL),
@@ -107,7 +107,7 @@
         std::chrono::milliseconds responseTimeOut =
             std::chrono::milliseconds(RESPONSE_TIME_OUT)) :
         fd(fd),
-        event(event), requester(requester),
+        event(event), instanceIdDb(instanceIdDb),
         currentSendbuffSize(currentSendbuffSize), verbose(verbose),
         instanceIdExpiryInterval(instanceIdExpiryInterval),
         numRetries(numRetries), responseTimeOut(responseTimeOut)
@@ -174,7 +174,7 @@
         auto rc = request->start();
         if (rc)
         {
-            requester.markFree(eid, instanceId);
+            instanceIdDb.free(eid, instanceId);
             error("Failure to send the PLDM request message");
             return rc;
         }
@@ -186,7 +186,7 @@
         }
         catch (const std::runtime_error& e)
         {
-            requester.markFree(eid, instanceId);
+            instanceIdDb.free(eid, instanceId);
             error(
                 "Failed to start the instance ID expiry timer. RC = {ERR_EXCEP}",
                 "ERR_EXCEP", e.what());
@@ -224,7 +224,7 @@
                       "RC", static_cast<int>(rc));
             }
             responseHandler(eid, response, respMsgLen);
-            requester.markFree(key.eid, key.instanceId);
+            instanceIdDb.free(key.eid, key.instanceId);
             handlers.erase(key);
         }
         else
@@ -233,21 +233,21 @@
             // request handler, so freeing up the instance ID, this can be other
             // OpenBMC applications relying on PLDM D-Bus apis like
             // openpower-occ-control and softoff
-            requester.markFree(key.eid, key.instanceId);
+            instanceIdDb.free(key.eid, key.instanceId);
         }
     }
 
   private:
     int fd; //!< file descriptor of MCTP communications socket
     sdeventplus::Event& event; //!< reference to PLDM daemon's main event loop
-    pldm::dbus_api::Requester& requester; //!< reference to Requester object
-    int currentSendbuffSize;              //!< current Send Buffer size
-    bool verbose;                         //!< verbose tracing flag
+    pldm::InstanceIdDb& instanceIdDb; //!< reference to an InstanceIdDb
+    int currentSendbuffSize;          //!< current Send Buffer size
+    bool verbose;                     //!< verbose tracing flag
     std::chrono::seconds
-        instanceIdExpiryInterval;         //!< Instance ID expiration interval
-    uint8_t numRetries;                   //!< number of request retries
+        instanceIdExpiryInterval;     //!< Instance ID expiration interval
+    uint8_t numRetries;               //!< number of request retries
     std::chrono::milliseconds
-        responseTimeOut;                  //!< time to wait between each retry
+        responseTimeOut;              //!< time to wait between each retry
 
     /** @brief Container for storing the details of the PLDM request
      *         message, handler for the corresponding PLDM response and the
@@ -276,7 +276,7 @@
         if (removeRequestContainer.contains(key))
         {
             removeRequestContainer[key].reset();
-            requester.markFree(key.eid, key.instanceId);
+            instanceIdDb.free(key.eid, key.instanceId);
             handlers.erase(key);
             removeRequestContainer.erase(key);
         }