- 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
57 lines
1.8 KiB
C
57 lines
1.8 KiB
C
/*
|
|
* utun_config_api.h — configuration provider API for Android
|
|
*
|
|
* C core requests config values from Kotlin via callbacks.
|
|
* For headless, a stub provider reads from environment variables.
|
|
* For Android, JNI bridge sets callbacks that query Kotlin DataStore.
|
|
*/
|
|
#ifndef UTUN_CONFIG_API_H
|
|
#define UTUN_CONFIG_API_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* ── Config provider interface ── */
|
|
|
|
typedef struct {
|
|
const char* (*get_string)(const char* key, const char* default_val);
|
|
int64_t (*get_int64)(const char* key, int64_t default_val);
|
|
int (*get_int)(const char* key, int default_val);
|
|
int (*get_bool)(const char* key, int default_val);
|
|
} utun_config_provider_t;
|
|
|
|
void utun_config_set_provider(const utun_config_provider_t* provider);
|
|
|
|
/* ── Key constants (used by C code to request values) ── */
|
|
|
|
#define CFG_KEY_NODE_PRIVATE_KEY "node.private_key"
|
|
#define CFG_KEY_NODE_PUBLIC_KEY "node.public_key"
|
|
#define CFG_KEY_NODE_NAME "node.name"
|
|
#define CFG_KEY_NODE_LISTEN_PORT "node.listen_port"
|
|
|
|
#define CFG_KEY_CONTROL_PORT "control.port"
|
|
#define CFG_KEY_CONTROL_BIND_IP "control.bind_ip"
|
|
|
|
#define CFG_KEY_DB_PATH "db.path"
|
|
|
|
#define CFG_KEY_DEBUG_CONSOLE_LEVEL "debug.console_level"
|
|
#define CFG_KEY_DEBUG_FILE_LEVEL "debug.file_level"
|
|
#define CFG_KEY_DEBUG_LOG_FILE "debug.log_file"
|
|
#define CFG_KEY_DEBUG_CATEGORIES "debug.categories"
|
|
|
|
/* ── Convenience accessors ── */
|
|
|
|
const char* cfg_get_string(const char* key, const char* def);
|
|
int64_t cfg_get_int64(const char* key, int64_t def);
|
|
int cfg_get_int(const char* key, int def);
|
|
int cfg_get_bool(const char* key, int def);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif /* UTUN_CONFIG_API_H */
|