- u_async.c: process immediate_queue BEFORE epoll_wait in uasync_poll - stcp_link.c: defensive NULL etcp_conn/etcp_link in stcp_link_close - utun_instance.c: move stcp_server_list_destroy_all to Phase J (before ETCP), add deferred drain in both Phase J and L - stcp.h/c: STCP_HS_ENC_CLIENT 6→38, STCP_HS_ENC_SERVER 7→39, exchange ed25519_pubkey in both handshake directions - etcp_connections.c: copy peer_ed25519 from STCP to ETCP_CONN in etcp_link_enter_ready_tcp; guard link->etcp in tcp_link_close_cb - chat_sync.c: fix lk->conn NULL dereference for TCP links - test_stcp.c: update stcp_server_create/stcp_client_connect callsites - tools/chat_tcp_test: change transport udp→tcp
50 lines
1.6 KiB
C
50 lines
1.6 KiB
C
/*
|
|
* headless_control.h — JSON control socket for uTun headless mode
|
|
*
|
|
* JSON line protocol:
|
|
* Request: {"id":N,"cmd":"<command>",...params}
|
|
* Response: {"id":N,"ok":true,"data":{...}} | {"id":N,"ok":false,"error":"..."}
|
|
* Event: {"event":"<type>",...}
|
|
*
|
|
* 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 <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
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 */
|