libpldm:Change in the PlatformEventMessage field
This commit does a change in the field name in
PlatformEventMessage responder flow encode, to
allign the naming to the spec.
Tested: with unit tests
Change-Id: I309cdfbf6ebc213944676912246e7fe5e825706b
Signed-off-by: Pavithra Barithaya <pbaritha@in.ibm.com>
diff --git a/libpldm/platform.c b/libpldm/platform.c
index 21c5802..2ec8931 100644
--- a/libpldm/platform.c
+++ b/libpldm/platform.c
@@ -583,7 +583,8 @@
}
int encode_platform_event_message_resp(uint8_t instance_id,
- uint8_t completion_code, uint8_t status,
+ uint8_t completion_code,
+ uint8_t platform_event_status,
struct pldm_msg *msg)
{
int rc = PLDM_SUCCESS;
@@ -592,10 +593,14 @@
return PLDM_ERROR_INVALID_DATA;
}
+ if (platform_event_status > PLDM_EVENT_LOGGING_REJECTED) {
+ return PLDM_ERROR_INVALID_DATA;
+ }
+
struct pldm_platform_event_message_resp *response =
(struct pldm_platform_event_message_resp *)msg->payload;
response->completion_code = completion_code;
- response->status = status;
+ response->platform_event_status = platform_event_status;
struct pldm_header_info header = {0};
header.msg_type = PLDM_RESPONSE;
diff --git a/libpldm/platform.h b/libpldm/platform.h
index 5bb110c..dd99633 100644
--- a/libpldm/platform.h
+++ b/libpldm/platform.h
@@ -407,7 +407,7 @@
*/
struct pldm_platform_event_message_resp {
uint8_t completion_code;
- uint8_t status;
+ uint8_t platform_event_status;
} __attribute__((packed));
/** @struct pldm_pdr_repository_chg_event_data
@@ -853,14 +853,16 @@
/** @brief Encode PlatformEventMessage response data
* @param[in] instance_id - Message's instance id
* @param[in] completion_code - PLDM completion code
- * @param[in] status - Response status of the event message command
+ * @param[in] platform_event_status - Response status of the event message
+ * command
* @param[out] msg - Message will be written to this
* @return pldm_completion_codes
* @note Caller is responsible for memory alloc and dealloc of param
* 'msg.payload'
*/
int encode_platform_event_message_resp(uint8_t instance_id,
- uint8_t completion_code, uint8_t status,
+ uint8_t completion_code,
+ uint8_t platform_event_status,
struct pldm_msg *msg);
/** @brief Decode sensorEventData response data
diff --git a/libpldm/tests/libpldm_platform_test.cpp b/libpldm/tests/libpldm_platform_test.cpp
index 548ab05..aa45c35 100644
--- a/libpldm/tests/libpldm_platform_test.cpp
+++ b/libpldm/tests/libpldm_platform_test.cpp
@@ -839,14 +839,14 @@
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t completionCode = 0;
uint8_t instanceId = 0x01;
- uint8_t status = 1;
+ uint8_t platformEventStatus = 0x01;
auto rc = encode_platform_event_message_resp(instanceId, PLDM_SUCCESS,
- status, response);
+ platformEventStatus, response);
EXPECT_EQ(rc, PLDM_SUCCESS);
EXPECT_EQ(completionCode, response->payload[0]);
- EXPECT_EQ(status, response->payload[1]);
+ EXPECT_EQ(platformEventStatus, response->payload[1]);
}
TEST(PlatformEventMessage, testBadEncodeResponse)