summaryrefslogtreecommitdiff
path: root/include/hybbx/plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/hybbx/plugin.h')
-rw-r--r--include/hybbx/plugin.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/hybbx/plugin.h b/include/hybbx/plugin.h
index ea72a65..9a51211 100644
--- a/include/hybbx/plugin.h
+++ b/include/hybbx/plugin.h
@@ -9,6 +9,7 @@ extern "C" {
struct hybbx_service;
struct hybbx_session;
+struct hybbx_parsed_command;
/**
* Transport plugin interface (link adapters / host-client bridges).
@@ -19,6 +20,10 @@ struct hybbx_session;
* Core uses TCP/IPv4+IPv6 and HBX internally. Plugins terminate the wire
* to external services (telnet TCP, serial TNC, ARDOP host TCP, …) and
* expose a byte stream to hybbx_session via the write callback.
+ *
+ * Optional extensions (NULL = not used):
+ * tick — called every ~1s from service loop (game clocks, AI, …)
+ * on_command — intercept "/verb" before core dispatch (entertainment, …)
*/
typedef struct hybbx_transport_plugin {
const char *name;
@@ -48,6 +53,21 @@ typedef struct hybbx_transport_plugin {
hybbx_result_t (*write)(struct hybbx_session *session,
const char *data, size_t len);
+ /**
+ * Periodic tick — called every ~1 second from the service loop.
+ * NULL → no periodic work. Used by game clocks, AI timers, etc.
+ */
+ void (*tick)(struct hybbx_service *service);
+
+ /**
+ * Command intercept — called before core command dispatch.
+ * Return HYBBX_OK if handled, HYBBX_ERR_NOT_FOUND to fall through.
+ * NULL → no command handling.
+ */
+ hybbx_result_t (*on_command)(struct hybbx_service *service,
+ struct hybbx_session *session,
+ const struct hybbx_parsed_command *cmd);
+
} hybbx_transport_plugin_t;
/**
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com