void ICACHE_FLASH_ATTR dhcps_start(struct ip_info *info) { struct netif * apnetif = (struct netif *)eagle_lwip_getif(0x01); if(apnetif->dhcps_pcb != NULL) { udp_remove(apnetif->dhcps_pcb); } pcb_dhcps = udp_new(); if (pcb_dhcps == NULL || info ==NULL) { os_printf("dhcps_start(): could not obtain pcb\n"); } apnetif->dhcps_pcb = pcb_dhcps; IP4_ADDR(&broadcast_dhcps, 255, 255, 255, 255); server_address = info->ip; wifi_softap_init_dhcps_lease(server_address.addr); client_address_plus.addr = dhcps_lease.start_ip.addr; udp_bind(pcb_dhcps, IP_ADDR_ANY, DHCPS_SERVER_PORT); udp_recv(pcb_dhcps, handle_dhcp, NULL); #if DHCPS_DEBUG os_printf("dhcps:dhcps_start->udp_recv function Set a receive callback handle_dhcp for UDP_PCB pcb_dhcps\n"); #endif }
void ICACHE_FLASH_ATTR dhcps_start(struct ip_info *info) { os_memset(&msg_dhcps, 0, sizeof(dhcps_msg)); pcb_dhcps = udp_new(); if (pcb_dhcps == NULL || info ==NULL) { #if DEBUGSOO > 0 os_printf("dhcps_start(): could not obtain pcb\n"); #endif } IP4_ADDR(&broadcast_dhcps, 255, 255, 255, 255); server_address = info->ip; wifi_softap_init_dhcps_lease(server_address.addr); client_address_plus.addr = dhcps_lease.start_ip.addr; udp_bind(pcb_dhcps, IP_ADDR_ANY, DHCPS_SERVER_PORT); udp_recv(pcb_dhcps, handle_dhcp, NULL); #if DHCPS_DEBUG os_printf("dhcps:dhcps_start->udp_recv function Set a receive callback handle_dhcp for UDP_PCB pcb_dhcps\n"); #endif }