dhcp.h File Reference

#include "nip_init.h"
#include "nip_types.h"
#include "net/net_if.h"
#include "net/udp.h"

Include dependency graph for dhcp.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  nip_dhcp_option
 structure to evaluate known dhcp options More...
struct  nip_dhcp_packet
struct  nip_dhcp_config

Defines

#define NIP_DHCP_INIT_BACKOFF   4
 initial delay for exponential backoff algorithm
#define NIP_DHCP_MAX_BACKOFF   64
 maximum delay for exponential backoff algorithm
#define NIP_DHCP_OP_REQUEST   1
#define NIP_DHCP_OP_REPLY   2
#define DHCP_OPTION_PADDING   0
#define DHCP_OPTION_SUBNETMASK   1
#define DHCP_OPTION_ROUTER   3
#define DHCP_OPTION_DNS   6
#define DHCP_OPTION_HOST_NAME   12
#define DHCP_OPTION_DOMAINNAME   15
#define DHCP_OPTION_ROUTERDSCVR   31
#define DHCP_OPTION_NTPSERVERS   42
#define DHCP_OPTION_REQUEST_IP   50
#define DHCP_OPTION_LEASETIME   51
#define DHCP_OPTION_MSGTYPE   53
#define DHCP_OPTION_MSGTYPE_DISCOVER   1
#define DHCP_OPTION_MSGTYPE_OFFER   2
#define DHCP_OPTION_MSGTYPE_REQUEST   3
#define DHCP_OPTION_MSGTYPE_DECLINE   4
#define DHCP_OPTION_MSGTYPE_ACK   5
#define DHCP_OPTION_MSGTYPE_NAK   6
#define DHCP_OPTION_MSGTYPE_RELEASE   7
#define DHCP_OPTION_SERVERID   54
#define DHCP_OPTION_PARAMREQLIST   55
#define DHCP_OPTION_RENEWAL_TIME   58
#define DHCP_OPTION_REBINDING_TIME   59
#define DHCP_OPTION_VENDOR_CLASSID   60
#define DHCP_OPTION_CLIENT_IDENTIFIER   61
#define DHCP_OPTION_AUTO_CONFIGURE   116
#define DHCP_OPTION_END   255
#define NIP_DHCP_MAGIC_COOKIE   0x63825363
 DHCP Magic Cookie Option in Network Byte Order (decimal 99.130.82.99).

Enumerations

enum  nip_dhcp_stat_t {
  NIP_DHCP_STAT_DISABLED = 0, NIP_DHCP_STAT_INIT, NIP_DHCP_STAT_SELECTING, NIP_DHCP_STAT_REQUESTING,
  NIP_DHCP_STAT_BOUND, NIP_DHCP_STAT_RENEWING, NIP_DHCP_STAT_REBINDING, NIP_DHCP_STAT_REBOOTING
}

Functions

void nip_dhcp_start (nip_net_if_id_t net_if)
 enable dhcp for given network interface
void nip_dhcp_disable (nip_net_if_id_t net_if)
 disable dhcp for given network interface
void nip_dhcp_disp_check (void)
 Dispatcher function to be called to check dhcp status.


Define Documentation

#define DHCP_OPTION_AUTO_CONFIGURE   116

Definition at line 70 of file dhcp.h.

#define DHCP_OPTION_CLIENT_IDENTIFIER   61

Definition at line 69 of file dhcp.h.

#define DHCP_OPTION_DNS   6

Definition at line 49 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define DHCP_OPTION_DOMAINNAME   15

Definition at line 51 of file dhcp.h.

#define DHCP_OPTION_END   255

Definition at line 71 of file dhcp.h.

Referenced by nip_dhcp_disp_check(), and nip_dhcp_find_option().

#define DHCP_OPTION_HOST_NAME   12

Definition at line 50 of file dhcp.h.

#define DHCP_OPTION_LEASETIME   51

Definition at line 55 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define DHCP_OPTION_MSGTYPE   53

Definition at line 56 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define DHCP_OPTION_MSGTYPE_ACK   5

Definition at line 61 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define DHCP_OPTION_MSGTYPE_DECLINE   4

Definition at line 60 of file dhcp.h.

#define DHCP_OPTION_MSGTYPE_DISCOVER   1

Definition at line 57 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define DHCP_OPTION_MSGTYPE_NAK   6

Definition at line 62 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define DHCP_OPTION_MSGTYPE_OFFER   2

Definition at line 58 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define DHCP_OPTION_MSGTYPE_RELEASE   7

Definition at line 63 of file dhcp.h.

#define DHCP_OPTION_MSGTYPE_REQUEST   3

Definition at line 59 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define DHCP_OPTION_NTPSERVERS   42

Definition at line 53 of file dhcp.h.

#define DHCP_OPTION_PADDING   0

Definition at line 46 of file dhcp.h.

Referenced by nip_dhcp_find_option().

#define DHCP_OPTION_PARAMREQLIST   55

Definition at line 65 of file dhcp.h.

#define DHCP_OPTION_REBINDING_TIME   59

Definition at line 67 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define DHCP_OPTION_RENEWAL_TIME   58

Definition at line 66 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define DHCP_OPTION_REQUEST_IP   50

Definition at line 54 of file dhcp.h.

#define DHCP_OPTION_ROUTER   3

Definition at line 48 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define DHCP_OPTION_ROUTERDSCVR   31

Definition at line 52 of file dhcp.h.

#define DHCP_OPTION_SERVERID   54

Definition at line 64 of file dhcp.h.

#define DHCP_OPTION_SUBNETMASK   1

Definition at line 47 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define DHCP_OPTION_VENDOR_CLASSID   60

Definition at line 68 of file dhcp.h.

#define NIP_DHCP_INIT_BACKOFF   4

initial delay for exponential backoff algorithm

Definition at line 40 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define NIP_DHCP_MAGIC_COOKIE   0x63825363

DHCP Magic Cookie Option in Network Byte Order (decimal 99.130.82.99).

Definition at line 79 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define NIP_DHCP_MAX_BACKOFF   64

maximum delay for exponential backoff algorithm

Definition at line 41 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define NIP_DHCP_OP_REPLY   2

Definition at line 44 of file dhcp.h.

Referenced by nip_dhcp_disp_check().

#define NIP_DHCP_OP_REQUEST   1

Definition at line 43 of file dhcp.h.

Referenced by nip_dhcp_disp_check().


Enumeration Type Documentation

Enumerator:
NIP_DHCP_STAT_DISABLED 
NIP_DHCP_STAT_INIT 
NIP_DHCP_STAT_SELECTING 
NIP_DHCP_STAT_REQUESTING 
NIP_DHCP_STAT_BOUND 
NIP_DHCP_STAT_RENEWING 
NIP_DHCP_STAT_REBINDING 
NIP_DHCP_STAT_REBOOTING 

Definition at line 84 of file dhcp.h.


Function Documentation

void nip_dhcp_disable ( nip_net_if_id_t  net_if  ) 

disable dhcp for given network interface

Definition at line 67 of file dhcp.c.

References NIP_DHCP_CONF, and NIP_DHCP_STAT_DISABLED.

void nip_dhcp_disp_check ( void   ) 

Dispatcher function to be called to check dhcp status.

Todo:
use some unique number (part of mac address?)

Definition at line 135 of file dhcp.c.

References nip_if_ip_conf::addr, nip_dhcp_packet::chaddr, nip_dhcp_packet::ciaddr, CONF_ATTR, DHCP_OPTION_DNS, DHCP_OPTION_END, DHCP_OPTION_LEASETIME, DHCP_OPTION_MSGTYPE, DHCP_OPTION_MSGTYPE_ACK, DHCP_OPTION_MSGTYPE_DISCOVER, DHCP_OPTION_MSGTYPE_NAK, DHCP_OPTION_MSGTYPE_OFFER, DHCP_OPTION_MSGTYPE_REQUEST, DHCP_OPTION_REBINDING_TIME, DHCP_OPTION_RENEWAL_TIME, DHCP_OPTION_ROUTER, DHCP_OPTION_SUBNETMASK, DHCPMSGSIZE, nip_dhcp_packet::flags, nip_dhcp_packet::hlen, nip_dhcp_packet::htype, nip_phy_if_t::hw_addr, nip_phy_if_t::hw_addr_size, nip_net_if::ip_conf, nip_dhcp_option::ipaddr, nip_dhcp_packet::magic_cookie, nip_dhcp_option::msgtype, NIP_CURR_CMD, NIP_CURR_IF, NIP_DHCP_CONF, nip_dhcp_disp_sock_init(), nip_dhcp_find_option(), NIP_DHCP_INIT_BACKOFF, NIP_DHCP_MAGIC_COOKIE, NIP_DHCP_MAX_BACKOFF, NIP_DHCP_OP_REPLY, NIP_DHCP_OP_REQUEST, nip_dhcp_sock, NIP_DHCP_STAT_BOUND, NIP_DHCP_STAT_INIT, NIP_DHCP_STAT_REBINDING, NIP_DHCP_STAT_RENEWING, NIP_DHCP_STAT_REQUESTING, NIP_DHCP_STAT_SELECTING, NIP_E_OK, nip_ip_addr_autoconf(), nip_ip_addr_set(), nip_ip_subnet_set(), nip_memcpy(), nip_memset, nip_net_if_list, nip_tickcount, nip_udp_cancel_recv(), nip_udp_cancel_send(), nip_udp_close(), nip_udp_data_ptr(), nip_udp_forward(), nip_udp_init_send(), NIP_UDP_NO_SOCKET, NIP_UDP_PORT_DHCPSERVER, nip_udp_ptr_release(), nip_udp_recvfrom(), NIP_UDP_RX_BUF, nip_udp_transmit(), NIP_UDP_TX_BUF, nip_udp_write(), ntohl, NULL, nip_dhcp_packet::op, nip_dhcp_packet::options, nip_net_if::phy_conf, nip_if_ip_conf::std_gateway, nip_dhcp_option::time, nip_phy_if_t::type, nip_dhcp_option::valsize, nip_dhcp_option::value, nip_dhcp_packet::xid, and nip_dhcp_packet::yiaddr.

Here is the call graph for this function:

void nip_dhcp_start ( nip_net_if_id_t  net_if  ) 

enable dhcp for given network interface

Definition at line 59 of file dhcp.c.

References NIP_DHCP_CONF, NIP_DHCP_STAT_INIT, NIP_DISP_IF_DHCP, and nip_disp_notify_if().

Here is the call graph for this function:


Generated on Thu Jul 10 01:09:34 2008 for NIP by  doxygen 1.5.5