diff --git a/srcs/libs/configure/config.c b/srcs/libs/configure/config.c index ec1d7e7..b8d6d3e 100644 --- a/srcs/libs/configure/config.c +++ b/srcs/libs/configure/config.c @@ -73,8 +73,8 @@ static CFG_ITEM g_cfgItem[] = { DEF_CFG_ITEM(CFG_MEM_REFRESH, "watch_params.mem_refresh", VAL_INT, "10", "Memory information refresh frequency"), DEF_CFG_ITEM(CFG_DISK_REFRESH, "watch_params.disk_refresh", VAL_INT, "10", "Disk information refresh frequency"), DEF_CFG_ITEM(CFG_SENSOR_REFRESH, "watch_params.sensor_refresh", VAL_INT, "10", "Sensor information refresh frequency"), - /* 数据库相配置 */ - /* Redis配置 */ +/* 数据库相配置 */ +/* Redis配置 */ #ifdef USED_REDIS DEF_CFG_ITEM(CFG_DB_REDIS_SERVER, "database.redis_server", VAL_STR, "127.0.0.1", "Redis database server ip address"), DEF_CFG_ITEM(CFG_DB_REDIS_PORT, "database.redis_port", VAL_INT, "6379", "Redis database server port"), @@ -88,7 +88,7 @@ static CFG_ITEM g_cfgItem[] = { DEF_CFG_ITEM(CFG_DB_MYSQL_PASSWD, "database.mysql_passwd", VAL_STR, "", "MySQL database server password"), DEF_CFG_ITEM(CFG_DB_MYSQL_DB_NAME, "database.mysql_database", VAL_STR, ".main", "MySQL database used"), #endif - /* SQLite3配置 */ +/* SQLite3配置 */ #ifdef USED_SQLITE DEF_CFG_ITEM(CFG_DB_SQLITE_DB_NAME, "database.sqlite_dbname", VAL_STR, "", "SQLite3 database file name"), DEF_CFG_ITEM(CFG_DB_SQLITE_PASSWD, "database.sqlite_passwd", VAL_STR, ".main", "SQLite3 database password"), @@ -107,9 +107,12 @@ static CFG_ITEM g_cfgItem[] = { DEF_CFG_ITEM(CFG_HTTP_SVR_ADDR, "http_svr.listen_addr", VAL_STR, "0.0.0.0", "Network address to listen on"), DEF_CFG_ITEM(CFG_HTTP_SVR_PORT, "http_svr.listen_port", VAL_INT, "6789", "Network port to listen on"), DEF_CFG_ITEM(CFG_HTTP_SVR_TCP_NODELAY, "http_svr.tcp_nodelay", VAL_BOOL, "1", "TCP delay switch"), +#ifdef OPENDHCPD_ON + // 配置DHCP服务器 DEF_CFG_ITEM(CFG_DHCP_LISTEN_ON, "dhcp_server.listen_on", VAL_ARRAY_STR, "", "DHCP listen interface"), DEF_CFG_ITEM(CFG_DHCP_REPLICATION_SVR, "dhcp_server.replication", VAL_ARRAY_STR, "", "DHCP replication server configure"), DEF_CFG_ITEM(CFG_DHCP_RANGE_SET, "dhcp_server.range_set", VAL_ARRAY_OBJ, "", "DHCP IP pool"), +#endif }; static int cfg_is_upgrade(PCONFIG_ITEM pItem) { diff --git a/srcs/libs/configure/config_help.c b/srcs/libs/configure/config_help.c index fd697d9..cd84d89 100644 --- a/srcs/libs/configure/config_help.c +++ b/srcs/libs/configure/config_help.c @@ -3,6 +3,7 @@ // #include "config.h" +#ifdef OPENDHCPD_ON const vector config_get_dhcp_server_range_set() { return cfg_get_vector(CFG_DHCP_RANGE_SET); } @@ -14,6 +15,7 @@ const vector config_get_dhcp_listen_on() { const vector config_get_dhcp_replication_svr() { return cfg_get_vector(CFG_DHCP_REPLICATION_SVR); } +#endif const char* config_get_http_server_addr() { return cfg_get_string_value(CFG_HTTP_SVR_ADDR); diff --git a/srcs/libs/include/config.h b/srcs/libs/include/config.h index 9484c3b..3adf1d6 100644 --- a/srcs/libs/include/config.h +++ b/srcs/libs/include/config.h @@ -129,9 +129,11 @@ const char *config_get_vxlan_pkg_filter(); const char *config_get_http_server_addr(); unsigned int config_get_http_server_port(); int config_get_http_server_tcp_nodelay(); +#ifdef OPENDHCPD_ON const vector config_get_dhcp_server_range_set(); const vector config_get_dhcp_listen_on(); const vector config_get_dhcp_replication_svr(); +#endif #ifdef __cplusplus } #endif diff --git a/srcs/open_dhcp/CMakeLists.txt b/srcs/open_dhcp/CMakeLists.txt index 226fd65..f7f5f90 100644 --- a/srcs/open_dhcp/CMakeLists.txt +++ b/srcs/open_dhcp/CMakeLists.txt @@ -8,7 +8,7 @@ INCLUDE_DIRECTORIES(../libs/include ./ ../httpserver/include) FILE(GLOB DHCPD_HEADS ./*.h) -ADD_DEFINITIONS(-Wno-format-overflow -std=c++11) +ADD_DEFINITIONS(-Wno-format-overflow -std=c++11 ${COMMON_DEFINE}) #ADD_EXECUTABLE(${PROJECT_TARGET} opendhcpd.cpp ${DHCPD_HEADS}) ADD_LIBRARY(${DHCPD_PROJECT_TARGET} opendhcpd.cpp ${DHCPD_HEADS} query.cpp)