Files
utun2/tools/chatgui-android/libutun_lite/utun_config_api.h
T
evgeny 9e58160480 android: initial chatgui-android project with QR join
- 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
2026-07-27 22:50:29 +03:00

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 */