You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

56 lines
1.8 KiB

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