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.
35 lines
928 B
35 lines
928 B
/* |
|
* utun_config_api.c — configuration provider implementation |
|
*/ |
|
#include "utun_config_api.h" |
|
#include <string.h> |
|
|
|
static const utun_config_provider_t* g_provider = NULL; |
|
|
|
void utun_config_set_provider(const utun_config_provider_t* provider) { |
|
g_provider = provider; |
|
} |
|
|
|
const char* cfg_get_string(const char* key, const char* def) { |
|
if (g_provider && g_provider->get_string) |
|
return g_provider->get_string(key, def); |
|
return def; |
|
} |
|
|
|
int64_t cfg_get_int64(const char* key, int64_t def) { |
|
if (g_provider && g_provider->get_int64) |
|
return g_provider->get_int64(key, def); |
|
return def; |
|
} |
|
|
|
int cfg_get_int(const char* key, int def) { |
|
if (g_provider && g_provider->get_int) |
|
return g_provider->get_int(key, def); |
|
return def; |
|
} |
|
|
|
int cfg_get_bool(const char* key, int def) { |
|
if (g_provider && g_provider->get_bool) |
|
return g_provider->get_bool(key, def); |
|
return def; |
|
}
|
|
|