Invoke PLDM pack header API
Pack the PLDM header while encoding the GetPLDMTypes and GetPLDMCommands
messages.
Change-Id: Ic2413064a63c1a204738c2e0db78ee1537a4f7c3
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/libpldm/base.c b/libpldm/base.c
index 7354fb1..8d336e5 100644
--- a/libpldm/base.c
+++ b/libpldm/base.c
@@ -68,6 +68,12 @@
return PLDM_ERROR_INVALID_DATA;
}
+ struct pldm_header_info header = {0};
+ header.instance = instance_id;
+ header.msg_type = PLDM_REQUEST;
+ header.command = PLDM_GET_PLDM_TYPES;
+ pack_pldm_header(&header, &(msg->hdr));
+
return PLDM_SUCCESS;
}
@@ -78,6 +84,12 @@
return PLDM_ERROR_INVALID_DATA;
}
+ struct pldm_header_info header = {0};
+ header.instance = instance_id;
+ header.msg_type = PLDM_REQUEST;
+ header.command = PLDM_GET_PLDM_COMMANDS;
+ pack_pldm_header(&header, &(msg->hdr));
+
uint8_t *dst = msg->body.payload;
memcpy(dst, &type, sizeof(type));
dst += sizeof(type);
@@ -94,6 +106,13 @@
}
msg->body.payload[0] = completion_code;
+
+ struct pldm_header_info header = {0};
+ header.instance = instance_id;
+ header.msg_type = PLDM_RESPONSE;
+ header.command = PLDM_GET_PLDM_TYPES;
+ pack_pldm_header(&header, &(msg->hdr));
+
if (msg->body.payload[0] == PLDM_SUCCESS) {
if (types == NULL) {
return PLDM_ERROR_INVALID_DATA;
@@ -128,6 +147,13 @@
}
msg->body.payload[0] = completion_code;
+
+ struct pldm_header_info header = {0};
+ header.instance = instance_id;
+ header.msg_type = PLDM_RESPONSE;
+ header.command = PLDM_GET_PLDM_COMMANDS;
+ pack_pldm_header(&header, &(msg->hdr));
+
if (msg->body.payload[0] == PLDM_SUCCESS) {
if (commands == NULL) {
return PLDM_ERROR_INVALID_DATA;