From 3b134cc43965c1c196734be7a162da7cddeeafc8 Mon Sep 17 00:00:00 2001 From: cbdev Date: Thu, 1 Jul 2021 22:34:24 +0200 Subject: Factor out explicit frontend API --- core/core.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 core/core.h (limited to 'core/core.h') diff --git a/core/core.h b/core/core.h new file mode 100644 index 0000000..3237a71 --- /dev/null +++ b/core/core.h @@ -0,0 +1,43 @@ +/* + * MIDIMonster frontend API + * + * These APIs expose the core as a linkable module. Frontends will use these calls + * as primary interface to interact with the MIDIMonster core. + * + * The lifecycle is as follows: + * + * * Initially, only the following API calls are valid: + * config_add_override() + * core_initialize() + * This allows the frontend to configure overrides for any configuration + * loaded later (e.g. by parsing command line arguments) before initializing + * the core. + * * Calling core_initialize() attaches all backend modules to the system and + * performs platform specific startup operations. From this point on, + * core_shutdown() must be called before terminating the frontend. + * All frontend API calls except `core_iteration` are now valid. + * The core is now in the configuration stage in which the frontend + * will push any configuration files. + * * Calling core_start() marks the transition from the configuration phase + * to the translation phase. The core will activate any configured backends + * and provide them with the information required to connect to their data + * sources and sinks. In this stage, only the following API calls are valid: + * core_iteration() + * core_shutdown() + * * The frontend will now repeatedly call core_iteration() to process any incoming + * events. This API will block execution until either one or more events have + * been registered or an internal timeout expires. + * * Calling core_shutdown() releases all memory allocated by the core and any + * attached modules or plugins, including all configuration, overrides, + * mappings, statistics, etc. The core is now ready to exit or be + * reinitialized using core_initialize(). + */ + +int core_initialize(); +int core_start(); +int core_iteration(); +void core_shutdown(); + +/* Public backend API */ +MM_API uint64_t mm_timestamp(); +MM_API int mm_manage_fd(int new_fd, char* back, int manage, void* impl); -- cgit v1.2.3