DHCPStartup


C Specification

#include <dolphin/ip.h>

typedef void (* DHCPCallback )( int state );

BOOL DHCPStartup( DHCPCallback callback );

Description

DHCPStartup() starts up the DHCP state machine. The library run-time sends four DHCPDISCOVER packets, with timeouts of 4, 8, 16 and 32 seconds, for a total delay of 60 seconds. Once the host is successfully configured by a DHCP server, the DHCP state machine moves to DHCP_STATE_BOUND state. When no response is received, the state machine reverts to DHCP_STATE_INIT state.

By default, if the DHCP configuration is failed, the DHCP state machine is automatically restarted. Automatic restart can be disabled with DHCPAuto(). If automatic restart is disabled, it is up to an application program to restart the DHCP state machine when the configuration is failed with DHCPStartup().

The current state of the DHCP state machine can be queried by DHCPGetStatus(). Whenever the state of the DHCP state machine is changed, the optional callback function will be called with the new state as the argument.

If the the assigned network address is no longer required, DHCPCleanup() can be called to release the assigned address.

Arguments

callback Optional callback to be called whenever the state machine state is changed.

Return Values

If function is successful, TRUE is returned. Otherwise FALSE is returned.

See Also

DHCPGetStatus(), DHCPCleanup(), DHCPAuto()