Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Related Pages  

DHCP Routines

Discover a DHCP server and request boot information. More...

Data Structures

struct  bootp

Defines

#define DHCP_SERVERPORT   67
#define DHCP_CLIENTPORT   68
#define DHCPOPT_PAD   0
#define DHCPOPT_NETMASK   1
#define DHCPOPT_GATEWAY   3
#define DHCPOPT_DNS   6
#define DHCPOPT_HOSTNAME   12
#define DHCPOPT_DOMAIN   15
#define DHCPOPT_BROADCAST   28
#define DHCPOPT_REQUESTIP   50
#define DHCPOPT_LEASETIME   51
#define DHCPOPT_MSGTYPE   53
#define DHCPOPT_SID   54
#define DHCPOPT_RENEWALTIME   58
#define DHCPOPT_REBINDTIME   59
#define DHCPOPT_END   255
#define DHCP_DISCOVER   1
#define DHCP_OFFER   2
#define DHCP_REQUEST   3
#define DHCP_DECLINE   4
#define DHCP_ACK   5
#define DHCP_NAK   6
#define DHCP_RELEASE   7
#define DHCP_INFORM   8

Typedefs

typedef bootp BOOTPHDR

Functions

u_short DhcpFrameInit (void)
 Initialize the global send frame for DHCP requests.

u_short DhcpRequestFrame (void)
u_char DhcpGetOption (u_char opt, void *ptr, u_char size)
 Retrive the specified DCHP option.

int DhcpQuery (void)
 Query any DHCP server on the local net.


Variables

u_char cookie [4] = { 0x63, 0x82, 0x53, 0x63 }

Detailed Description

Discover a DHCP server and request boot information.


Function Documentation

u_short DhcpFrameInit void   
 

Initialize the global send frame for DHCP requests.

Returns:
Size of the frame.

Definition at line 110 of file dhcp.c.

u_char DhcpGetOption u_char    opt,
void *    ptr,
u_char    size
 

Retrive the specified DCHP option.

Parameters:
opt  Option to look for.
ptr  Pointer to the buffer that receives the option value.
size  Size of the buffer.
Returns:
Size of the retrieved option value or zero, if the specified option couldn't be found.

Definition at line 173 of file dhcp.c.

int DhcpQuery void   
 

Query any DHCP server on the local net.

On success, this routine will fill some global variables:

  • local_ip
  • server_ip
  • bootfile
  • netmask
  • broadcast
  • gateway
  • dns
  • sid
Returns:
0 on success, -1 otherwise.

Definition at line 217 of file dhcp.c.


© 2002 by egnite Software GmbH - visit http://www.ethernut.de/