core: Allow running without heap allocations
Replace buses with a static array, and add mctp_setup/mctp_cleanup
to use an existing struct.
__mctp_alloc() and __mctp_free() no longer need to be functional, though
are used as defaults if m_msg_alloc/m_msg_free are not provided.
Change-Id: Ib5826836efb59e416410b25f138cbaf5931278f3
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
diff --git a/libmctp.h b/libmctp.h
index a3e1331..680dc39 100644
--- a/libmctp.h
+++ b/libmctp.h
@@ -82,13 +82,21 @@
/* MCTP core */
+/* Allocate and setup a MCTP instance */
struct mctp *mctp_init(void);
+/* Cleanup and deallocate a MCTP instance from mctp_init() */
+void mctp_destroy(struct mctp *mctp);
+
+/* Setup a MCTP instance */
+void mctp_setup(struct mctp *mctp);
+/* Release resource of a MCTP instance */
+void mctp_cleanup(struct mctp *mctp);
+
void mctp_set_max_message_size(struct mctp *mctp, size_t message_size);
typedef void (*mctp_capture_fn)(struct mctp_pktbuf *pkt, bool outgoing,
void *user);
void mctp_set_capture_handler(struct mctp *mctp, mctp_capture_fn fn,
void *user);
-void mctp_destroy(struct mctp *mctp);
/* Register a binding to the MCTP core, and creates a bus (populating
* binding->bus).