Extending DHCP Options
Posted: Sun Feb 12, 2017 6:46 pm
I'm trying to add the ability to request and decode more DHCP options from a DHCP server (for example, an NTP server) but I'm having a hard time following all the loops of code for version 2.3.0. So far I have added the option numbers to the lwip library dhcp.h and extended the functions in dhcp.c to transmit the extra option numbers in the request. I also extended the parser to look for the additional options however this is where things start to break down.
I was planning to extend the Arduino IDE library to add functions that fetch these additional option values (for example, adding ntpserverIP() to the library) and I was trying to follow the existing localIP() but I seem to lose where the Arduino library is able to reach back into lwip to get the values. I see the function is present in both ESP8266WiFiSTA.cpp and WiFiClient.cpp but with two different methods of acquiring an IP, one pulls from a struct using wifi_get_ip_info() and the other returns the value from a function _client->getLocalAddress()
I tried creating new null functions in WiFiClient.cpp but I get an error that the ESP8266WiFiClass has no member named ntpserverIP() which says to me that the IDE is not utilizing WiFiClient therefore it must be using ESP8266WiFiSTA instead but now I'm lost about how to bring the additional data from lwip over to ESP8266WiFiSTA or if I'm even looking in the right place.
I was planning to extend the Arduino IDE library to add functions that fetch these additional option values (for example, adding ntpserverIP() to the library) and I was trying to follow the existing localIP() but I seem to lose where the Arduino library is able to reach back into lwip to get the values. I see the function is present in both ESP8266WiFiSTA.cpp and WiFiClient.cpp but with two different methods of acquiring an IP, one pulls from a struct using wifi_get_ip_info() and the other returns the value from a function _client->getLocalAddress()
I tried creating new null functions in WiFiClient.cpp but I get an error that the ESP8266WiFiClass has no member named ntpserverIP() which says to me that the IDE is not utilizing WiFiClient therefore it must be using ESP8266WiFiSTA instead but now I'm lost about how to bring the additional data from lwip over to ESP8266WiFiSTA or if I'm even looking in the right place.