pldmd: implement PLDM.Requester D-Bus API

Implement D-Bus API defined at
https://gerrit.openbmc-project.xyz/#/c/openbmc/phosphor-dbus-interfaces/+/27077/.

This commit provides an implementation of the PLDM instance id as per
DSP0240 v1.0.0. Ids are tracked per MCTP EID.

Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Change-Id: I8a1ef213646529b71d9bf33edda67537f7c0f32a
diff --git a/instance_id.hpp b/instance_id.hpp
new file mode 100644
index 0000000..70b284c
--- /dev/null
+++ b/instance_id.hpp
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <bitset>
+
+namespace pldm
+{
+
+constexpr size_t maxInstanceIds = 32;
+
+/** @class InstanceId
+ *  @brief Implementation of PLDM instance id as per DSP0240 v1.0.0
+ */
+class InstanceId
+{
+  public:
+    /** @brief Get next unused instance id
+     *  @return - PLDM instance id
+     */
+    uint8_t next();
+
+    /** @brief Mark an instance id as unused
+     *  @param[in] instanceId - PLDM instance id to be freed
+     */
+    void markFree(uint8_t instanceId)
+    {
+        id.set(instanceId, false);
+    }
+
+  private:
+    std::bitset<maxInstanceIds> id;
+};
+
+} // namespace pldm