DHCP client
[Applications]


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.


Files

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

Typedefs

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

Enumerations

enum  dhcp_client_event {
  DHCP_CLIENT_EVT_LEASE_ACQUIRED, DHCP_CLIENT_EVT_LEASE_DENIED, DHCP_CLIENT_EVT_LEASE_EXPIRING, DHCP_CLIENT_EVT_LEASE_EXPIRED,
  DHCP_CLIENT_EVT_TIMEOUT, DHCP_CLIENT_EVT_ERROR
}
 The events the DHCP client may fire. More...

Functions

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.

Enumerator:
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.

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

void dhcp_client_abort (  ) 

Aborts all ongoing DHCP actions and terminates the client.

Note:
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