- libutun_lite: C99 core, invite_link_c.h/c (compatible with desktop) - jni_bridge: android_jni_bridge.c/h with logcat logging - app: Jetpack Compose UI, CameraX + ML Kit QR scanner - JoinChannelDialog, QrScanScreen with proper camera lifecycle - headless: control socket with join command - OpenSSL prebuilt libs for arm64-v8a + x86_64
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 */
|