DHCP client

Detailed Description

A DHCP client for automatically retrieving the network configuration when the link goes up.

The client provides some events through a callback function. These events inform the application whenever e.g. the network has been successfully configured or the DHCP lease has expired.


file  dhcp_client.c
 DHCP client implementation (license: GPLv2).
file  dhcp_client.h
 DHCP client header (license: GPLv2).


typedef void(* dhcp_client_callback )(enum dhcp_client_event event)
 The type of callback function used for issuing events.


enum  dhcp_client_event {
 The events the DHCP client may fire. More...


bool dhcp_client_start (dhcp_client_callback callback)
 Starts the DHCP client.
void dhcp_client_abort ()
 Aborts all ongoing DHCP actions and terminates the client.

Enumeration Type Documentation

The events the DHCP client may fire.

DHCP_CLIENT_EVT_LEASE_ACQUIRED  The network has been successfully configured.

DHCP_CLIENT_EVT_LEASE_DENIED  The DHCP server has denied a configuration.

DHCP_CLIENT_EVT_LEASE_EXPIRING  The network configuration is about to expire, a new configuration cycle is being started.

DHCP_CLIENT_EVT_LEASE_EXPIRED  The network configuration has expired and could not be renewed.

The network interface should be deconfigured.

DHCP_CLIENT_EVT_TIMEOUT  No DHCP server responded to our requests.

DHCP_CLIENT_EVT_ERROR  An unknown error occured.

Function Documentation

bool dhcp_client_start ( dhcp_client_callback  callback  ) 

Starts the DHCP client.

When the client was started successfully, DHCP requests are being broadcasted on the network.

[in] callback A function pointer which is called for every event the client generates.
true if the client was started successfully, false on failure.

void dhcp_client_abort (  ) 

Aborts all ongoing DHCP actions and terminates the client.

The network configuration is not changed by calling this function. You may want to deconfigure the network interface to no longer occupy an IP address managed by the DHCP server.

Generated on Thu May 22 18:12:37 2008 for mega-eth by  doxygen 1.5.5