DHCP Client API - Digi International

Download Report

Transcript DHCP Client API - Digi International

DHCP Client API
Auto-Configuration with DHCP
1
Discover
DHCP Server
2
NETWORK
Offer
3
4
Request
Acknowledge
Enabling the DHCP Client
• Using Appconf.h
• Using NVRAM
– Set APP_USE_NVRAM to 0
– Set APP_IP_USE_DHCP to 1
– Set APP_USE_NVRAM to 0
– Use the useDHCP data
member
– Enable or disable DHCP
through the defaultParameters
record defaultParams) or
NVRAM (nvParams)
After Enabling, the Client…
• Configures the TCP/IP protocol stack with the correct
IP address, subnet mask, and default gateway
• Starts a background task that renews the lease
whenever it is about to expire
• Loads any DNS server acquired through DHCP into
the list of known DNS servers
• Calls DhcpNowBound()
DHCP API
•
• DhcpNowBound()
•
•
• DhcpLostLease()
•
Called when DHCP server
acknowledges the client.
IP Parameters accessible from
within this function:
– IP Address
– Subnet Mask
– Default Gateway
Called by lease renewal thread
when Client loses IP address
lease.
Used for “graceful” shutdown,
however IP address cannot be reused.