Permalink
Browse files

fixed bugs in dhcp

  • Loading branch information...
1 parent 8d90d45 commit e7313d8e3a782f2cd36dc8b3c0f596f5db2fd437 @vicatcu vicatcu committed Oct 14, 2012
Showing with 255 additions and 486 deletions.
  1. +4 −0 EtherCard.cpp
  2. +2 −2 EtherCard.h
  3. +242 −433 dhcp.cpp
  4. +0 −7 examples/backSoon/backSoon.ino
  5. +0 −4 examples/getDHCPandDNS/getDHCPandDNS.ino
  6. +1 −39 examples/nanether/nanether.ino
  7. +6 −1 tcpip.cpp
View
@@ -340,10 +340,12 @@ uint8_t EtherCard::dhcpip[4]; // dhcp server
uint8_t EtherCard::dnsip[4]; // dns server
uint8_t EtherCard::hisip[4]; // dns result
uint16_t EtherCard::hisport = 80; // tcp port to browse to
+bool EtherCard::using_dhcp = false;
uint8_t EtherCard::begin (const uint16_t size,
const uint8_t* macaddr,
uint8_t csPin) {
+ using_dhcp = false;
Stash::initMap(56);
copyMac(mymac, macaddr);
return initialize(size, mymac, csPin);
@@ -352,6 +354,8 @@ uint8_t EtherCard::begin (const uint16_t size,
bool EtherCard::staticSetup (const uint8_t* my_ip,
const uint8_t* gw_ip,
const uint8_t* dns_ip) {
+ using_dhcp = false;
+
if (my_ip != 0)
copyIp(myip, my_ip);
if (gw_ip != 0)
View
@@ -129,6 +129,7 @@ class EtherCard : public Ethernet {
static uint8_t dnsip[4]; // dns server
static uint8_t hisip[4]; // dns result
static uint16_t hisport; // tcp port to connect to (default 80)
+ static bool using_dhcp; // whether dhcp is active or not
// EtherCard.cpp
static uint8_t begin (const uint16_t size, const uint8_t* macaddr,
uint8_t csPin =8);
@@ -164,10 +165,9 @@ class EtherCard : public Ethernet {
static uint8_t tcpSend ();
static const char* tcpReply (byte fd);
// dhcp.cpp
+ static void DhcpStateMachine(word len);
static uint32_t dhcpStartTime ();
static uint32_t dhcpLeaseTime ();
- static byte dhcpFSM ();
- static bool dhcpValid ();
static bool dhcpLease ();
static bool dhcpSetup (const char *);
static bool dhcpSetup ();
Oops, something went wrong.

0 comments on commit e7313d8

Please sign in to comment.