static void fapp_release(fnet_shell_desc_t desc) { #if FAPP_CFG_LLMNR_CMD && FNET_CFG_LLMNR /* Release LLMNR server. */ fapp_llmnr_release(); #endif #if FAPP_CFG_DHCP_CMD && FNET_CFG_DHCP && FNET_CFG_IP4 fapp_dhcp_release(); /* Release DHCP client. */ #endif #if FAPP_CFG_TELNET_CMD && FNET_CFG_TELNET /* Release TELNET server. */ fapp_telnet_release(); #endif #if FAPP_CFG_HTTP_CMD && FNET_CFG_HTTP /* Release HTTP server. */ fapp_http_release(); #endif #if FAPP_CFG_TFTPS_CMD /* Release TFTP server. */ fapp_tftps_release(); #endif #if (FAPP_CFG_EXP_CMD && FNET_CFG_FS) || (FAPP_CFG_HTTP_CMD && FNET_CFG_HTTP) fapp_fs_unmount(); /* Unmount and release FS. */ #endif fnet_shell_release(desc); /* Release shell. */ fnet_release(); /* Release the FNET stack.*/ }
/************************************************************************ * NAME: fapp_http_cmd * * DESCRIPTION: Run HTTP server. *************************************************************************/ void fapp_http_cmd( fnet_shell_desc_t desc, int argc, char ** argv ) { struct fnet_http_params params; fnet_http_desc_t http_desc; FNET_COMP_UNUSED_ARG(desc); if(argc == 1) /* By default is "init".*/ { fnet_memset_zero(¶ms, sizeof(struct fnet_http_params)); params.root_path = FAPP_HTTP_MOUNT_NAME; /* Root directory path */ params.index_path = FAPP_HTTP_INDEX_FILE; /* Index file path, relative to the root_path */ #if FNET_CFG_HTTP_SSI params.ssi_table = fapp_ssi_table; #endif #if FNET_CFG_HTTP_CGI params.cgi_table = fapp_cgi_table; #endif #if FNET_CFG_HTTP_AUTHENTICATION_BASIC params.auth_table = fapp_auth_table; #endif #if FNET_CFG_HTTP_POST params.post_table = fapp_post_table; #endif /* Enable HTTP server */ http_desc = fnet_http_init(¶ms); if(http_desc != FNET_ERR) { fnet_shell_println(desc, FAPP_DELIMITER_STR); fnet_shell_println(desc, " HTTP server started."); fapp_netif_addr_print(desc, AF_SUPPORTED, fapp_default_netif, FNET_FALSE); fnet_shell_println(desc, FAPP_DELIMITER_STR); fapp_http_desc = http_desc; } else { fnet_shell_println(desc, FAPP_INIT_ERR, "HTTP"); } } else if(argc == 2 && fnet_strcasecmp(&FAPP_COMMAND_RELEASE[0], argv[1]) == 0) /* [release] */ { fapp_http_release(); } else { fnet_shell_println(desc, FAPP_PARAM_ERR, argv[1]); } }