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/host-bmc/dbus_to_event_handler.cpp b/host-bmc/dbus_to_event_handler.cpp
index e8f84a6..2c9d92e 100644
--- a/host-bmc/dbus_to_event_handler.cpp
+++ b/host-bmc/dbus_to_event_handler.cpp
@@ -10,7 +10,6 @@
namespace pldm
{
-using namespace pldm::dbus_api;
using namespace pldm::responder;
using namespace pldm::responder::pdr;
using namespace pldm::responder::pdr_utils;
@@ -22,16 +21,16 @@
const std::vector<uint8_t> pdrTypes{PLDM_STATE_SENSOR_PDR};
DbusToPLDMEvent::DbusToPLDMEvent(
- int mctp_fd, uint8_t mctp_eid, Requester& requester,
+ int mctp_fd, uint8_t mctp_eid, pldm::InstanceIdDb& instanceIdDb,
pldm::requester::Handler<pldm::requester::Request>* handler) :
mctp_fd(mctp_fd),
- mctp_eid(mctp_eid), requester(requester), handler(handler)
+ mctp_eid(mctp_eid), instanceIdDb(instanceIdDb), handler(handler)
{}
void DbusToPLDMEvent::sendEventMsg(uint8_t eventType,
const std::vector<uint8_t>& eventDataVec)
{
- auto instanceId = requester.getInstanceId(mctp_eid);
+ auto instanceId = instanceIdDb.next(mctp_eid);
std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
eventDataVec.size());
@@ -43,7 +42,7 @@
eventDataVec.size() + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES);
if (rc != PLDM_SUCCESS)
{
- requester.markFree(mctp_eid, instanceId);
+ instanceIdDb.free(mctp_eid, instanceId);
error("Failed to encode_platform_event_message_req, rc = {RC}", "RC",
rc);
return;