MeterLogger
|
#include "lwip/inet.h"
#include "lwip/err.h"
#include "lwip/pbuf.h"
#include "lwip/udp.h"
#include "lwip/mem.h"
#include "osapi.h"
#include "lwip/app/dhcpserver.h"
#include "user_interface.h"
Go to the source code of this file.
Macros | |
#define | DHCPS_LEASE_TIME_DEF (120) |
Variables | |
static const uint32 magic_cookie | ICACHE_RODATA_ATTR = 0x63538263 |
static struct udp_pcb * | pcb_dhcps = NULL |
static struct ip_addr | broadcast_dhcps |
static struct ip_addr | server_address |
static struct ip_addr | client_address |
static struct ip_addr | client_address_plus |
static struct ip_addr | dns_address = {0} |
static struct dhcps_lease | dhcps_lease |
static list_node * | plist = NULL |
static uint8 | offer = 0xFF |
static bool | renew = false |
uint32 | dhcps_lease_time = DHCPS_LEASE_TIME_DEF |
#define DHCPS_LEASE_TIME_DEF (120) |
Definition at line 37 of file dhcpserver.c.
Referenced by wifi_softap_reset_dhcps_lease_time().
|
static |
Definition at line 242 of file dhcpserver.c.
References DHCP_OPTION_END.
Referenced by send_ack(), send_nak(), and send_offer().
|
static |
Definition at line 116 of file dhcpserver.c.
References DHCP_OPTION_MSG_TYPE.
Referenced by send_ack(), send_nak(), and send_offer().
|
static |
Definition at line 133 of file dhcpserver.c.
References ip_addr::addr, DHCP_OPTION_BROADCAST_ADDRESS, DHCP_OPTION_DNS_SERVER, DHCP_OPTION_INTERFACE_MTU, DHCP_OPTION_LEASE_TIME, DHCP_OPTION_PERFORM_ROUTER_DISCOVERY, DHCP_OPTION_ROUTER, DHCP_OPTION_SERVER_ID, DHCP_OPTION_SUBNET_MASK, DHCPS_LEASE_TIMER, dhcps_router_enabled, ip_info::gw, ip4_addr1, ip4_addr2, ip4_addr3, ip4_addr4, offer, os_bzero, server_address, SOFTAP_IF, and wifi_get_ip_info().
Referenced by send_ack(), and send_offer().
|
static |
Definition at line 250 of file dhcpserver.c.
References ip_addr::addr, BOOTP_BROADCAST, dhcps_msg::ciaddr, client_address, DHCP_HTYPE_ETHERNET, DHCP_REPLY, dhcps_msg::file, dhcps_msg::flags, dhcps_msg::giaddr, dhcps_msg::hlen, dhcps_msg::hops, htons, dhcps_msg::htype, dhcps_msg::op, dhcps_msg::options, os_memcpy, os_memset, dhcps_msg::secs, dhcps_msg::siaddr, dhcps_msg::sname, and dhcps_msg::yiaddr.
Referenced by send_ack(), send_nak(), and send_offer().
void ICACHE_FLASH_ATTR dhcps_coarse_tmr | ( | void | ) |
Definition at line 1066 of file dhcpserver.c.
References kill_oldest_dhcps_pool(), dhcps_pool::lease_timer, MAX_STATION_NUM, node_remove_from_list(), NULL, os_free, plist, _list_node::pnext, and _list_node::pnode.
struct dhcps_pool* ICACHE_FLASH_ATTR dhcps_get_mapping | ( | uint16_t | no | ) |
Definition at line 1160 of file dhcpserver.c.
References NULL, _list_node::pnext, and _list_node::pnode.
void ICACHE_FLASH_ATTR dhcps_set_DNS | ( | struct ip_addr * | dns_ip | ) |
Definition at line 1155 of file dhcpserver.c.
References dns_ip.
Referenced by wifi_softap_ip_config().
void ICACHE_FLASH_ATTR dhcps_set_mapping | ( | struct ip_addr * | addr, |
uint8 * | mac, | ||
uint32 | lease_time | ||
) |
Definition at line 1170 of file dhcpserver.c.
References ip_addr::addr, dhcps_pool::ip, dhcps_pool::lease_timer, dhcps_pool::mac, node_insert_to_list(), NULL, os_memcpy, os_zalloc, _list_node::pnext, and _list_node::pnode.
void ICACHE_FLASH_ATTR dhcps_start | ( | struct ip_info * | info | ) |
Definition at line 886 of file dhcpserver.c.
References ip_addr::addr, broadcast_dhcps, client_address_plus, DHCPS_SERVER_PORT, eagle_lwip_getif(), handle_dhcp(), ip_info::ip, IP4_ADDR, NULL, os_printf, pcb_dhcps, server_address, dhcps_lease::start_ip, and wifi_softap_init_dhcps_lease().
void ICACHE_FLASH_ATTR dhcps_stop | ( | void | ) |
Definition at line 919 of file dhcpserver.c.
References eagle_lwip_getif(), node_remove_from_list(), NULL, os_free, pcb_dhcps, plist, _list_node::pnext, and _list_node::pnode.
|
static |
Definition at line 744 of file dhcpserver.c.
References DHCPS_STATE_ACK, DHCPS_STATE_NAK, DHCPS_STATE_OFFER, pbuf::len, pbuf::next, NULL, os_free, os_printf, os_zalloc, parse_msg(), pbuf::payload, pbuf_free(), send_ack(), send_nak(), send_offer(), and pbuf::tot_len.
Referenced by dhcps_start().
|
static |
Definition at line 1040 of file dhcpserver.c.
References dhcps_pool::lease_timer, NULL, os_free, plist, and _list_node::pnext.
Referenced by dhcps_coarse_tmr().
void ICACHE_FLASH_ATTR node_insert_to_list | ( | list_node ** | phead, |
list_node * | pinsert | ||
) |
Definition at line 45 of file dhcpserver.c.
References ip_addr::addr, dhcps_pool::ip, NULL, plist, _list_node::pnext, and _list_node::pnode.
Referenced by dhcps_set_mapping(), and parse_msg().
void ICACHE_FLASH_ATTR node_remove_from_list | ( | list_node ** | phead, |
list_node * | pdelete | ||
) |
Definition at line 86 of file dhcpserver.c.
References NULL, and _list_node::pnext.
Referenced by dhcps_coarse_tmr(), dhcps_stop(), and parse_msg().
|
static |
Definition at line 578 of file dhcpserver.c.
References ip_addr::addr, dhcps_msg::chaddr, dhcps_msg::ciaddr, client_address, client_address_plus, DHCPS_LEASE_TIMER, DHCPS_STATE_RELEASE, dhcps_lease::end_ip, htonl, dhcps_pool::ip, ip_addr_isany, dhcps_pool::lease_timer, dhcps_pool::mac, node_insert_to_list(), node_remove_from_list(), NULL, dhcps_msg::options, os_free, os_memcmp, os_memcpy, os_memset, os_printf, os_zalloc, parse_options(), _list_node::pnext, _list_node::pnode, renew, dhcps_lease::start_ip, and system_get_free_heap_size().
Referenced by handle_dhcp().
|
static |
Definition at line 485 of file dhcpserver.c.
References ip_addr::addr, client_address, DHCP_OPTION_END, DHCP_OPTION_MSG_TYPE, DHCP_OPTION_REQ_IPADDR, DHCPDECLINE, DHCPDISCOVER, DHCPRELEASE, DHCPREQUEST, DHCPS_STATE_ACK, DHCPS_STATE_IDLE, DHCPS_STATE_NAK, DHCPS_STATE_OFFER, DHCPS_STATE_RELEASE, os_memcmp, os_printf, renew, and dhcps_state::state.
Referenced by parse_msg().
|
static |
Definition at line 414 of file dhcpserver.c.
References add_end(), add_msg_type(), add_offer_options(), broadcast_dhcps, create_msg(), DHCPACK, DHCPS_CLIENT_PORT, pbuf::len, pbuf::next, NULL, dhcps_msg::options, os_printf, pbuf::payload, pbuf_alloc(), pbuf_free(), PBUF_RAM, PBUF_TRANSPORT, pcb_dhcps, pbuf::ref, and pbuf::tot_len.
Referenced by handle_dhcp().
|
static |
Definition at line 348 of file dhcpserver.c.
References add_end(), add_msg_type(), broadcast_dhcps, create_msg(), DHCPNAK, DHCPS_CLIENT_PORT, pbuf::len, pbuf::next, NULL, dhcps_msg::options, os_printf, pbuf::payload, pbuf_alloc(), pbuf_free(), PBUF_RAM, PBUF_TRANSPORT, pcb_dhcps, pbuf::ref, and pbuf::tot_len.
Referenced by handle_dhcp().
|
static |
Definition at line 282 of file dhcpserver.c.
References add_end(), add_msg_type(), add_offer_options(), broadcast_dhcps, create_msg(), DHCPOFFER, DHCPS_CLIENT_PORT, pbuf::len, pbuf::next, NULL, dhcps_msg::options, os_printf, pbuf::payload, pbuf_alloc(), pbuf_free(), PBUF_RAM, PBUF_TRANSPORT, pcb_dhcps, pbuf::ref, and pbuf::tot_len.
Referenced by handle_dhcp().
bool ICACHE_FLASH_ATTR wifi_softap_get_dhcps_lease | ( | struct dhcps_lease * | please | ) |
Definition at line 1007 of file dhcpserver.c.
References ip_addr::addr, DHCP_STOPPED, dhcps_lease::enable, dhcps_lease::end_ip, FALSE, NULL, NULL_MODE, dhcps_lease::start_ip, STATION_MODE, wifi_get_opmode(), and wifi_softap_dhcps_status().
uint32 ICACHE_FLASH_ATTR wifi_softap_get_dhcps_lease_time | ( | void | ) |
|
static |
Definition at line 843 of file dhcpserver.c.
References ip_addr::addr, DHCPS_MAX_LEASE, dhcps_lease::enable, dhcps_lease::end_ip, FALSE, htonl, os_bzero, dhcps_lease::start_ip, and TRUE.
Referenced by dhcps_start().
bool ICACHE_FLASH_ATTR wifi_softap_reset_dhcps_lease_time | ( | void | ) |
Definition at line 1135 of file dhcpserver.c.
References DHCP_STARTED, dhcps_lease_time, DHCPS_LEASE_TIME_DEF, NULL_MODE, STATION_MODE, wifi_get_opmode(), and wifi_softap_dhcps_status().
bool ICACHE_FLASH_ATTR wifi_softap_set_dhcps_lease | ( | struct dhcps_lease * | please | ) |
Definition at line 952 of file dhcpserver.c.
References ip_addr::addr, DHCP_STARTED, DHCPS_MAX_LEASE, dhcps_lease::enable, dhcps_lease::end_ip, htonl, ip_info::ip, NULL, NULL_MODE, os_bzero, SOFTAP_IF, dhcps_lease::start_ip, STATION_MODE, wifi_get_ip_info(), wifi_get_opmode(), and wifi_softap_dhcps_status().
Referenced by wifi_softap_ip_config().
bool ICACHE_FLASH_ATTR wifi_softap_set_dhcps_lease_time | ( | uint32 | minute | ) |
Definition at line 1116 of file dhcpserver.c.
References DHCP_STARTED, dhcps_lease_time, NULL_MODE, STATION_MODE, wifi_get_opmode(), and wifi_softap_dhcps_status().
bool ICACHE_FLASH_ATTR wifi_softap_set_dhcps_offer_option | ( | uint8 | level, |
void * | optarg | ||
) |
Definition at line 1094 of file dhcpserver.c.
References NULL, offer, OFFER_END, OFFER_ROUTER, and wifi_softap_dhcps_status().
|
static |
Definition at line 25 of file dhcpserver.c.
Referenced by dhcps_start(), send_ack(), send_nak(), and send_offer().
|
static |
Definition at line 27 of file dhcpserver.c.
Referenced by create_msg(), parse_msg(), and parse_options().
|
static |
Definition at line 28 of file dhcpserver.c.
Referenced by dhcps_start(), and parse_msg().
|
static |
Definition at line 32 of file dhcpserver.c.
uint32 dhcps_lease_time = DHCPS_LEASE_TIME_DEF |
Definition at line 38 of file dhcpserver.c.
Referenced by wifi_softap_get_dhcps_lease_time(), wifi_softap_reset_dhcps_lease_time(), and wifi_softap_set_dhcps_lease_time().
|
static |
Definition at line 30 of file dhcpserver.c.
|
static |
Definition at line 23 of file dhcpserver.c.
|
static |
Definition at line 35 of file dhcpserver.c.
Referenced by add_offer_options(), and wifi_softap_set_dhcps_offer_option().
|
static |
Definition at line 24 of file dhcpserver.c.
Referenced by dhcps_start(), dhcps_stop(), send_ack(), send_nak(), and send_offer().
Definition at line 34 of file dhcpserver.c.
Referenced by dhcps_coarse_tmr(), dhcps_stop(), espconn_accept(), espconn_connect(), espconn_create(), espconn_find_connection(), espconn_get_acticve_num(), espconn_get_connection_info(), espconn_list_creat(), espconn_list_delete(), espconn_pbuf_create(), espconn_pbuf_delete(), espconn_tcp_set_buf_count(), kill_oldest_dhcps_pool(), and node_insert_to_list().
|
static |
Definition at line 36 of file dhcpserver.c.
Referenced by parse_msg(), and parse_options().
|
static |
Definition at line 26 of file dhcpserver.c.
Referenced by add_offer_options(), and dhcps_start().