Support `terminus_name` option in `dbus_to_terminus_effecter`

Support `terminus_name` configuration option in
`dbus_to_terminus_effecter` to allow setting the destination terminus
beside `mctp_eid`. This is helpful when the mctp endpoint Eid is not
static.

Change-Id: I8b1ed15741807086254146017c99c13ae667dac1
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
diff --git a/platform-mc/terminus_manager.cpp b/platform-mc/terminus_manager.cpp
index 1086292..c64c0c3 100644
--- a/platform-mc/terminus_manager.cpp
+++ b/platform-mc/terminus_manager.cpp
@@ -734,5 +734,44 @@
     co_return completionCode;
 }
 
+std::optional<mctp_eid_t> TerminusManager::getActiveEidByName(
+    const std::string& terminusName)
+{
+    if (!termini.size() || terminusName.empty())
+    {
+        return std::nullopt;
+    }
+
+    for (auto& [tid, terminus] : termini)
+    {
+        if (!terminus)
+        {
+            continue;
+        }
+
+        auto tmp = terminus->getTerminusName();
+        if (!tmp || std::empty(*tmp) || *tmp != terminusName)
+        {
+            continue;
+        }
+
+        try
+        {
+            auto mctpInfo = toMctpInfo(tid);
+            if (!mctpInfo || !mctpInfoAvailTable[*mctpInfo])
+            {
+                return std::nullopt;
+            }
+
+            return std::get<0>(*mctpInfo);
+        }
+        catch (const std::exception& e)
+        {
+            return std::nullopt;
+        }
+    }
+
+    return std::nullopt;
+}
 } // namespace platform_mc
 } // namespace pldm