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.cpp b/instance_id.cpp
new file mode 100644
index 0000000..52cd1d6
--- /dev/null
+++ b/instance_id.cpp
@@ -0,0 +1,25 @@
+#include "instance_id.hpp"
+
+#include <stdexcept>
+
+namespace pldm
+{
+
+uint8_t InstanceId::next()
+{
+    uint8_t idx = 0;
+    while (idx < id.size() && id.test(idx))
+    {
+        ++idx;
+    }
+
+    if (idx == id.size())
+    {
+        throw std::runtime_error("No free instance ids");
+    }
+
+    id.set(idx);
+    return idx;
+}
+
+} // namespace pldm