/************************************************************************ * NAME: fapp_dhcp_info * * DESCRIPTION: *************************************************************************/ void fapp_dhcp_info(fnet_shell_desc_t desc) { fnet_char_t ip_str[FNET_IP4_ADDR_STR_SIZE]; fnet_bool_t dhcp_is_enabled = fnet_dhcp_is_enabled(fapp_dhcp_desc); fnet_shell_println(desc, FAPP_SHELL_INFO_FORMAT_S, "DHCP Client", fapp_enabled_str[dhcp_is_enabled]); if(dhcp_is_enabled && (fnet_netif_get_ip4_addr_type(fnet_netif_get_default()) == FNET_NETIF_IP_ADDR_TYPE_DHCP)) { struct fnet_dhcp_options options; fnet_dhcp_get_options(fapp_dhcp_desc, &options); fnet_inet_ntoa(*(struct in_addr *)( &options.dhcp_server), ip_str); fnet_shell_println(desc, FAPP_SHELL_INFO_FORMAT_S, "DHCP Server", ip_str); fnet_shell_println(desc, FAPP_SHELL_INFO_FORMAT_D, "Lease Time", fnet_ntohl(options.lease_time)); } }
/************************************************************************ * NAME: fapp_dhcp_info * * DESCRIPTION: *************************************************************************/ void fapp_dhcp_info(fnet_shell_desc_t desc) { fnet_char_t ip_str[FNET_IP4_ADDR_STR_SIZE]; fnet_bool_t dhcp_enabled = fnet_dhcp_enabled(fapp_dhcp_desc); fnet_bool_t address_automatic = fnet_netif_get_ip4_addr_automatic(fnet_netif_get_default()); fnet_shell_println(desc, FAPP_SHELL_INFO_FORMAT_S, "DHCP Client", dhcp_enabled ? FAPP_SHELL_INFO_ENABLED : FAPP_SHELL_INFO_DISABLED); if(dhcp_enabled && address_automatic) { struct fnet_dhcp_options options; fnet_dhcp_get_options(fapp_dhcp_desc, &options); fnet_inet_ntoa(*(struct in_addr *)( &options.dhcp_server), ip_str); fnet_shell_println(desc, FAPP_SHELL_INFO_FORMAT_S, "DHCP Server", ip_str); fnet_shell_println(desc, FAPP_SHELL_INFO_FORMAT_D, "Lease Time", fnet_ntohl(options.lease_time)); } }