Implement FRURecordTableMetadata and FRURecordTable command

This commit implements the GetFRURecordTableMetadata and GetFRURecordTable
in the PLDM specification DSP0257 for FRU data specification. The FRU table
is populated by the FRU handler class with the configs from the path
/usr/share/pldm/fru.

Tested:

On a Witherspoon system the Get FRURecordTableMetadata and FRURecordTable
command were executed and ensured the FRU table in the command response
matches with the D-Bus inventory properties.

Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Change-Id: I16d36df2834b65bfa5f69164d3a40eeac2c7f357
diff --git a/libpldmresponder/fru.hpp b/libpldmresponder/fru.hpp
index 3f817fd..06411a8 100644
--- a/libpldmresponder/fru.hpp
+++ b/libpldmresponder/fru.hpp
@@ -121,6 +121,52 @@
                          const fru_parser::FruRecordInfos& recordInfos);
 };
 
+namespace fru
+{
+
+class Handler : public CmdHandler
+{
+
+  public:
+    Handler(const std::string configPath) : impl(configPath)
+    {
+        handlers.emplace(PLDM_GET_FRU_RECORD_TABLE_METADATA,
+                         [this](const pldm_msg* request, size_t payloadLength) {
+                             return this->getFRURecordTableMetadata(
+                                 request, payloadLength);
+                         });
+
+        handlers.emplace(PLDM_GET_FRU_RECORD_TABLE,
+                         [this](const pldm_msg* request, size_t payloadLength) {
+                             return this->getFRURecordTable(request,
+                                                            payloadLength);
+                         });
+    }
+
+    FruImpl impl;
+
+    /** @brief Handler for Get FRURecordTableMetadata
+     *
+     *  @param[in] request - Request message payload
+     *  @param[in] payloadLength - Request payload length
+     *
+     *  @return PLDM response message
+     */
+    Response getFRURecordTableMetadata(const pldm_msg* request,
+                                       size_t payloadLength);
+
+    /** @brief Handler for GetFRURecordTable
+     *
+     *  @param[in] request - Request message payload
+     *  @param[in] payloadLength - Request payload length
+     *
+     *  @return PLDM response message
+     */
+    Response getFRURecordTable(const pldm_msg* request, size_t payloadLength);
+};
+
+} // namespace fru
+
 } // namespace responder
 
 } // namespace pldm