requester: Add new APIs to support multiple transports

This patch has two goals: (1) enable consumers to send PLDM messages
over different transports and (2) do this in a way that allows us to
move towards a cleaner and more complete set of requester APIs.

The sole transport option of MCTP via the userspace mctp-demux-daemon is
being deprecated. New transports are being added: MCTP via the kernel
(AF_MCTP) and eventually NC-SI. As such, the requester APIs need
updating to support multiple transports, as well as not having MCTP
specific details in the APIs. To avoid a flag day, the current APIs
(pldm_send, etc) have been rewritten terms of the new APIs.

The current APIs operate at the transport level - they don't implement
all of the behaviour necessary for a requester. As such, the new APIs to
send/recv a message have the prefix `pldm_transport`, rather than
`pldm_requester`. Given the level that these APIs are operating at,
these only send and receive a PLDM message.  Any additional logic, such
as looking for a response with a particular instance ID, belongs at the
requester abstraction level.

Some of the missing behaviours to fully be a PLDM requester are:
assigning instance IDs, request retransmission, implementing timeouts,
and enforcing only one PLDM request to a specific TID at a time. These
things are currently implemented in pldmd, meaning any consumer other
than pldmd using the libpldm "requester" APIs doesn't get the full
functionality of a requester and has to implement these things
themselves.

We would like to eventually move these behaviours into libpldm so the
libpldm requester APIs actually implement what is required to be a PLDM
requester.

The next steps to add in a full set of requester APIs, while enabling
the use of multiple transports looks something like this:

1) add instance id APIs into libpldm.
2) convert pldmd to use libpldm instance id APIs - so all users of PLDM
   are still using the same instance id allocation method.
3) convert all consumers of libpldm over to using the new libpldm APIs,
   including the instance id functions.
4) add in the AF_MCTP transport and move consumers over to it.
5) refactor the encode/decode functions to only encode/decode and not
   frame the message (ie, remove the instance id from these functions)
6) add additional requester functionality into libpldm, and have these
   use the `pldm_transport` APIs directly.
7) move consumers over to the new `pldm_requester` APIs.
8) remove unused code from pldmd.

Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com>
Change-Id: I06e602831f360bbd0efda53d410bfb5080b3100d
diff --git a/src/transport/transport.h b/src/transport/transport.h
new file mode 100644
index 0000000..28d7f9b
--- /dev/null
+++ b/src/transport/transport.h
@@ -0,0 +1,38 @@
+#ifndef TRANSPORT_H
+#define TRANSPORT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "libpldm/base.h"
+#include "libpldm/requester/pldm.h"
+struct pollfd;
+
+/**
+ * @brief Generic PLDM transport struct
+ *
+ * @var name - name of the transport
+ * @var version - version of transport to use
+ * @var recv - pointer to the transport specific function to receive a message
+ * @var send - pointer to the transport specific function to send a message
+ * @var init_pollfd - pointer to the transport specific init_pollfd function
+ */
+struct pldm_transport {
+	const char *name;
+	uint8_t version;
+	pldm_requester_rc_t (*recv)(struct pldm_transport *transport,
+				    pldm_tid_t tid, void **pldm_resp_msg,
+				    size_t *resp_msg_len);
+	pldm_requester_rc_t (*send)(struct pldm_transport *transport,
+				    pldm_tid_t tid, const void *pldm_req_msg,
+				    size_t req_msg_len);
+	int (*init_pollfd)(struct pldm_transport *transport,
+			   struct pollfd *pollfd);
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // TRANSPORT_H