OCT 1. 增加DHCP Server编译宏控制
This commit is contained in:
parent
11bf552cb0
commit
da06daecd6
|
@ -23,6 +23,18 @@ endif ()
|
||||||
|
|
||||||
MESSAGE("Version: " ${GIT_VERSION})
|
MESSAGE("Version: " ${GIT_VERSION})
|
||||||
|
|
||||||
|
if (USED_LWIP)
|
||||||
|
LIST(APPEND COMMON_DEFINE "-DLWIP_ON")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (USED_OPENDHCPD)
|
||||||
|
LIST(APPEND COMMON_DEFINE "-DOPENDHCPD_ON")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (USED_OPENDHCPDDNS)
|
||||||
|
LIST(APPEND COMMON_DEFINE "-DOPENDHCPDDNS_ON")
|
||||||
|
endif ()
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(srcs)
|
ADD_SUBDIRECTORY(srcs)
|
||||||
ADD_SUBDIRECTORY(srcs/libs)
|
ADD_SUBDIRECTORY(srcs/libs)
|
||||||
|
|
||||||
|
@ -49,3 +61,7 @@ if (USED_LWIP OR VCPE_AGENT)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(srcs/httpserver)
|
ADD_SUBDIRECTORY(srcs/httpserver)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
MESSAGE("COMMON_DEFINE: " ${COMMON_DEFINE})
|
|
@ -19,6 +19,8 @@ LIST(APPEND COMMON_LIBS "-ldl -lpthread -lzlog -lm -luv -lzmq -luuid -lconfig")
|
||||||
|
|
||||||
LIST(APPEND COMMON_LIBS "-lpthread")
|
LIST(APPEND COMMON_LIBS "-lpthread")
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(${COMMON_DEFINE})
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(include ./ ./include ./libs/include ./lwip/src/include ./lwip/src/arch_linux/include
|
INCLUDE_DIRECTORIES(include ./ ./include ./libs/include ./lwip/src/include ./lwip/src/arch_linux/include
|
||||||
./httpserver/include ${COMMON_INCLUDE})
|
./httpserver/include ${COMMON_INCLUDE})
|
||||||
|
|
||||||
|
@ -32,17 +34,6 @@ if (USED_LWIP)
|
||||||
AUX_SOURCE_DIRECTORY(user VCPE_SRC)
|
AUX_SOURCE_DIRECTORY(user VCPE_SRC)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (USED_LWIP)
|
|
||||||
ADD_DEFINITIONS(-DLWIP_ON)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (USED_OPENDHCPD)
|
|
||||||
ADD_DEFINITIONS(-DOPENDHCPD_ON)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (USED_OPENDHCPDDNS)
|
|
||||||
ADD_DEFINITIONS(-DOPENDHCPDDNS_ON)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(${PROJECT_TARGET} ${VCPE_SRC} ${VCPE_HEADS} vcpe_main.c)
|
ADD_EXECUTABLE(${PROJECT_TARGET} ${VCPE_SRC} ${VCPE_HEADS} vcpe_main.c)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@ AUX_SOURCE_DIRECTORY(hardware C_SRC)
|
||||||
|
|
||||||
SET(CMAKE_C_STANDARD 99)
|
SET(CMAKE_C_STANDARD 99)
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DBUILD_VERSION="${GIT_VERSION}")
|
ADD_DEFINITIONS(-DBUILD_VERSION="${GIT_VERSION}" ${COMMON_DEFINE})
|
||||||
|
|
||||||
|
|
||||||
LINK_LIBRARIES(${COMMON_LIBS})
|
LINK_LIBRARIES(${COMMON_LIBS})
|
||||||
ADD_LIBRARY(${LIB_PROJECT_TARGET} ${C_SRC} ${C_HEADS})
|
ADD_LIBRARY(${LIB_PROJECT_TARGET} ${C_SRC} ${C_HEADS})
|
||||||
|
|
|
@ -388,6 +388,7 @@ static void dhcpd_task(void *pArg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if OPENDHCPD_ON
|
||||||
static int on_cmd7(void *pTbl[], const char *pName, void *pInfo) {
|
static int on_cmd7(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
int ret;
|
int ret;
|
||||||
PDHCPD_SETUP p;
|
PDHCPD_SETUP p;
|
||||||
|
@ -424,11 +425,12 @@ static int on_cmd7(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
|
||||||
return ERR_SUCCESS;
|
return ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int on_cmd_(void *pTbl[], const char *pName, void *pInfo) {
|
static int on_cmd_(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
PARG_TBL_INFO pArg = (PARG_TBL_INFO)pInfo;
|
PARG_TBL_INFO pArg = (PARG_TBL_INFO)pInfo;
|
||||||
int help = get_help_cmd(pTbl, pArg)->count;
|
int help = get_help_cmd(pTbl, pArg)->count;
|
||||||
int version = ((arg_lit_t *)pTbl[0])->count;
|
//int version = ((arg_lit_t *)pTbl[0])->count;
|
||||||
|
|
||||||
if (help > 0) {
|
if (help > 0) {
|
||||||
show_help(pName);
|
show_help(pName);
|
||||||
|
@ -545,6 +547,7 @@ int menu_run(int argc, char **argv) {
|
||||||
void *pArgTbl6[] = {cmd6, keyGen, helpCmd6, end6};
|
void *pArgTbl6[] = {cmd6, keyGen, helpCmd6, end6};
|
||||||
int errCode6 = 0;
|
int errCode6 = 0;
|
||||||
|
|
||||||
|
#if OPENDHCPD_ON
|
||||||
arg_rex_t *cmd7 = arg_rex1(NULL, NULL, "dhcpd", NULL, REG_ICASE, NULL);
|
arg_rex_t *cmd7 = arg_rex1(NULL, NULL, "dhcpd", NULL, REG_ICASE, NULL);
|
||||||
arg_lit_t *operate7 = arg_lit0("m", "mode", "\tService works on verbatim mode.");
|
arg_lit_t *operate7 = arg_lit0("m", "mode", "\tService works on verbatim mode.");
|
||||||
arg_file_t *cfgfile7 = arg_file1("c", "config", "<file>", "\tSpecify the current application configuration file path");
|
arg_file_t *cfgfile7 = arg_file1("c", "config", "<file>", "\tSpecify the current application configuration file path");
|
||||||
|
@ -557,6 +560,7 @@ int menu_run(int argc, char **argv) {
|
||||||
arg_end_t *end7 = arg_end(20);
|
arg_end_t *end7 = arg_end(20);
|
||||||
void *pArgTbl7[] = {cmd7, operate7, cfgfile7, cfgdir7, inifile, statfile, ifname, key7, helpCmd7, end7};
|
void *pArgTbl7[] = {cmd7, operate7, cfgfile7, cfgdir7, inifile, statfile, ifname, key7, helpCmd7, end7};
|
||||||
int errCode7 = 0;
|
int errCode7 = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
* 系统帮助参数定义
|
* 系统帮助参数定义
|
||||||
|
@ -569,7 +573,9 @@ int menu_run(int argc, char **argv) {
|
||||||
|
|
||||||
ARG_TBL_INFO argTblInfo[] = {
|
ARG_TBL_INFO argTblInfo[] = {
|
||||||
{pArgTbl1, ARRAY_SIZE(pArgTbl1), &errCode1, on_cmd1, cmdn_help, "\r \033[1;4;36mstart\033[0m: \033[1mRun agent service normally.\033[0m\n"},
|
{pArgTbl1, ARRAY_SIZE(pArgTbl1), &errCode1, on_cmd1, cmdn_help, "\r \033[1;4;36mstart\033[0m: \033[1mRun agent service normally.\033[0m\n"},
|
||||||
|
#if OPENDHCPD_ON
|
||||||
{pArgTbl7, ARRAY_SIZE(pArgTbl7), &errCode7, on_cmd7, cmdn_help, "\n \033[1;4;36mdhcpd\033[0m: \033[1mRun DHCP service normally.\033[0m\n"},
|
{pArgTbl7, ARRAY_SIZE(pArgTbl7), &errCode7, on_cmd7, cmdn_help, "\n \033[1;4;36mdhcpd\033[0m: \033[1mRun DHCP service normally.\033[0m\n"},
|
||||||
|
#endif
|
||||||
{pArgTbl2, ARRAY_SIZE(pArgTbl2), &errCode2, on_cmd2, cmd2_help, "\n \033[1;4;36mif\033[0m: \033[1mRun agent interface tools.\033[0m\n"},
|
{pArgTbl2, ARRAY_SIZE(pArgTbl2), &errCode2, on_cmd2, cmd2_help, "\n \033[1;4;36mif\033[0m: \033[1mRun agent interface tools.\033[0m\n"},
|
||||||
{pArgTbl3, ARRAY_SIZE(pArgTbl3), &errCode3, on_cmd3, cmdn_help, "\n \033[1;4;36mbase64\033[0m: \033[1mString base64 encode/decode.\033[0m\n"},
|
{pArgTbl3, ARRAY_SIZE(pArgTbl3), &errCode3, on_cmd3, cmdn_help, "\n \033[1;4;36mbase64\033[0m: \033[1mString base64 encode/decode.\033[0m\n"},
|
||||||
{pArgTbl4, ARRAY_SIZE(pArgTbl4), &errCode4, on_cmd4, cmdn_help, "\n \033[1;4;36mhash\033[0m: \033[1mCalculate file's hash value.\033[0m\n"},
|
{pArgTbl4, ARRAY_SIZE(pArgTbl4), &errCode4, on_cmd4, cmdn_help, "\n \033[1;4;36mhash\033[0m: \033[1mCalculate file's hash value.\033[0m\n"},
|
||||||
|
|
|
@ -49,9 +49,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
#ifdef OPENDHCPDDNS_ON
|
#ifdef OPENDHCPDDNS_ON
|
||||||
return dual_server_main(argc, argv);
|
return dual_server_main(argc, argv);
|
||||||
#elif OPENDHCPD_ON
|
#else
|
||||||
// return dhcpd_main(argc, argv);
|
|
||||||
//#else
|
|
||||||
uv_setup_args(argc, argv);
|
uv_setup_args(argc, argv);
|
||||||
|
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
|
Loading…
Reference in New Issue