platform-mc: Added Terminus/TerminusManager class

Added requester::sendRecvPldmMsg awaiter type to be able to send and
receive PLDM message by coroutine.
Added TerminusManager to discover terminus from EID list updated by
MCTPDiscovery class. The TerminusManager will initialize TID.

Signed-off-by: Gilbert Chen <gilbert.chen@arm.com>
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: Ifa5bdfff50648f1d7fba8710e160de662e8f9e06
diff --git a/platform-mc/test/mock_terminus_manager.hpp b/platform-mc/test/mock_terminus_manager.hpp
new file mode 100644
index 0000000..eb06734
--- /dev/null
+++ b/platform-mc/test/mock_terminus_manager.hpp
@@ -0,0 +1,74 @@
+#pragma once
+
+#include "platform-mc/terminus_manager.hpp"
+
+#include <queue>
+
+#include <gmock/gmock.h>
+
+namespace pldm
+{
+namespace platform_mc
+{
+
+class MockTerminusManager : public TerminusManager
+{
+  public:
+    MockTerminusManager(sdeventplus::Event& event, RequesterHandler& handler,
+                        pldm::InstanceIdDb& instanceIdDb,
+                        TerminiMapper& termini, Manager* manager) :
+        TerminusManager(event, handler, instanceIdDb, termini, manager)
+    {}
+
+    exec::task<int> sendRecvPldmMsgOverMctp(mctp_eid_t /*eid*/,
+                                            Request& /*request*/,
+                                            const pldm_msg** responseMsg,
+                                            size_t* responseLen) override
+    {
+        if (responseMsgs.empty() || responseMsg == nullptr ||
+            responseLen == nullptr)
+        {
+            co_return PLDM_ERROR;
+        }
+
+        *responseMsg = responseMsgs.front();
+        *responseLen = responseLens.front() - sizeof(pldm_msg_hdr);
+
+        responseMsgs.pop();
+        responseLens.pop();
+        co_return PLDM_SUCCESS;
+    }
+
+    int enqueueResponse(pldm_msg* responseMsg, size_t responseLen)
+    {
+        if (responseMsg == nullptr)
+        {
+            return PLDM_ERROR_INVALID_DATA;
+        }
+
+        if (responseLen <= sizeof(pldm_msg_hdr))
+        {
+            return PLDM_ERROR_INVALID_LENGTH;
+        }
+
+        responseMsgs.push(responseMsg);
+        responseLens.push(responseLen);
+        return PLDM_SUCCESS;
+    }
+
+    int clearQueuedResponses()
+    {
+        while (!responseMsgs.empty())
+        {
+            responseMsgs.pop();
+            responseLens.pop();
+        }
+        return PLDM_SUCCESS;
+    }
+
+    std::queue<pldm_msg*> responseMsgs;
+    std::queue<size_t> responseLens;
+};
+
+} // namespace platform_mc
+} // namespace pldm