2022-05-10 06:43:27 +00:00
|
|
|
//
|
|
|
|
// Created by xajhu on 2021/7/7 0007.
|
|
|
|
//
|
|
|
|
#include "config.h"
|
2022-06-02 08:18:43 +00:00
|
|
|
|
2023-01-13 08:44:43 +00:00
|
|
|
#ifdef USER_VNI
|
2023-01-11 08:04:11 +00:00
|
|
|
static int g_user_vni_id = -1;
|
|
|
|
|
|
|
|
void cfg_set_user_vni_id(int vni) {
|
|
|
|
if (g_user_vni_id != vni) {
|
|
|
|
g_user_vni_id = vni;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int cfg_get_user_vni_id() {
|
|
|
|
if (g_user_vni_id > 0xFFFFFF) {
|
|
|
|
return 0;
|
|
|
|
}
|
2023-01-13 08:44:43 +00:00
|
|
|
|
2023-01-11 08:04:11 +00:00
|
|
|
return g_user_vni_id;
|
|
|
|
}
|
2023-01-13 08:44:43 +00:00
|
|
|
#endif
|
2023-01-11 08:04:11 +00:00
|
|
|
|
2022-12-03 08:46:52 +00:00
|
|
|
unsigned int config_get_proto_crypto_type() {
|
|
|
|
return cfg_get_integral_value(CFG_PROTO_CRYPTO);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *config_get_proto_crypto_key() {
|
|
|
|
return cfg_get_string_value(CFG_PROTO_CRYPTO_KEY);
|
|
|
|
}
|
|
|
|
|
2022-11-30 09:57:52 +00:00
|
|
|
#ifdef OPENDHCPD_ON
|
2022-12-12 08:00:39 +00:00
|
|
|
unsigned int config_get_dhcp_server_lease_time() {
|
|
|
|
return cfg_get_integral_value(CFG_DHCP_LEASE_TIME);
|
|
|
|
}
|
|
|
|
|
|
|
|
c_vector config_get_dhcp_server_range_set() {
|
2022-11-22 01:49:33 +00:00
|
|
|
return cfg_get_vector(CFG_DHCP_RANGE_SET);
|
|
|
|
}
|
|
|
|
|
2022-12-12 08:00:39 +00:00
|
|
|
c_vector config_get_dhcp_listen_on() {
|
2022-11-23 01:20:38 +00:00
|
|
|
return cfg_get_vector(CFG_DHCP_LISTEN_ON);
|
|
|
|
}
|
|
|
|
|
2022-12-12 08:00:39 +00:00
|
|
|
c_vector config_get_dhcp_replication_svr() {
|
2022-11-23 01:20:38 +00:00
|
|
|
return cfg_get_vector(CFG_DHCP_REPLICATION_SVR);
|
|
|
|
}
|
2022-12-12 08:00:39 +00:00
|
|
|
|
|
|
|
c_vector config_get_dhcp_mac_filter() {
|
|
|
|
return cfg_get_vector(CFG_DHCP_MAC_FILTER);
|
|
|
|
}
|
2022-11-30 09:57:52 +00:00
|
|
|
#endif
|
2022-11-23 01:20:38 +00:00
|
|
|
|
2022-12-21 10:46:53 +00:00
|
|
|
const char *config_get_agent_iptv_report_url() {
|
|
|
|
return cfg_get_string_value(CFG_AGENT_IPTV_POST_URL);
|
|
|
|
}
|
|
|
|
|
2023-01-16 01:37:53 +00:00
|
|
|
const char *config_get_agent_moniter_report_url() {
|
|
|
|
return cfg_get_string_value(CFG_AGENT_MONITER_URL);
|
|
|
|
}
|
2023-02-16 10:44:01 +00:00
|
|
|
#ifdef HTTPSERVER_ON
|
2022-12-02 06:42:15 +00:00
|
|
|
const char *config_get_http_server_addr() {
|
2022-11-07 06:38:30 +00:00
|
|
|
return cfg_get_string_value(CFG_HTTP_SVR_ADDR);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int config_get_http_server_port() {
|
|
|
|
return cfg_get_integral_value(CFG_HTTP_SVR_PORT);
|
|
|
|
}
|
|
|
|
|
|
|
|
int config_get_http_server_tcp_nodelay() {
|
|
|
|
return cfg_get_bool_value(CFG_HTTP_SVR_TCP_NODELAY);
|
|
|
|
}
|
2023-02-16 10:44:01 +00:00
|
|
|
#endif
|
2022-12-23 02:57:16 +00:00
|
|
|
#ifdef LWIP_ON
|
2022-06-12 10:00:43 +00:00
|
|
|
const char *config_get_vxlan_nic_name() {
|
2022-06-10 09:03:27 +00:00
|
|
|
return cfg_get_string_value(CFG_VXLAN_NIC_NAME);
|
|
|
|
}
|
|
|
|
|
2022-06-12 10:00:43 +00:00
|
|
|
const char *config_get_vxlan_peer_ip() {
|
2022-06-10 09:03:27 +00:00
|
|
|
return cfg_get_string_value(CFG_VXLAN_PEER_IP);
|
|
|
|
}
|
|
|
|
|
2022-06-12 10:00:43 +00:00
|
|
|
const char *config_get_vxlan_peer_mac() {
|
2022-06-10 09:03:27 +00:00
|
|
|
return cfg_get_string_value(CFG_VXLAN_PEER_MAC);
|
2022-06-02 08:18:43 +00:00
|
|
|
}
|
|
|
|
|
2022-06-12 10:00:43 +00:00
|
|
|
const char *config_get_vxlan_pkg_filter() {
|
|
|
|
return cfg_get_string_value(CFG_VXLAN_PKG_FILTER);
|
|
|
|
}
|
|
|
|
|
2022-06-02 08:18:43 +00:00
|
|
|
int cfg_get_support_vxlan() {
|
|
|
|
return cfg_get_bool_value(CFG_VXLAN_SUPPORT);
|
|
|
|
}
|
2022-12-23 02:57:16 +00:00
|
|
|
#endif
|
2022-05-10 06:43:27 +00:00
|
|
|
|
|
|
|
const char *config_get_ssl_ca_path() {
|
|
|
|
return cfg_get_string_value(CFG_CURL_CA_PATH);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *cfg_get_config_directory() {
|
|
|
|
return cfg_get_string_value(CFG_DIRECTORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
int cfg_get_banner_enable() {
|
|
|
|
return cfg_get_bool_value(CFG_BANNER_SHOW);
|
|
|
|
}
|
|
|
|
|
|
|
|
int cfg_get_hardware_watch_enable() {
|
|
|
|
return cfg_get_bool_value(CFG_HARDWARE_WATCH);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int cfg_get_hardware_refresh_period() {
|
|
|
|
return cfg_get_integral_value(CFG_HARDWARE_REFRESH);
|
|
|
|
}
|
|
|
|
|
|
|
|
int cfg_get_watch_cpu() {
|
|
|
|
return cfg_get_bool_value(CFG_WATCH_CPU);
|
|
|
|
}
|
|
|
|
|
|
|
|
int cfg_get_watch_memory() {
|
|
|
|
return cfg_get_bool_value(CFG_WATCH_MEMORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
int cfg_get_watch_disk() {
|
|
|
|
return cfg_get_bool_value(CFG_WATCH_DISK);
|
|
|
|
}
|
|
|
|
|
|
|
|
int cfg_get_watch_sensor() {
|
|
|
|
return cfg_get_bool_value(CFG_WATCH_SENSOR);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int cfg_get_cpu_refresh_period() {
|
|
|
|
return cfg_get_integral_value(CFG_CPU_REFRESH);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int cfg_get_mem_refresh_period() {
|
|
|
|
return cfg_get_integral_value(CFG_MEM_REFRESH);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int cfg_get_disk_refresh_period() {
|
|
|
|
return cfg_get_integral_value(CFG_DISK_REFRESH);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int cfg_get_sensor_refresh_period() {
|
|
|
|
return cfg_get_integral_value(CFG_SENSOR_REFRESH);
|
|
|
|
}
|
|
|
|
|
2022-11-29 06:32:13 +00:00
|
|
|
#ifdef USED_SQLITE
|
|
|
|
const char *cfg_get_sqlite_db_name() {
|
|
|
|
return cfg_get_string_value(CFG_DB_SQLITE_DB_NAME);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *cfg_get_sqlite_passwd() {
|
|
|
|
return cfg_get_string_value(CFG_DB_SQLITE_PASSWD);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-11-28 09:57:57 +00:00
|
|
|
#ifdef USED_REDIS
|
2022-05-10 06:43:27 +00:00
|
|
|
const char *cfg_get_redis_server() {
|
|
|
|
return cfg_get_string_value(CFG_DB_REDIS_SERVER);
|
|
|
|
}
|
|
|
|
|
|
|
|
int cfg_get_redis_port() {
|
|
|
|
return (unsigned short)cfg_get_integral_value(CFG_DB_REDIS_PORT);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *cfg_get_redis_passwd() {
|
|
|
|
return cfg_get_string_value(CFG_DB_REDIS_PASSWD);
|
|
|
|
}
|
2022-11-28 09:57:57 +00:00
|
|
|
#endif
|
2022-05-10 06:43:27 +00:00
|
|
|
|
2022-11-28 09:57:57 +00:00
|
|
|
#ifdef USED_MYSQL
|
2022-05-10 06:43:27 +00:00
|
|
|
const char *cfg_get_mysql_server() {
|
|
|
|
return cfg_get_string_value(CFG_DB_MYSQL_SERVER);
|
|
|
|
}
|
|
|
|
|
|
|
|
int cfg_get_mysql_port() {
|
|
|
|
return (unsigned short)cfg_get_integral_value(CFG_DB_MYSQL_PORT);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *cfg_get_mysql_user() {
|
|
|
|
return cfg_get_string_value(CFG_DB_MYSQL_USER);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *cfg_get_mysql_passwd() {
|
|
|
|
return cfg_get_string_value(CFG_DB_MYSQL_PASSWD);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *cfg_get_mysql_database() {
|
|
|
|
return cfg_get_string_value(CFG_DB_MYSQL_DB_NAME);
|
|
|
|
}
|
2022-11-28 09:57:57 +00:00
|
|
|
#endif
|
2022-05-10 06:43:27 +00:00
|
|
|
|
|
|
|
int cfg_get_zero_mq_port() {
|
|
|
|
return (unsigned short)cfg_get_integral_value(CFG_MQ_SVR_PORT);
|
2022-06-06 03:46:09 +00:00
|
|
|
}
|
|
|
|
|
2022-06-13 03:09:36 +00:00
|
|
|
const char *cfg_get_zero_mq_data_path() {
|
|
|
|
return cfg_get_string_value(CFG_MQ_DATA_PATH);
|
2022-05-10 06:43:27 +00:00
|
|
|
}
|