base: Provide pldm_msg_hdr_correlate_response()
Users of the asynchronous pldm_transport_send_msg() and
pldm_transport_recv_msg() APIs likely need some way to correlate a
received message as a response to a sent request.
Change-Id: I232400aebf06845e3eabf24205e31aa5668de9ba
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/src/base.c b/src/base.c
index 02dca1a..39dcd65 100644
--- a/src/base.c
+++ b/src/base.c
@@ -65,6 +65,15 @@
return PLDM_SUCCESS;
}
+LIBPLDM_ABI_TESTING
+bool pldm_msg_hdr_correlate_response(const struct pldm_msg_hdr *req,
+ const struct pldm_msg_hdr *resp)
+{
+ return req->instance_id == resp->instance_id && req->request &&
+ !resp->request && req->type == resp->type &&
+ req->command == resp->command;
+}
+
LIBPLDM_ABI_STABLE
int encode_get_types_req(uint8_t instance_id, struct pldm_msg *msg)
{