Add cc only response

For a PLDM operation resulting in an error,
unless otherwise specified, the responder shall not
return any additional parametric data.

It is useful to implement a cc-only response

Signed-off-by: John Wang <wangzqbj@inspur.com>
Change-Id: Iec5299f4c4043491aa62e0b94de7f9c12d0bee2e
diff --git a/libpldm/base.c b/libpldm/base.c
index 5927ba1..b34045c 100644
--- a/libpldm/base.c
+++ b/libpldm/base.c
@@ -367,3 +367,26 @@
 
 	return PLDM_SUCCESS;
 }
+
+int encode_cc_only_resp(uint8_t instance_id, uint8_t type, uint8_t command,
+			uint8_t cc, struct pldm_msg *msg)
+{
+	struct pldm_header_info header = {0};
+
+	if (msg == NULL) {
+		return PLDM_ERROR_INVALID_DATA;
+	}
+
+	header.instance = instance_id;
+	header.msg_type = PLDM_RESPONSE;
+	header.pldm_type = type;
+	header.command = command;
+	int rc = pack_pldm_header(&header, &msg->hdr);
+	if (rc != PLDM_SUCCESS) {
+		return rc;
+	}
+
+	msg->payload[0] = cc;
+
+	return PLDM_SUCCESS;
+}