libpldmresponder: Implement GetFRURecordByOption
Implement handler for GetFRURecordByOption command
Signed-off-by: John Wang <wangzqbj@inspur.com>
Change-Id: If2bc90872b2521f1771aa800de6fbce569a5b339
diff --git a/libpldmresponder/fru.hpp b/libpldmresponder/fru.hpp
index 2597dc4..b19519c 100644
--- a/libpldmresponder/fru.hpp
+++ b/libpldmresponder/fru.hpp
@@ -106,6 +106,18 @@
*/
void getFRUTable(Response& response);
+ /** @brief Get FRU Record Table By Option
+ * @param[out] response - Populate response with the FRU table got by
+ * options
+ * @param[in] fruTableHandle - The fru table handle
+ * @param[in] recordSetIdentifer - The record set identifier
+ * @param[in] recordType - The record type
+ * @param[in] fieldType - The field type
+ */
+ int getFRURecordByOption(Response& response, uint16_t fruTableHandle,
+ uint16_t recordSetIdentifer, uint8_t recordType,
+ uint8_t fieldType);
+
/** @brief FRU table is built by processing the D-Bus inventory namespace
* based on the config files for FRU. The table is populated based
* on the isBuilt flag.
@@ -166,6 +178,11 @@
return this->getFRURecordTable(request,
payloadLength);
});
+ handlers.emplace(PLDM_GET_FRU_RECORD_BY_OPTION,
+ [this](const pldm_msg* request, size_t payloadLength) {
+ return this->getFRURecordByOption(request,
+ payloadLength);
+ });
}
/** @brief Handler for Get FRURecordTableMetadata
@@ -195,6 +212,16 @@
impl.buildFRUTable();
}
+ /** @brief Handler for GetFRURecordByOption
+ *
+ * @param[in] request - Request message payload
+ * @param[in] payloadLength - Request payload length
+ *
+ * @return PLDM response message
+ */
+ Response getFRURecordByOption(const pldm_msg* request,
+ size_t payloadLength);
+
private:
FruImpl impl;
};