libpldm : Add decode API for QueryDeviceIdentifiers cmd
QueryDeviceIdentifiers command is used by update agent to obtain the
firmware identifiers for the firmware device and its defined in DSP0267
Version 1.1.0 sec:10.1.
Tested: Unit tests passed
Signed-off-by: gokulsanker <gokul.sanker.v.g@intel.com>
Change-Id: I9ef81ce75aaedaae2fff9f5632ce16aa952cda17
diff --git a/libpldm/firmware_update.h b/libpldm/firmware_update.h
index dbff92d..6ebfa79 100644
--- a/libpldm/firmware_update.h
+++ b/libpldm/firmware_update.h
@@ -7,11 +7,25 @@
#include "base.h"
#define PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES 0
+/** @brief Minimum length of device descriptor, 2 bytes for descriptor type,
+ * 2 bytes for descriptor length and atleast 1 byte of descriptor data
+ */
+#define PLDM_FWUP_DEVICE_DESCRIPTOR_MIN_LEN 5
/** @brief PLDM Firmware update commands
*/
enum pldm_firmware_update_commands { PLDM_QUERY_DEVICE_IDENTIFIERS = 0x01 };
+/** @struct pldm_query_device_identifiers_resp
+ *
+ * Structure representing query device identifiers response.
+ */
+struct pldm_query_device_identifiers_resp {
+ uint8_t completion_code;
+ uint32_t device_identifiers_len;
+ uint8_t descriptor_count;
+} __attribute__((packed));
+
/** @brief Create a PLDM request message for QueryDeviceIdentifiers
*
* @param[in] instance_id - Message's instance id
@@ -26,6 +40,24 @@
int encode_query_device_identifiers_req(uint8_t instance_id,
size_t payload_length,
struct pldm_msg *msg);
+
+/** @brief Decode QueryDeviceIdentifiers response message
+ *
+ * @param[in] msg - Response message
+ * @param[in] payload_length - Length of response message payload
+ * @param[out] completion_code - Pointer to response msg's PLDM completion code
+ * @param[out] device_identifiers_len - Pointer to device identifiers length
+ * @param[out] descriptor_count - Pointer to descriptor count
+ * @param[out] descriptor_data - Pointer to descriptor data
+ *
+ * @return pldm_completion_codes
+ */
+int decode_query_device_identifiers_resp(const struct pldm_msg *msg,
+ size_t payload_length,
+ uint8_t *completion_code,
+ uint32_t *device_identifiers_len,
+ uint8_t *descriptor_count,
+ uint8_t **descriptor_data);
#ifdef __cplusplus
}
#endif