STM32Ethernet
Arduino Ethernet library for STM32 boards
Loading...
Searching...
No Matches
DhcpClass Class Reference

#include <Dhcp.h>

Public Member Functions

IPAddress getLocalIp ()
 Returns the local IP address assigned by DHCP.
 
IPAddress getSubnetMask ()
 Returns the subnet mask assigned by DHCP.
 
IPAddress getGatewayIp ()
 Returns the default gateway address assigned by DHCP.
 
IPAddress getDhcpServerIp ()
 Returns the address of the DHCP server.
 
IPAddress getDnsServerIp ()
 Returns the DNS server address assigned by DHCP.
 
int beginWithDHCP (uint8_t *mac, unsigned long timeout=60000, unsigned long responseTimeout=4000)
 Starts a DHCP lease request.
 
int checkLease ()
 Checks the DHCP lease for a renew or rebind result.
 

Member Function Documentation

◆ beginWithDHCP()

int DhcpClass::beginWithDHCP ( uint8_t *  mac,
unsigned long  timeout = 60000,
unsigned long  responseTimeout = 4000 
)

Starts a DHCP lease request.

Blocks until a lease is obtained or the timeout expires.

Parameters
macSix-byte MAC address to use. If NULL, the MAC address of the Ethernet interface is used.
timeoutMaximum time to wait for the lease, in milliseconds.
responseTimeoutUnused; kept for compatibility.
Returns
1 if the lease was granted, 0 otherwise.

◆ checkLease()

int DhcpClass::checkLease ( )

Checks the DHCP lease for a renew or rebind result.

Runs the Ethernet scheduler on each call. Applications normally call it through Ethernet.maintain(), which should be run regularly.

Returns
DHCP_CHECK_NONE (0) if nothing happened, DHCP_CHECK_RENEW_FAIL (1), DHCP_CHECK_RENEW_OK (2), DHCP_CHECK_REBIND_FAIL (3) or DHCP_CHECK_REBIND_OK (4).

◆ getDhcpServerIp()

IPAddress DhcpClass::getDhcpServerIp ( )

Returns the address of the DHCP server.

Returns
The DHCP server address.

◆ getDnsServerIp()

IPAddress DhcpClass::getDnsServerIp ( )

Returns the DNS server address assigned by DHCP.

Returns
The DNS server address.

◆ getGatewayIp()

IPAddress DhcpClass::getGatewayIp ( )

Returns the default gateway address assigned by DHCP.

Returns
The gateway address.

◆ getLocalIp()

IPAddress DhcpClass::getLocalIp ( )

Returns the local IP address assigned by DHCP.

Returns
The local IP address.

◆ getSubnetMask()

IPAddress DhcpClass::getSubnetMask ( )

Returns the subnet mask assigned by DHCP.

Returns
The subnet mask.

The documentation for this class was generated from the following files: