control: Add basic MCTP Control Protocol handler

This will respond to the 4 mandatory MCTP Control Protocol commands.
Applications can register supported types using mctp_control_add_type().

Change-Id: Ia904bcbe118626adf9254ffa71dd8e17fbdfc9b7
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
diff --git a/core-internal.h b/core-internal.h
index c8e7b25..ef0fc83 100644
--- a/core-internal.h
+++ b/core-internal.h
@@ -28,6 +28,10 @@
 #define MCTP_DEFAULT_CLOCK_GETTIME 1
 #endif
 
+#ifndef MCTP_CONTROL_HANDLER
+#define MCTP_CONTROL_HANDLER 1
+#endif
+
 /* Tag expiry timeout, in milliseconds */
 static const uint64_t MCTP_TAG_TIMEOUT = 6000;
 
@@ -84,6 +88,14 @@
 	uint64_t expiry;
 };
 
+#define MCTP_CONTROL_MAX_TYPES 10
+
+struct mctp_control {
+	/* Types to report from Get MCTP Version Support */
+	uint8_t msg_types[MCTP_CONTROL_MAX_TYPES];
+	size_t num_msg_types;
+};
+
 struct mctp {
 	int n_busses;
 	struct mctp_bus busses[MCTP_MAX_BUSSES];
@@ -110,6 +122,10 @@
 	} route_policy;
 	size_t max_message_size;
 
+#if MCTP_CONTROL_HANDLER
+	struct mctp_control control;
+#endif
+
 	void *alloc_ctx;
 
 	uint64_t (*platform_now)(void *);