Lab2_web / Mbed 2 deprecated webserverBlinky

Dependencies:   mbed

Fork of webserverBlinky by RealTimeCompLab2

Revision:
92:cb962b365cce
Parent:
91:5141ae9fba53
Child:
93:9675adc36882
--- a/main.cpp	Sun Jul 23 06:50:57 2017 +0000
+++ b/main.cpp	Sun Jul 23 17:57:31 2017 +0000
@@ -17,13 +17,18 @@
 
 // Handy tools
 // https://ttssh2.osdn.jp/index.html.en - Tera Term, a good terminal program to monitor the debug output from the second serial port with!
-// https://www.microsoft.com/en-us/download/details.aspx?id=4865 - Microsoft network monitor - real-time monitoring of PPP packets - 
+// https://www.microsoft.com/en-us/download/details.aspx?id=4865 - Microsoft network monitor - real-time monitoring of PPP packets -
 // http://pingtester.net/ - nice tool for high rate ping testing
 // http://www.sunshine2k.de/coding/javascript/crc/crc_js.html - Correctly calculates the 16-bit FCS (crc) on our frames (Choose CRC16_CCITT_FALSE)
 // https://technet.microsoft.com/en-us/sysinternals/pstools.aspx - psping for fast testing of ICMP ping function
 // https://eternallybored.org/misc/netcat/ - use netcat -u 172.10.10.1 80 to send/receive UDP packets from PPP-Blinky
 // Windows Powershell invoke-webrequest command - use it to stress test the webserver like this:  while (1){ invoke-webrequest -uri 172.10.10.1/x }
 
+// Connecting PPP-Blinky to Linux
+// PPP-Blinky can be made to run on Linux - on Fedora, the following command, which uses pppd, works:
+// pppd /dev/ttyACM0 115200 debug dump local passive noccp novj updetach nocrtscts 172.10.10.1:172.10.10.2
+// in the above command 172.10.10.1 is the adapter IP, and 172.10.10.2 is the IP of PPP-Blinky.
+
 #include "mbed.h"
 
 // The #define below enables/disables a SECOND (optional) serial port that prints out interesting diagnostic messages.
@@ -265,21 +270,16 @@
 
 void ipConfigRequestHandler()
 {
-    debug("IPCP Conf ");
-    if ( ppp.pkt.buf[7] != 4 ) {
-        debug("Rej\n"); // reject any options that are requested
-        ppp.pkt.buf[4]=4;
-        sendFrame();
-    } else  {
-        debug("Ack\n");
-        ppp.pkt.buf[4]=2; // ack the minimum
-        sendFrame(); // acknowledge
-        debug("IPCP Ask\n");
-        // send our own request now
-        ppp.pkt.buf[4]=1; // request no options
-        ppp.pkt.buf[5]++; // next sequence
-        sendFrame(); // this is our request
-    }
+    debug("IPCP Conf Ack\n");
+    ppp.pkt.buf[4]=2; // change code to ack
+    sendFrame(); // blind acknowledge everything they ask for
+    debug("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
+    sendFrame(); // this is our request
+    return;
 }
 
 void ipAckHandler()
@@ -661,7 +661,7 @@
     int dataLen = 0; // most of our responses will have zero TCP data, only a header
     int flagsOut = TCP_FLAG_ACK; // the default case is an ACK packet
     int flagsTCP = ((flagbitstcp[0]&1)<<8)|flagbitstcp[1]; // the tcp flags we received
-    
+
     windowsizetcp[0]=3; // ignore window size negotiation
     windowsizetcp[1]=0; // ignore winodw size negotiation