summaryrefslogtreecommitdiff
path: root/include/hybbx/instance.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/instance.h
#2
Diffstat (limited to 'include/hybbx/instance.h')
-rw-r--r--include/hybbx/instance.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/include/hybbx/instance.h b/include/hybbx/instance.h
new file mode 100644
index 0000000..9ed07d3
--- /dev/null
+++ b/include/hybbx/instance.h
@@ -0,0 +1,61 @@
+#ifndef HYBBX_INSTANCE_H
+#define HYBBX_INSTANCE_H
+
+#include "hybbx/networks.h"
+#include "hybbx/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Hardcoded network layout instance (compile-time per binary).
+ *
+ * hybbxd — Main (local BBX; WebSocket user path; hub + mains_proxy)
+ * hybbxsd — Secondary (other-Main peers via mains_proxy; no user BBX)
+ * hybbxpd — Proxy (hybrid bridge; no WebSocket; no in-process AX.25)
+ *
+ * SSoT: vault projects/hybbx/2026-07-16-network-layout-instances.md
+ */
+typedef enum hybbx_instance_role {
+ HYBBX_INSTANCE_MAIN = 1,
+ HYBBX_INSTANCE_SECONDARY = 2,
+ HYBBX_INSTANCE_PROXY = 3
+} hybbx_instance_role_t;
+
+hybbx_instance_role_t hybbx_instance_role(void);
+
+/**
+ * Standalone Main (hybbxd + local RF on one host).
+ * Set from INI `[instance] standalone=yes` or auto when Main INI enables local RF.
+ */
+void hybbx_instance_set_standalone(int enabled);
+int hybbx_instance_standalone(void);
+
+/** "hybbxd" / "hybbxsd" / "hybbxpd" */
+const char *hybbx_instance_binary_name(void);
+
+/** Short role label: "Main" / "Secondary" / "Proxy". */
+const char *hybbx_instance_role_name(void);
+
+/** Non-zero when this instance runs local user BBX (login/mail/chat). */
+int hybbx_instance_offers_user_bbx(void);
+
+/**
+ * Apply hard layout rules to @p networks (force/clear flags).
+ * Logs warnings when INI requested a forbidden combination.
+ * Returns HYBBX_OK, or HYBBX_ERR_INVALID when the role cannot start safely.
+ */
+hybbx_result_t hybbx_networks_enforce_instance(hybbx_networks_config_t *networks);
+
+/**
+ * Non-zero when @p plugin_name may be registered/started for this instance.
+ * Complements [networks] wanted checks.
+ */
+int hybbx_instance_plugin_allowed(const char *plugin_name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HYBBX_INSTANCE_H */
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com