platform-mc: PDR handling

Get PDRs of new terminus if it supports GetPDR PLDM command. It doesn't
handle the event receiver related initialization steps, and either
doesn't support primary PDR repository to maintain terminus locator PDR
information yet.
Added parse PDR member functions to terminus class for parsing Numeric
sensor PDR and sensor auxiliary names PDR.
Added sensor auxiliary names PDR and numeric sensor PDR struct in
libpldm/platform.h

Signed-off-by: Gilbert Chen <gilbert.chen@arm.com>
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: I30a0cc594a3c08fc17f2dad861b5c5d41c80ebdd
diff --git a/platform-mc/terminus.hpp b/platform-mc/terminus.hpp
index 6957fb3..3a1a302 100644
--- a/platform-mc/terminus.hpp
+++ b/platform-mc/terminus.hpp
@@ -11,6 +11,9 @@
 
 #include <algorithm>
 #include <bitset>
+#include <string>
+#include <tuple>
+#include <utility>
 #include <vector>
 
 namespace pldm
@@ -18,6 +21,14 @@
 namespace platform_mc
 {
 
+using SensorId = uint16_t;
+using SensorCnt = uint8_t;
+using NameLanguageTag = std::string;
+using SensorName = std::string;
+using SensorAuxiliaryNames = std::tuple<
+    SensorId, SensorCnt,
+    std::vector<std::vector<std::pair<NameLanguageTag, SensorName>>>>;
+
 /**
  * @brief Terminus
  *
@@ -68,6 +79,11 @@
 
         return true;
     }
+
+    /** @brief Parse the PDRs stored in the member variable, pdrs.
+     */
+    void parseTerminusPDRs();
+
     /** @brief The getter to return terminus's TID */
     pldm_tid_t getTid()
     {
@@ -80,7 +96,46 @@
     /** @brief A flag to indicate if terminus has been initialized */
     bool initialized = false;
 
+    /** @brief Get Sensor Auxiliary Names by sensorID
+     *
+     *  @param[in] id - sensor ID
+     *  @return sensor auxiliary names
+     */
+    std::shared_ptr<SensorAuxiliaryNames> getSensorAuxiliaryNames(SensorId id);
+
   private:
+    /** @brief Parse the numeric sensor PDRs
+     *
+     *  @param[in] pdrData - the response PDRs from GetPDR command
+     *  @return pointer to numeric sensor info struct
+     */
+    std::shared_ptr<pldm_numeric_sensor_value_pdr>
+        parseNumericSensorPDR(const std::vector<uint8_t>& pdrData);
+
+    /** @brief Parse the sensor Auxiliary name PDRs
+     *
+     *  @param[in] pdrData - the response PDRs from GetPDR command
+     *  @return pointer to sensor Auxiliary name info struct
+     */
+    std::shared_ptr<SensorAuxiliaryNames>
+        parseSensorAuxiliaryNamesPDR(const std::vector<uint8_t>& pdrData);
+
+    /** @brief Parse the compact numeric sensor PDRs
+     *
+     *  @param[in] pdrData - the response PDRs from GetPDR command
+     *  @return pointer to compact numeric sensor info struct
+     */
+    std::shared_ptr<pldm_compact_numeric_sensor_pdr>
+        parseCompactNumericSensorPDR(const std::vector<uint8_t>& pdrData);
+
+    /** @brief Parse the sensor Auxiliary name from compact numeric sensor PDRs
+     *
+     *  @param[in] pdrData - the response PDRs from GetPDR command
+     *  @return pointer to sensor Auxiliary name info struct
+     */
+    std::shared_ptr<SensorAuxiliaryNames>
+        parseCompactNumericSensorNames(const std::vector<uint8_t>& pdrData);
+
     /* @brief The terminus's TID */
     pldm_tid_t tid;
 
@@ -96,6 +151,10 @@
      *         PLDM_MAX_TYPES * (PLDM_MAX_CMDS_PER_TYPE / 8).
      */
     std::vector<uint8_t> supportedCmds;
+
+    /* @brief Sensor Auxiliary Name list */
+    std::vector<std::shared_ptr<SensorAuxiliaryNames>>
+        sensorAuxiliaryNamesTbl{};
 };
 } // namespace platform_mc
 } // namespace pldm