A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.

Dependents:   oldheating gps motorhome heating

Revision:
96:43eb7a110f1a
Parent:
93:580fc113d9e9
Child:
97:d91f7db00235
--- a/tcp/tcprecv.c	Fri Dec 14 11:36:45 2018 +0000
+++ b/tcp/tcprecv.c	Sat Dec 29 19:03:50 2018 +0000
@@ -106,14 +106,11 @@
     int action = DO_NOTHING;
     bool traceRequested = false;
     
-    Led1Set(true);
-    
     TcpHdrReadFromPacket(pPacketRx);
     
     if (remArIndex < 0)
     {
         log(traceback, "invalid remote AR index %d -> ignored packet", remArIndex);
-        Led1Set(false);
         return DO_NOTHING;
     }
     
@@ -141,7 +138,6 @@
         default: //Send reset if unknown port
             log(traceback, "unhandled local port %hu -> sent reset", TcpHdrDstPort);
             action = sendResetFromPacket(pSizeTx, pPacketTx, ipType, remArIndex, locIpScope, seqLengthRcvd);
-            Led1Set(false);
             return action;
     }
     
@@ -152,7 +148,6 @@
     {
         log(traceback, "no more tcbs available -> sent reset");
         action = sendResetFromPacket(pSizeTx, pPacketTx, ipType, remArIndex, locIpScope, seqLengthRcvd);
-        Led1Set(false);
         return action;
     }
     pTcb->timeLastRcvd     = MsTimerCount;
@@ -171,7 +166,6 @@
             log(traceback, "received reset -> reaped TCB");
             pTcb->state = TCB_EMPTY;
         }
-        Led1Set(false);
         return DO_NOTHING;        //Don't reply
     }
     
@@ -183,7 +177,6 @@
             log(traceback, "received a SYN on an open connection -> sent reset");
             pTcb->state = TCB_EMPTY;
             action = TcpSendReset(pSizeTx, pPacketTx, pTcb);
-            Led1Set(false);
             return action;
         }
         else
@@ -199,7 +192,6 @@
         log(traceback, "non SYN packet received on a closed connection -> sent reset");
         pTcb->state = TCB_EMPTY;
         action = sendResetFromPacket(pSizeTx, pPacketTx, ipType, remArIndex, locIpScope, seqLengthRcvd);
-        Led1Set(false);
         return action;
     }
     
@@ -229,7 +221,6 @@
             log(traceback, "seq rcvd is %d and last seq ackd was %d -> resent last ACK", seqRcvdFromRem, pTcb->bytesAckdToRem);
         }
         action = TcpResendLastAck(pSizeTx, pPacketTx, pTcb);
-        Led1Set(false);
         return action;
     }
     //Ignore data before established
@@ -238,12 +229,9 @@
         log(traceback, "data received before connection established -> sent reset");
         pTcb->state = TCB_EMPTY;
         action = TcpSendReset(pSizeTx, pPacketTx, pTcb);
-        Led1Set(false);
         return action;
     }
     
-    Led2Set(true);
-    
     //Handle FIN
     if (TcpHdrFIN) pTcb->rcvdFin = true; //When reply is all sent only a passive close is needed
     
@@ -281,8 +269,6 @@
     }
     
     action = TcpSend(pSizeTx, pPacketTx, pTcb);
-    Led1Set(false);
-    Led2Set(false);
 
     return action;
 }