// // Created by xajhu on 2021/6/29 0029. // #include #include #include #include #include "cmdline.h" #include "task_manager.h" #include "init.h" #if LWIP_ON #include "user_info.h" #include "lwip/tcpip.h" #endif #ifdef OPENDHCPD_ON #include "user_errno.h" #include "proto.h" #endif #ifdef OPENDHCPDDNS_ON #include "dual_server/dualsvr.h" #endif #if LWIP_ON static void test_init(void *arg) { /* remove compiler warning */ sys_sem_t *init_sem; init_sem = (sys_sem_t *)arg; srand((unsigned int)time(0)); sys_sem_signal(init_sem); } static void lwip_init_env() { err_t err; sys_sem_t init_sem; err = sys_sem_new(&init_sem, 0); LWIP_UNUSED_ARG(err); tcpip_init(test_init, &init_sem); sys_sem_wait(&init_sem); sys_sem_free(&init_sem); } #endif int main(int argc, char **argv) { const char *pJson = "{\n" " \"ver\": 3,\n" " \"cryptoType\": 1,\n" " \"timeStamp\": 1599187216753,\n" " \"msgContent\": " "\"ewogICAgInVzZXJNYWMiOiBbCiAgICAgICIwMDowYzoyOTpiNTpkMzozYSIsCiAgICAgICIwMDowYzoyOTpiNTpk" "MzozYiIsCiAgICAgICIw" "MDowYzoyOTowZDo2Nzo2ZSIsCiAgICBdCn0=\"\n" "}"; int ret; #ifdef OPENDHCPDDNS_ON return dual_server_main(argc, argv); #else uv_setup_args(argc, argv); setvbuf(stdout, NULL, _IONBF, 0); ret = menu_run(argc, argv); if (ret == ERR_MENU_EXIT) { user_uninit(); exit(0); } else if (ret != ERR_SUCCESS) { printf("Application setup error(%d), please used --help to show usage, exited!!!\n", ret); user_uninit(); exit(0); } #if LWIP_ON lwip_init_env(); user_info_init(); pppoe_session_init(); #endif task_manager_run(); while (!is_system_cleanup()) { sleep(1); } user_uninit(); return ret; #endif }