PLDM Message Structure Change

With this change, PLDM code is optimised. The PLDM payload message
structure previously consisted of a pointer to the payload message and
the payload length, this structure is removed with this commit and the
PLDM message structure now has the PLDM header structure and an array of
size 1 whose address is the starting byte of message payload. Therefore,
pldm msg struct can represent a request/response message in contiguous
memory, thereby enabling simple casts and avoiding memcpys to get from a
uint8_t* to pldm msg or vice versa.

This commit also introduces a change to have the response handlers allocate
memory for responses. This is aligned with the message struct change, and
enables varying length responses.

Change-Id: Ia46d852b8b16bfc7cf04f38435bd4079ad33c66b
Signed-off-by: vkaverap <vkaverap@in.ibm.com>
diff --git a/libpldm/platform.h b/libpldm/platform.h
index 42169db..a5bfe4e 100644
--- a/libpldm/platform.h
+++ b/libpldm/platform.h
@@ -53,6 +53,7 @@
 /** @brief Decode SetStateEffecterStates request data
  *
  *  @param[in] msg - Request message payload
+ *  @param[in] payload_length - Length of request message payload
  *  @param[out] effecter_id - used to identify and access the effecter
  *  @param[out] comp_effecter_count - number of individual sets of effecter
  *         information. Upto eight sets of state effecter info can be accessed
@@ -66,7 +67,9 @@
  *         always, which is 8 in number.
  *  @return pldm_completion_codes
  */
-int decode_set_state_effecter_states_req(const struct pldm_msg_payload *msg,
+
+int decode_set_state_effecter_states_req(const uint8_t *msg,
+					 size_t payload_length,
 					 uint16_t *effecter_id,
 					 uint8_t *comp_effecter_count,
 					 set_effecter_state_field *field);
@@ -88,7 +91,7 @@
  *  @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.body.payload'
+ *         'msg.payload'
  */
 
 int encode_set_state_effecter_states_req(uint8_t instance_id,
@@ -99,12 +102,13 @@
 
 /** @brief Decode SetStateEffecterStates response data
  *  @param[in] msg - Request message payload
+ *  @param[in] payload_length - Length of response message payload
  *  @param[out] completion_code - PLDM completion code
  *  @return pldm_completion_codes
  */
-int decode_set_state_effecter_states_resp(const struct pldm_msg_payload *msg,
+int decode_set_state_effecter_states_resp(const uint8_t *msg,
+					  size_t payload_length,
 					  uint8_t *completion_code);
-
 #ifdef __cplusplus
 }
 #endif