Files
utun2/tools/chatgui-android/libutun_lite/utun_config_api.h
T
evgeny a97e8bcc1f docs: update file inventory and module header contracts
Refresh both AGENTS guides and clarify module purpose, usage, ownership, threading, return values and wire formats in headers. Remove the unused timeout_heap freed_count field and unimplemented getter.
2026-10-04 13:10:01 +02:00

56 lines
2.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* Callback-провайдер отдельных настроек native-обёртки. Без провайдера/accessor возвращает default.
* Основной конфиг ядра передаётся INI-текстом в instance_lite_start, а не через этот интерфейс.
* set_provider заимствует таблицу callbacks; она и возвращаемые строки должны жить во время вызовов.
* Провайдер установить до запуска потребителей: синхронизации внутри модуля нет.
*/
#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 */