Lab2_web / Mbed 2 deprecated webserverBlinky

Dependencies:   mbed

Fork of webserverBlinky by RealTimeCompLab2

Revision:
103:4f5512dd11cf
Parent:
102:a89c55672170
Child:
104:b1280b084f75
--- a/main.cpp	Mon Jul 31 05:43:02 2017 +0000
+++ b/main.cpp	Mon Jul 31 08:14:13 2017 +0000
@@ -276,12 +276,14 @@
     ppp.pkt.buf[4]=2; // change code to ack
     send_pppFrame(); // simply acknowledge everything they ask for
     debug("Our IPCP Ask\n");
-    // send our own request now
     ppp.pkt.buf[4]=1; // change code to request
-    ppp.pkt.buf[5]++; // increment sequence number
-    ppp.pkt.buf[7]=4; // no options requested
-    send_pppFrame(); // this is our request
-    return;
+    if (ppp.pkt.buf[8]==3) { // check if this is an ip address request
+        ppp.pkt.buf[13]++; // choose next ip address
+    } else { // not an IP request, respond with empty request
+        ppp.pkt.len=10; // shortest ipcp packet possible (4 ppp + 4 ipcp + 2 crc)
+        ppp.pkt.buf[7]=4; // no options in this request
+    }
+    send_pppFrame(); // send our request
 }
 
 void ipcpAckHandler()
@@ -512,7 +514,6 @@
 void dumpHeaderTCP()
 {
     if( v0 ) {
-
         int headerSizeIP     = (ppp.pkt.buf[4]&0xf)*4; // header size of ip portion
         char * tcpStart      =  ppp.pkt.buf+4+headerSizeIP; // start of tcp packet
 #ifndef SERIAL_PORT_MONITOR_NO
@@ -664,7 +665,6 @@
     unsigned int ack_out = seq_in + tcpDataSize;
     unsigned int seq_out = ack_in; // use their version of our current sequence number
 
-
 #define TCP_FLAG_ACK (1<<4)
 #define TCP_FLAG_SYN (1<<1)
 #define TCP_FLAG_PSH (1<<3)
@@ -979,8 +979,8 @@
             ppp.online=1; // we are connected, so stop looking for the string
         }
     }
+}
 
-}
 
 int main()
 {
@@ -996,4 +996,4 @@
             wait_for_HDLC_frame();
         }
     }
-}
\ No newline at end of file
+}