summaryrefslogtreecommitdiff
path: root/include/hybbx/plugin.h
diff options
context:
space:
mode:
authorinfo@mode42.com <info@mode42.com>2026-08-08 03:54:55 +0000
committerinfo@mode42.com <info@mode42.com>2026-08-08 03:54:55 +0000
commit20cb29c2f8c5c87bc590896854a20b1473ceb358 (patch)
tree2857f41513a56ad41af97b57362639298aa7f033 /include/hybbx/plugin.h
#2
Diffstat (limited to 'include/hybbx/plugin.h')
-rw-r--r--include/hybbx/plugin.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/include/hybbx/plugin.h b/include/hybbx/plugin.h
new file mode 100644
index 0000000..ea72a65
--- /dev/null
+++ b/include/hybbx/plugin.h
@@ -0,0 +1,75 @@
+#ifndef HYBBX_PLUGIN_H
+#define HYBBX_PLUGIN_H
+
+#include "hybbx/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct hybbx_service;
+struct hybbx_session;
+
+/**
+ * Transport plugin interface (link adapters / host-client bridges).
+ *
+ * HyBBX is plugin-only: session core + plugins. Modems, TNCs, sound-card
+ * software, ARDOPC, and CRDOPC are external — never embedded in HyBBX.
+ *
+ * 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.
+ */
+typedef struct hybbx_transport_plugin {
+ const char *name;
+ hybbx_transport_kind_t kind;
+ unsigned int version;
+
+ /** Called once when the plugin is loaded. */
+ hybbx_result_t (*init)(struct hybbx_service *service);
+
+ /** Called once when the plugin is unloaded. */
+ void (*shutdown)(void);
+
+ /**
+ * Start listening / accepting connections on the given bind address.
+ * @p config is a semicolon-separated key=value string built from the
+ * transport's INI section (e.g. "bind=0.0.0.0;port=2323").
+ */
+ hybbx_result_t (*start)(const char *config);
+
+ /** Stop accepting new connections; existing sessions may continue. */
+ hybbx_result_t (*stop)(void);
+
+ /**
+ * Send raw bytes to the connected client for this session.
+ * NULL → core writes to stdout (development fallback).
+ */
+ hybbx_result_t (*write)(struct hybbx_session *session,
+ const char *data, size_t len);
+
+} hybbx_transport_plugin_t;
+
+/**
+ * Session callbacks invoked by a transport plugin when a client connects.
+ */
+typedef struct hybbx_session_ops {
+ hybbx_result_t (*on_connect)(struct hybbx_session *session, void *userdata);
+ hybbx_result_t (*on_data)(struct hybbx_session *session,
+ const uint8_t *data, size_t len,
+ void *userdata);
+ void (*on_disconnect)(struct hybbx_session *session, void *userdata);
+} hybbx_session_ops_t;
+
+/** Opaque session handle passed between core and transport plugins. */
+typedef struct hybbx_session {
+ const hybbx_transport_plugin_t *transport;
+ void *transport_data;
+ void *core_data;
+} hybbx_session_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HYBBX_PLUGIN_H */
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com