platform-mc: Terminus name handling
`PLDM-stack: Adding sensor monitoring section` design spec details that
the `Terminus name` is required to create the terminus's sensors,
states, effecters... D-Bus interfaces and `Terminus Name` can be
encoded in the Terminus's `Entity Auxiliary Names PDR` or in the MCTP
Entity-manager endpoint EID configuration file.
[1] https://gerrit.openbmc.org/c/openbmc/docs/+/47252/34/designs/pldm-stack.md#433
Section `28.18 Entity Auxiliary Names PDR` in DSP0248 V1.2.2 details
about the PDRs response for the name of one PLDM entity. When the
containerID is `0x0000` this entity is `Overall system` or `top most
containing entity`. The name of this entity will can be used as
`Terminus name`.
Support parsing `Entity Auxiliary Names PDR` and find the `Terminus
name` if it is reponsed in the terminus' PDRs. `Terminus Name` string
will be assigned to local variable and can be used as prefix for
sensors, state, effecters... names.
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: I701537c48651b9de86de77941b752e30de112916
diff --git a/common/utils.hpp b/common/utils.hpp
index 103783d..6b8ea7c 100644
--- a/common/utils.hpp
+++ b/common/utils.hpp
@@ -526,5 +526,15 @@
* @param[in] present - status to set either true/false
*/
void setFruPresence(const std::string& fruObjPath, bool present);
+
+/** @brief Trim `\0` in string and replace ` ` by `_` to use name in D-Bus
+ * object path
+ *
+ * @param[in] name - the input string
+ *
+ * @return the result string
+ */
+std::string_view trimNameForDbus(std::string& name);
+
} // namespace utils
} // namespace pldm