1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Initialize SoftAP DhcpServer object on demand (#8546)

* Initialize SoftAP DhcpServer object on demand

Remove dependency on global ctor, and just construct the object when
someone asks us to do it. Only dependency right now is netif_git, which
is expected to be initialized by the lwip code some time before
dhcps_start happens.

Removing ip_info from begin(), since we never reference later on.
Also removing the specific check for netif id and simplify the ctors.

Update tests and recover old nonos-sdk dhcps functions that were not implemented.

* nonos helpers have a separate header

* wifi ap needs this anyway, simplify sketch includes

* missing example

* existing name :/

* trying to fix header dependency

* restyle

* not a c header

* no need to init

* move dhcp server getter to WiFi

more... arduino'ish? we ahve object as namespace, plus everything else
related to softAP is there
redundant includes, redundant mock impl (out-of-scope here to fix)

* ...move things back, still expose as WiFi method

* review fix

* include -nonos header in wifi lib though

* no more lwip include

* style

* need mock dhcpserver instance
This commit is contained in:
Max Prokhorov
2022-06-01 23:46:04 +03:00
committed by GitHub
parent 61e7605549
commit 502d9469fa
15 changed files with 232 additions and 333 deletions

View File

@ -382,17 +382,17 @@ void wifi_softap_free_station_info(void);
bool wifi_softap_dhcps_start(void);
bool wifi_softap_dhcps_stop(void);
#if 1 // dhcp server
// these functions are open-source, in dhcp server,
// which is now moved to lwIPDhcpServer.cpp (lwip2)
// (but still there with lwip1)
// esp8266/Arduino notice:
// these dhcp functions are no longer provided by the lwip lib
// only way to include them is to build our NonOS LwipDhcpServer helpers
// (ref. libraries/ESP8266WiFi/src/ESP8266WiFiAP-DhcpServer.cpp)
bool wifi_softap_set_dhcps_lease(struct dhcps_lease *please);
bool wifi_softap_get_dhcps_lease(struct dhcps_lease *please);
uint32 wifi_softap_get_dhcps_lease_time(void);
bool wifi_softap_set_dhcps_lease_time(uint32 minute);
bool wifi_softap_reset_dhcps_lease_time(void);
bool wifi_softap_add_dhcps_lease(uint8 *macaddr); // add static lease on the list, this will be the next available @
#endif // dhcp server
enum dhcp_status wifi_softap_dhcps_status(void);
bool wifi_softap_set_dhcps_offer_option(uint8 level, void* optarg);