/* * headless_control.h — JSON control socket for uTun headless mode * * JSON line protocol: * Request: {"id":N,"cmd":"",...params} * Response: {"id":N,"ok":true,"data":{...}} | {"id":N,"ok":false,"error":"..."} * Event: {"event":"",...} * * Commands: * ping — alive check * status — node info, uptime, connections * connect — STCP connect to peer * disconnect — STCP disconnect * connections — list active connections * create_channel — create chat channel * channels — list channels * send — send message to channel * messages — get messages from channel * debug_level — get/set debug levels * subscribe — subscribe to events * join — join channel via invite link * quit — disconnect client * * Events (after subscribe): * log — {"event":"log","level":"info","cat":"ETCP","msg":"..."} * msg — {"event":"msg","ch":"id","author":"hex","ts":123} * peer_online/offline * channel_created/joined */ #ifndef HEADLESS_CONTROL_H #define HEADLESS_CONTROL_H #include #include struct UASYNC; /* ── Lifecycle ── */ int headless_control_init(struct UASYNC* ua, const char* bind_ip, int port); void headless_control_poll(void); void headless_control_destroy(void); /* ── Send event to all subscribed clients ── */ void headless_control_event(const char* json_event); void headless_control_broadcast_log(const char* level, const char* category, const char* msg); #endif /* HEADLESS_CONTROL_H */