| 10 | #include "utility/util.h" |
| 11 | |
| 12 | int DhcpClass::beginWithDHCP(uint8_t *mac, unsigned long timeout, unsigned long responseTimeout) |
| 13 | { |
| 14 | _dhcpLeaseTime=0; |
| 15 | _dhcpT1=0; |
| 16 | _dhcpT2=0; |
| 17 | _lastCheck=0; |
| 18 | _timeout = timeout; |
| 19 | _responseTimeout = responseTimeout; |
| 20 | |
| 21 | // zero out _dhcpMacAddr |
| 22 | memset(_dhcpMacAddr, 0, 6); |
| 23 | reset_DHCP_lease(); |
| 24 | |
| 25 | memcpy((void*)_dhcpMacAddr, (void*)mac, 6); |
| 26 | _dhcp_state = STATE_DHCP_START; |
| 27 | return request_DHCP_lease(); |
| 28 | } |
| 29 | |
| 30 | void DhcpClass::reset_DHCP_lease(){ |
| 31 | // zero out _dhcpSubnetMask, _dhcpGatewayIp, _dhcpLocalIp, _dhcpDhcpServerIp, _dhcpDnsServerIp |