Nicolas Nackel / Mbed 2 deprecated PPP-Blinky

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
nixnax
Date:
Sat Sep 02 01:55:19 2017 +0000
Parent:
157:3a3530d60e96
Child:
159:4d1bf96a59cd
Commit message:
Comments

Changed in this revision

PPP-Blinky/ppp-blinky.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/PPP-Blinky/ppp-blinky.cpp	Sat Sep 02 01:36:09 2017 +0000
+++ b/PPP-Blinky/ppp-blinky.cpp	Sat Sep 02 01:55:19 2017 +0000
@@ -961,7 +961,7 @@
     // A sparse TCP flag interpreter that implements stateless TCP connections
 
     switch ( ppp.tcp->flag.All ) {
-        case TCP_FLAG_ACK:
+        case TCP_FLAG_ACK: // handle ack messages by ignoring them
             return;
         case TCP_FLAG_SYN:
             flagsOut = TCP_FLAG_SYN | TCP_FLAG_ACK; // something wants to connect - acknowledge it
@@ -973,7 +973,7 @@
                 flagsOut = TCP_FLAG_ACK | TCP_FLAG_PSH; // set outgoing FIN flag to ask them to close from their side
                 dataLen = httpResponse(tcpDataOut); // send an http response
             } else {
-                dataLen = tcpResponse(tcpDataOut,tcpDataSize, &flagsOut); // not a web request, send a packet reporting number of received bytes
+                dataLen = tcpResponse(tcpDataOut,tcpDataSize, &flagsOut); // not an http GET, handle as a tcp connection
             }
             break;
         case TCP_FLAG_FIN:
@@ -991,8 +991,8 @@
     swapIpAddresses(); // swap IP source and destination addresses
     swapIpPorts(); // swap IP  source and destination ports
 
-    ppp.tcp->ackTcpR = __REV( ack_out );
-    ppp.tcp->seqTcpR = __REV( seq_out );
+    ppp.tcp->ackTcpR = __REV( ack_out ); // byte reversed - tcp/ip messages are big-endian (high byte first)
+    ppp.tcp->seqTcpR = __REV( seq_out ); // byte reversed - tcp/ip messages are big-endian (high byte first)
     
     ppp.tcp->flag.All = flagsOut; // update the TCP flags