/* MIPS I system
* Copyright 2011-2012 Stefan Schuermans <stefan@schuermans.info>
* Copyleft GNU public license V2 or later
* http://www.gnu.org/copyleft/gpl.html
*/
#include "config.h"
#include "checksum.h"
#include "dhcp.h"
#include "ethernet.h"
#include "ip.h"
#include "macros.h"
#include "memcpy.h"
#include "nethelp.h"
#include "random.h"
#include "udp.h"
/// configuration
//@{
/// avarage timeout after which to retry DHCP action
static const unsigned char dhcp_retry_secs_max = 10;
/// maximum number of retries before aborting DHCP action
static const unsigned char dhcp_retries_max = 5;
/// when to ask to extend lease
static const unsigned long dhcp_lease_rest_min = 300;
/// to renw lease when only this fraction of lease is left
static const unsigned char dhcp_lease_renew_fraction = 8;
//@}
/// DHCP tick counter to get full seconds
static unsigned char dhcp_ticks = 0;
/// time of current DHCP action
//@{
static unsigned char dhcp_in_progress = 0; ///< if DHCP action is in progress
static unsigned char dhcp_retries = 0; ///< number of retries left
static unsigned char dhcp_retry_secs = 0; ///< rest of time for current retry
//@}
/// current x_id
//@{
static unsigned char dhcp_have_x_id = 0; ///< if an x_id exists at the moment
static unsigned long dhcp_x_id = 0; ///< the current x_id data
static unsigned short dhcp_x_id_secs = 0; ///< time of x_id
//@}
/// DHCP server and lease time
//@{
static unsigned char dhcp_active = 0; ///< if own IP is leased from DHCP
static unsigned char dhcp_server[4]; /**< IP address of DHCP server
own IP is leased from */