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

Committer:
andrewboyson
Date:
Thu Jan 03 17:23:38 2019 +0000
Revision:
98:b977424ec7f7
Parent:
97:d91f7db00235
Child:
111:3600389d1add
Added more fault positions and removed need for a net server module. Added need for the ethernet jack leds definition.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 74:c3756bfa960e 1 #include <stdint.h>
andrewboyson 74:c3756bfa960e 2 #include <stdbool.h>
andrewboyson 75:603b10404183 3 #include <stdarg.h>
andrewboyson 74:c3756bfa960e 4
andrewboyson 74:c3756bfa960e 5 #include "log.h"
andrewboyson 74:c3756bfa960e 6 #include "net.h"
andrewboyson 74:c3756bfa960e 7 #include "action.h"
andrewboyson 74:c3756bfa960e 8 #include "tcp.h"
andrewboyson 74:c3756bfa960e 9 #include "tcphdr.h"
andrewboyson 74:c3756bfa960e 10 #include "tcpsend.h"
andrewboyson 74:c3756bfa960e 11 #include "tcb.h"
andrewboyson 74:c3756bfa960e 12 #include "ip4.h"
andrewboyson 74:c3756bfa960e 13 #include "dhcp.h"
andrewboyson 74:c3756bfa960e 14 #include "http.h"
andrewboyson 74:c3756bfa960e 15 #include "led.h"
andrewboyson 93:580fc113d9e9 16 #include "mstimer.h"
andrewboyson 97:d91f7db00235 17 #include "fault.h"
andrewboyson 89:9b765a67699b 18
andrewboyson 89:9b765a67699b 19 static void log(void (*traceback)(void), char* fmt, ...)
andrewboyson 74:c3756bfa960e 20 {
andrewboyson 78:9d8fc88df405 21 if (TcpTrace)
andrewboyson 78:9d8fc88df405 22 {
andrewboyson 78:9d8fc88df405 23 if (NetTraceNewLine) Log("\r\n");
andrewboyson 89:9b765a67699b 24 LogTimeF("TCP port %hu - ", TcpHdrSrcPort);
andrewboyson 75:603b10404183 25 va_list argptr;
andrewboyson 75:603b10404183 26 va_start(argptr, fmt);
andrewboyson 75:603b10404183 27 LogV(fmt, argptr);
andrewboyson 75:603b10404183 28 va_end(argptr);
andrewboyson 75:603b10404183 29 Log("\r\n");
andrewboyson 75:603b10404183 30 if (NetTraceStack) traceback();
andrewboyson 75:603b10404183 31 }
andrewboyson 75:603b10404183 32 }
andrewboyson 75:603b10404183 33
andrewboyson 88:1ba13e6062a3 34 static void handleSyn(void *pPacket, int ipType, int remArIndex, int locMss, struct tcb* pTcb)
andrewboyson 74:c3756bfa960e 35 {
andrewboyson 74:c3756bfa960e 36 //Get the MSS to use for sends - it is the lower of the MSS advertised by the remote host and our local MSS
andrewboyson 74:c3756bfa960e 37 int remMss = TcpHdrMssGet();
andrewboyson 74:c3756bfa960e 38 pTcb->remMss = remMss ? remMss : 536; //default MSS for IPv4 [576 - 20(TCP) - 20(IP)];
andrewboyson 74:c3756bfa960e 39 if (pTcb->remMss > locMss) pTcb->remMss = locMss;
andrewboyson 74:c3756bfa960e 40
andrewboyson 93:580fc113d9e9 41 pTcb->timeSendsBeingAcked = MsTimerCount;
andrewboyson 82:20781198d26d 42 pTcb->countSendsNotAcked = 0;
andrewboyson 79:f50e02fb5c94 43 pTcb->rcvdFin = false;
andrewboyson 79:f50e02fb5c94 44 pTcb->sentFin = false;
andrewboyson 79:f50e02fb5c94 45 pTcb->todo = 0;
andrewboyson 79:f50e02fb5c94 46 pTcb->remIsn = TcpHdrSeqNum;
andrewboyson 79:f50e02fb5c94 47 pTcb->locIsn = TcbGetIsn();
andrewboyson 79:f50e02fb5c94 48 pTcb->bytesRcvdFromRem = 0;
andrewboyson 79:f50e02fb5c94 49 pTcb->bytesAckdByRem = 0;
andrewboyson 79:f50e02fb5c94 50 pTcb->bytesAckdToRem = 0;
andrewboyson 79:f50e02fb5c94 51 pTcb->bytesSentToRem = 0;
andrewboyson 74:c3756bfa960e 52 }
andrewboyson 88:1ba13e6062a3 53 static void handleReceivedData(void* pPacket, int dataLength, uint32_t position, struct tcb* pTcb)
andrewboyson 74:c3756bfa960e 54 {
andrewboyson 74:c3756bfa960e 55 pTcb->window = TcpHdrWindow;
andrewboyson 74:c3756bfa960e 56 char* pData = (char*)pPacket + TcpHdrSizeGet();
andrewboyson 74:c3756bfa960e 57 switch (pTcb->locPort)
andrewboyson 74:c3756bfa960e 58 {
andrewboyson 74:c3756bfa960e 59 case 80:
andrewboyson 75:603b10404183 60 HttpHandleRequest(dataLength, pData, position, &pTcb->todo);
andrewboyson 74:c3756bfa960e 61 break;
andrewboyson 74:c3756bfa960e 62 default:
andrewboyson 74:c3756bfa960e 63 break;
andrewboyson 74:c3756bfa960e 64 }
andrewboyson 74:c3756bfa960e 65 }
andrewboyson 90:955f4c6e18a9 66 static int sendResetFromPacket(int* pSizeTx, void* pPacketTx, int ipType, int remArIndex, int locIpScope, int seqLengthRcvd)
andrewboyson 89:9b765a67699b 67 {
andrewboyson 90:955f4c6e18a9 68 /*RFC793 p36 If the connection does not exist (CLOSED) then a reset is sent
andrewboyson 90:955f4c6e18a9 69 in response to any incoming segment except another reset.
andrewboyson 90:955f4c6e18a9 70 If the incoming segment has an ACK field, the reset takes its sequence number from the ACK field of the segment,
andrewboyson 90:955f4c6e18a9 71 otherwise the reset has sequence number zero
andrewboyson 90:955f4c6e18a9 72 and
andrewboyson 90:955f4c6e18a9 73 the ACK field is set to the sum of the sequence number and segment length of the incoming segment.
andrewboyson 90:955f4c6e18a9 74 The connection remains in the CLOSED state.
andrewboyson 90:955f4c6e18a9 75 In TcpSendReset TcpHdrAckNum = pTcb->bytesAckdToRem + pTcb->remIsn; //Set up the acknowledgement field ready to send
andrewboyson 90:955f4c6e18a9 76 TcpHdrSeqNum = pTcb->bytesSentToRem + pTcb->locIsn; //Set up the start of the message before adding the bytes sent
andrewboyson 90:955f4c6e18a9 77 */
andrewboyson 90:955f4c6e18a9 78
andrewboyson 89:9b765a67699b 79 struct tcb tcb;
andrewboyson 89:9b765a67699b 80 struct tcb* pTcb = &tcb;
andrewboyson 93:580fc113d9e9 81 pTcb->timeLastRcvd = MsTimerCount;
andrewboyson 89:9b765a67699b 82 pTcb->remArIndex = remArIndex;
andrewboyson 89:9b765a67699b 83 pTcb->ipType = ipType;
andrewboyson 89:9b765a67699b 84 pTcb->locIpScope = locIpScope;
andrewboyson 89:9b765a67699b 85 pTcb->remPort = TcpHdrSrcPort;
andrewboyson 89:9b765a67699b 86 pTcb->locPort = TcpHdrDstPort;
andrewboyson 89:9b765a67699b 87 pTcb->window = TcpHdrWindow;
andrewboyson 89:9b765a67699b 88 pTcb->state = TCB_EMPTY;
andrewboyson 89:9b765a67699b 89
andrewboyson 93:580fc113d9e9 90 pTcb->timeSendsBeingAcked = MsTimerCount;
andrewboyson 90:955f4c6e18a9 91 pTcb->countSendsNotAcked = 0;
andrewboyson 90:955f4c6e18a9 92 pTcb->rcvdFin = false;
andrewboyson 90:955f4c6e18a9 93 pTcb->sentFin = false;
andrewboyson 90:955f4c6e18a9 94 pTcb->todo = 0;
andrewboyson 90:955f4c6e18a9 95 pTcb->remIsn = TcpHdrSeqNum + seqLengthRcvd; //Ack number
andrewboyson 90:955f4c6e18a9 96 pTcb->locIsn = TcpHdrACK ? TcpHdrAckNum : 0; //Seq number
andrewboyson 90:955f4c6e18a9 97 pTcb->bytesRcvdFromRem = 0;
andrewboyson 90:955f4c6e18a9 98 pTcb->bytesAckdByRem = 0;
andrewboyson 90:955f4c6e18a9 99 pTcb->bytesAckdToRem = 0;
andrewboyson 90:955f4c6e18a9 100 pTcb->bytesSentToRem = 0;
andrewboyson 90:955f4c6e18a9 101
andrewboyson 89:9b765a67699b 102 return TcpSendReset(pSizeTx, pPacketTx, pTcb);
andrewboyson 89:9b765a67699b 103 }
andrewboyson 74:c3756bfa960e 104
andrewboyson 80:4ef1500fca1d 105 int TcpHandleReceivedPacket(void (*traceback)(void), int sizeRx, void* pPacketRx, int* pSizeTx, void* pPacketTx, int ipType, int remArIndex, int locIpScope)
andrewboyson 74:c3756bfa960e 106 {
andrewboyson 98:b977424ec7f7 107 int lastFaultPoint = FaultPoint;
andrewboyson 97:d91f7db00235 108 FaultPoint = FAULT_POINT_TcpHandleReceivedPacket;
andrewboyson 97:d91f7db00235 109
andrewboyson 90:955f4c6e18a9 110 int action = DO_NOTHING;
andrewboyson 89:9b765a67699b 111 bool traceRequested = false;
andrewboyson 86:55bc5ddac16c 112
andrewboyson 89:9b765a67699b 113 TcpHdrReadFromPacket(pPacketRx);
andrewboyson 89:9b765a67699b 114
andrewboyson 78:9d8fc88df405 115 if (remArIndex < 0)
andrewboyson 78:9d8fc88df405 116 {
andrewboyson 89:9b765a67699b 117 log(traceback, "invalid remote AR index %d -> ignored packet", remArIndex);
andrewboyson 98:b977424ec7f7 118 FaultPoint = lastFaultPoint;
andrewboyson 78:9d8fc88df405 119 return DO_NOTHING;
andrewboyson 78:9d8fc88df405 120 }
andrewboyson 98:b977424ec7f7 121 FaultPoint += 100;
andrewboyson 78:9d8fc88df405 122
andrewboyson 74:c3756bfa960e 123 int dataLength = sizeRx - TcpHdrSizeGet();
andrewboyson 74:c3756bfa960e 124 int locMss = *pSizeTx - TcpHdrSizeGet();
andrewboyson 74:c3756bfa960e 125
andrewboyson 90:955f4c6e18a9 126 //Calculate the sequence length of the received packet
andrewboyson 90:955f4c6e18a9 127 int seqLengthRcvd = 0;
andrewboyson 90:955f4c6e18a9 128 if (TcpHdrSYN) seqLengthRcvd += 1; //Add one to acknowledge the SYN
andrewboyson 90:955f4c6e18a9 129 seqLengthRcvd += dataLength; //Add the number of bytes received
andrewboyson 90:955f4c6e18a9 130 if (TcpHdrFIN) seqLengthRcvd += 1; //Add one to acknowledge the FIN
andrewboyson 90:955f4c6e18a9 131
andrewboyson 74:c3756bfa960e 132 //Filter out unwanted links
andrewboyson 98:b977424ec7f7 133 FaultPoint++;
andrewboyson 74:c3756bfa960e 134 switch (TcpHdrDstPort)
andrewboyson 74:c3756bfa960e 135 {
andrewboyson 74:c3756bfa960e 136 case 80:
andrewboyson 74:c3756bfa960e 137 if (HttpTrace)
andrewboyson 74:c3756bfa960e 138 {
andrewboyson 74:c3756bfa960e 139 if (NetTraceNewLine) Log("\r\n");
andrewboyson 74:c3756bfa960e 140 LogTime("HTTP server request\r\n");
andrewboyson 89:9b765a67699b 141 traceRequested = true;
andrewboyson 74:c3756bfa960e 142 }
andrewboyson 74:c3756bfa960e 143 break;
andrewboyson 74:c3756bfa960e 144
andrewboyson 89:9b765a67699b 145 default: //Send reset if unknown port
andrewboyson 89:9b765a67699b 146 log(traceback, "unhandled local port %hu -> sent reset", TcpHdrDstPort);
andrewboyson 90:955f4c6e18a9 147 action = sendResetFromPacket(pSizeTx, pPacketTx, ipType, remArIndex, locIpScope, seqLengthRcvd);
andrewboyson 98:b977424ec7f7 148 FaultPoint = lastFaultPoint;
andrewboyson 90:955f4c6e18a9 149 return action;
andrewboyson 74:c3756bfa960e 150 }
andrewboyson 74:c3756bfa960e 151
andrewboyson 76:17534bde28d3 152 //Get the Transmission Control Block
andrewboyson 98:b977424ec7f7 153 FaultPoint++;
andrewboyson 88:1ba13e6062a3 154 struct tcb* pTcb = TcbGetExisting(ipType, remArIndex, locIpScope, TcpHdrSrcPort, TcpHdrDstPort);
andrewboyson 76:17534bde28d3 155 if (!pTcb) pTcb = TcbGetEmpty();
andrewboyson 89:9b765a67699b 156 if (!pTcb) //send reset if no more tcbs are available
andrewboyson 76:17534bde28d3 157 {
andrewboyson 89:9b765a67699b 158 log(traceback, "no more tcbs available -> sent reset");
andrewboyson 90:955f4c6e18a9 159 action = sendResetFromPacket(pSizeTx, pPacketTx, ipType, remArIndex, locIpScope, seqLengthRcvd);
andrewboyson 98:b977424ec7f7 160 FaultPoint = lastFaultPoint;
andrewboyson 90:955f4c6e18a9 161 return action;
andrewboyson 76:17534bde28d3 162 }
andrewboyson 93:580fc113d9e9 163 pTcb->timeLastRcvd = MsTimerCount;
andrewboyson 76:17534bde28d3 164 pTcb->remArIndex = remArIndex;
andrewboyson 76:17534bde28d3 165 pTcb->ipType = ipType;
andrewboyson 81:50bfdd512f23 166 pTcb->locIpScope = locIpScope;
andrewboyson 76:17534bde28d3 167 pTcb->remPort = TcpHdrSrcPort;
andrewboyson 76:17534bde28d3 168 pTcb->locPort = TcpHdrDstPort;
andrewboyson 76:17534bde28d3 169 pTcb->window = TcpHdrWindow;
andrewboyson 75:603b10404183 170
andrewboyson 74:c3756bfa960e 171 //Handle request to reset
andrewboyson 98:b977424ec7f7 172 FaultPoint++;
andrewboyson 74:c3756bfa960e 173 if (TcpHdrRST)
andrewboyson 74:c3756bfa960e 174 {
andrewboyson 76:17534bde28d3 175 if (pTcb->state)
andrewboyson 74:c3756bfa960e 176 {
andrewboyson 89:9b765a67699b 177 log(traceback, "received reset -> reaped TCB");
andrewboyson 75:603b10404183 178 pTcb->state = TCB_EMPTY;
andrewboyson 74:c3756bfa960e 179 }
andrewboyson 98:b977424ec7f7 180 FaultPoint = lastFaultPoint;
andrewboyson 74:c3756bfa960e 181 return DO_NOTHING; //Don't reply
andrewboyson 74:c3756bfa960e 182 }
andrewboyson 74:c3756bfa960e 183
andrewboyson 74:c3756bfa960e 184 //Handle request to synchronise
andrewboyson 98:b977424ec7f7 185 FaultPoint++;
andrewboyson 74:c3756bfa960e 186 if (TcpHdrSYN)
andrewboyson 74:c3756bfa960e 187 {
andrewboyson 76:17534bde28d3 188 if (pTcb->state)
andrewboyson 75:603b10404183 189 {
andrewboyson 89:9b765a67699b 190 log(traceback, "received a SYN on an open connection -> sent reset");
andrewboyson 75:603b10404183 191 pTcb->state = TCB_EMPTY;
andrewboyson 90:955f4c6e18a9 192 action = TcpSendReset(pSizeTx, pPacketTx, pTcb);
andrewboyson 98:b977424ec7f7 193 FaultPoint = lastFaultPoint;
andrewboyson 90:955f4c6e18a9 194 return action;
andrewboyson 75:603b10404183 195 }
andrewboyson 76:17534bde28d3 196 else
andrewboyson 75:603b10404183 197 {
andrewboyson 88:1ba13e6062a3 198 handleSyn(pPacketRx, ipType, remArIndex, locMss, pTcb);
andrewboyson 75:603b10404183 199 }
andrewboyson 74:c3756bfa960e 200 }
andrewboyson 74:c3756bfa960e 201
andrewboyson 90:955f4c6e18a9 202 //Handle non SYN packet on an empty connection
andrewboyson 98:b977424ec7f7 203 FaultPoint++;
andrewboyson 76:17534bde28d3 204 if (!TcpHdrSYN && !pTcb->state)
andrewboyson 76:17534bde28d3 205 {
andrewboyson 90:955f4c6e18a9 206
andrewboyson 89:9b765a67699b 207 log(traceback, "non SYN packet received on a closed connection -> sent reset");
andrewboyson 78:9d8fc88df405 208 pTcb->state = TCB_EMPTY;
andrewboyson 90:955f4c6e18a9 209 action = sendResetFromPacket(pSizeTx, pPacketTx, ipType, remArIndex, locIpScope, seqLengthRcvd);
andrewboyson 98:b977424ec7f7 210 FaultPoint = lastFaultPoint;
andrewboyson 90:955f4c6e18a9 211 return action;
andrewboyson 76:17534bde28d3 212 }
andrewboyson 76:17534bde28d3 213
andrewboyson 79:f50e02fb5c94 214 //Check if the acks of bytes sent has progressed and reset the timer
andrewboyson 98:b977424ec7f7 215 FaultPoint++;
andrewboyson 91:879545b19260 216 uint32_t ackRcvdFromRem = TcpHdrACK ? TcpHdrAckNum - pTcb->locIsn : 0;
andrewboyson 82:20781198d26d 217 if (ackRcvdFromRem > pTcb->bytesAckdByRem)
andrewboyson 82:20781198d26d 218 {
andrewboyson 93:580fc113d9e9 219 pTcb->timeSendsBeingAcked = MsTimerCount;
andrewboyson 82:20781198d26d 220 pTcb->countSendsNotAcked = 0;
andrewboyson 82:20781198d26d 221 }
andrewboyson 79:f50e02fb5c94 222
andrewboyson 79:f50e02fb5c94 223 //Record the number of bytes acked by the remote host
andrewboyson 98:b977424ec7f7 224 FaultPoint++;
andrewboyson 79:f50e02fb5c94 225 pTcb->bytesAckdByRem = ackRcvdFromRem;
andrewboyson 79:f50e02fb5c94 226
andrewboyson 76:17534bde28d3 227 /* If the connection is in a synchronized state
andrewboyson 76:17534bde28d3 228 any unacceptable segment (out of window sequence number or
andrewboyson 76:17534bde28d3 229 unacceptible acknowledgment number) must elicit only an empty
andrewboyson 76:17534bde28d3 230 acknowledgment segment containing the current send-sequence number
andrewboyson 76:17534bde28d3 231 and an acknowledgment indicating the next sequence number expected
andrewboyson 76:17534bde28d3 232 to be received, and the connection remains in the same state.*/
andrewboyson 98:b977424ec7f7 233 FaultPoint++;
andrewboyson 74:c3756bfa960e 234 uint32_t seqRcvdFromRem = TcpHdrSeqNum - pTcb->remIsn;
andrewboyson 78:9d8fc88df405 235 if (seqRcvdFromRem != pTcb->bytesAckdToRem)
andrewboyson 78:9d8fc88df405 236 {
andrewboyson 79:f50e02fb5c94 237 //Only warn non keep-alives
andrewboyson 79:f50e02fb5c94 238 if (seqRcvdFromRem != 0 || pTcb->bytesAckdToRem != 1)
andrewboyson 79:f50e02fb5c94 239 {
andrewboyson 89:9b765a67699b 240 log(traceback, "seq rcvd is %d and last seq ackd was %d -> resent last ACK", seqRcvdFromRem, pTcb->bytesAckdToRem);
andrewboyson 79:f50e02fb5c94 241 }
andrewboyson 90:955f4c6e18a9 242 action = TcpResendLastAck(pSizeTx, pPacketTx, pTcb);
andrewboyson 98:b977424ec7f7 243 FaultPoint = lastFaultPoint;
andrewboyson 90:955f4c6e18a9 244 return action;
andrewboyson 78:9d8fc88df405 245 }
andrewboyson 90:955f4c6e18a9 246 //Ignore data before established
andrewboyson 98:b977424ec7f7 247 FaultPoint++;
andrewboyson 90:955f4c6e18a9 248 if (pTcb->state != TCB_ESTABLISHED && dataLength)
andrewboyson 90:955f4c6e18a9 249 {
andrewboyson 90:955f4c6e18a9 250 log(traceback, "data received before connection established -> sent reset");
andrewboyson 90:955f4c6e18a9 251 pTcb->state = TCB_EMPTY;
andrewboyson 90:955f4c6e18a9 252 action = TcpSendReset(pSizeTx, pPacketTx, pTcb);
andrewboyson 98:b977424ec7f7 253 FaultPoint = lastFaultPoint;
andrewboyson 90:955f4c6e18a9 254 return action;
andrewboyson 90:955f4c6e18a9 255 }
andrewboyson 90:955f4c6e18a9 256
andrewboyson 74:c3756bfa960e 257 //Handle FIN
andrewboyson 98:b977424ec7f7 258 FaultPoint++;
andrewboyson 74:c3756bfa960e 259 if (TcpHdrFIN) pTcb->rcvdFin = true; //When reply is all sent only a passive close is needed
andrewboyson 90:955f4c6e18a9 260
andrewboyson 90:955f4c6e18a9 261 //From now on there are no errors so display traceback if requested
andrewboyson 98:b977424ec7f7 262 FaultPoint++;
andrewboyson 90:955f4c6e18a9 263 if (traceRequested && NetTraceStack) traceback();
andrewboyson 74:c3756bfa960e 264
andrewboyson 75:603b10404183 265 //Record the number of bytes received from the remote host
andrewboyson 98:b977424ec7f7 266 FaultPoint++;
andrewboyson 76:17534bde28d3 267 pTcb->bytesRcvdFromRem += seqLengthRcvd;
andrewboyson 74:c3756bfa960e 268
andrewboyson 76:17534bde28d3 269 switch (pTcb->state) //This is the state of the connection BEFORE this packet arrived
andrewboyson 74:c3756bfa960e 270 {
andrewboyson 74:c3756bfa960e 271 case TCB_EMPTY:
andrewboyson 74:c3756bfa960e 272 pTcb->state = TCB_SYN_RECEIVED;
andrewboyson 74:c3756bfa960e 273 break;
andrewboyson 74:c3756bfa960e 274
andrewboyson 74:c3756bfa960e 275 case TCB_SYN_RECEIVED:
andrewboyson 74:c3756bfa960e 276 pTcb->state = TCB_ESTABLISHED;
andrewboyson 74:c3756bfa960e 277 break;
andrewboyson 74:c3756bfa960e 278
andrewboyson 74:c3756bfa960e 279 case TCB_ESTABLISHED:
andrewboyson 88:1ba13e6062a3 280 if (dataLength) handleReceivedData (pPacketRx, dataLength, seqRcvdFromRem - 1, pTcb);
andrewboyson 74:c3756bfa960e 281 if (pTcb->sentFin)
andrewboyson 74:c3756bfa960e 282 {
andrewboyson 77:6cb7d92c37f3 283 pTcb->state = pTcb->rcvdFin ? TCB_EMPTY : TCB_CLOSE_FIN_WAIT;
andrewboyson 74:c3756bfa960e 284 }
andrewboyson 74:c3756bfa960e 285 break;
andrewboyson 74:c3756bfa960e 286
andrewboyson 74:c3756bfa960e 287 case TCB_CLOSE_FIN_WAIT: //End of active close
andrewboyson 74:c3756bfa960e 288 if (TcpHdrFIN)
andrewboyson 74:c3756bfa960e 289 {
andrewboyson 74:c3756bfa960e 290 pTcb->state = TCB_EMPTY;//Ignore ACK to our FIN. Wait for FIN then close.
andrewboyson 74:c3756bfa960e 291 }
andrewboyson 74:c3756bfa960e 292 break;
andrewboyson 74:c3756bfa960e 293
andrewboyson 74:c3756bfa960e 294 }
andrewboyson 74:c3756bfa960e 295
andrewboyson 98:b977424ec7f7 296 FaultPoint++;
andrewboyson 90:955f4c6e18a9 297 action = TcpSend(pSizeTx, pPacketTx, pTcb);
andrewboyson 86:55bc5ddac16c 298
andrewboyson 98:b977424ec7f7 299 FaultPoint = lastFaultPoint;
andrewboyson 90:955f4c6e18a9 300 return action;
andrewboyson 74:c3756bfa960e 301 }