summaryrefslogtreecommitdiff
path: root/include/hybbx/instance.h
blob: 9ed07d38ba329dce7b361ca9a8b403a9a54c4255 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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