Decode APIs now accept const struct pldm_msg *msg
All the decode_xxx APIs were changed to accept the complete pldm_msg
instead of working with just a specific member (payload) making it
consistent with the encode_xxx APIs.
Following changes were made through out the code,
- decode_xxx now requires to send the const struct pldm_msg *msg
instead of a const uint8_t *msg.
- Within the decode_xxx function the payload is extracted and used
accordingly.
- All the calls made to decode_xxx APIs have been modified to now
pass the pointer to pldm_msg_hdr (struct pldm_msg *msg).
- The test code was modified to now pass the appropriate data
to all the encode_xxx APIs.
Change-Id: I16a3f6e554ea2c9fa44d55dc8f21f65022bd983a
Signed-off-by: Zahed Hossain <zahzahed@in.ibm.com>
diff --git a/libpldmresponder/base.cpp b/libpldmresponder/base.cpp
index 43bcc12..fc4ddf6 100644
--- a/libpldmresponder/base.cpp
+++ b/libpldmresponder/base.cpp
@@ -73,8 +73,7 @@
Response response(sizeof(pldm_msg_hdr) + PLDM_GET_COMMANDS_RESP_BYTES, 0);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
- auto rc = decode_get_commands_req(request->payload, payloadLength, &type,
- &version);
+ auto rc = decode_get_commands_req(request, payloadLength, &type, &version);
if (rc != PLDM_SUCCESS)
{
@@ -116,8 +115,8 @@
Response response(sizeof(pldm_msg_hdr) + PLDM_GET_VERSION_RESP_BYTES, 0);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
- uint8_t rc = decode_get_version_req(request->payload, payloadLength,
- &transferHandle, &transferFlag, &type);
+ uint8_t rc = decode_get_version_req(request, payloadLength, &transferHandle,
+ &transferFlag, &type);
if (rc != PLDM_SUCCESS)
{