Changeset 2102
- Timestamp:
- 06/17/10 09:10:13 (20 months ago)
- Location:
- Whitix/branches/netchannel/user/sdk/network/tcp
- Files:
-
- 4 modified
-
tcp.c (modified) (6 diffs)
-
tcp.h (modified) (3 diffs)
-
tcp_input.c (modified) (3 diffs)
-
tcp_input.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/branches/netchannel/user/sdk/network/tcp/tcp.c
r2101 r2102 200 200 ulong seqEnd = seq + dataLen; 201 201 int err = TCP_ERROR; 202 int reason = TCP_DROP_NONE; 202 203 int after; 203 204 … … 209 210 err = 0; 210 211 TCP_DEBUG(("Duplicate packet, seq < REM.next")); 212 reason = TCP_DROP_DUP; 211 213 goto dropPacket; 212 214 } … … 215 217 { 216 218 TCP_DEBUG(("SEG.SEQ > REM.windowEnd")); 219 reason = TCP_DROP_SEQ; 217 220 goto dropPacket; 218 221 } … … 245 248 246 249 err = 0; 250 reason = TCP_DROP_ACK; 247 251 248 252 goto dropPacket; … … 283 287 TcpSendBit(tcpSock, TCP_FLAG_ACK); 284 288 err = 0; 289 reason = TCP_DROP_OOO; 285 290 goto dropPacket; 286 291 } … … 361 366 362 367 dropPacket: 363 TcpDropPacket(tcpSock, dataLen );368 TcpDropPacket(tcpSock, dataLen, reason); 364 369 return err; 365 370 } -
Whitix/branches/netchannel/user/sdk/network/tcp/tcp.h
r2101 r2102 10 10 11 11 #include "../stats/stats.h" 12 13 #define CHAN_TYPE_TCP 314 12 15 13 #define TCP_SYN_TIMEOUT 2 /* seconds */ … … 30 28 /* Information that we need to keep */ 31 29 ulong destAddr, destPort, srcPort; 30 int epRole; 32 31 }; 33 32 … … 111 110 112 111 struct TcpStatistics stats; 112 struct HostEntry* hostEntry; 113 113 114 114 /* Events */ -
Whitix/branches/netchannel/user/sdk/network/tcp/tcp_input.c
r2101 r2102 24 24 } 25 25 26 void TcpDropPacket(struct TcpSocket* tcp, int length )26 void TcpDropPacket(struct TcpSocket* tcp, int length, int reason) 27 27 { 28 28 tcp->stats.droppedPackets++; … … 31 31 if (tcp->socket && tcp->droppedPkts) 32 32 { 33 _SockEventFireList(tcp->socket, tcp->droppedPkts, NULL, 0); 33 struct TcpDroppedPkt droppedPkt; 34 35 droppedPkt.bytes = length; 36 droppedPkt.reason = reason; 37 _SockEventFireList(tcp->socket, tcp->droppedPkts, &droppedPkt, sizeof(struct TcpDroppedPkt)); 34 38 } 35 39 } … … 56 60 if (tcpHeader->checkSum != TcpCalcChecksum(ipHeader, tcpHeader, *length)) 57 61 { 58 TcpDropPacket(tcpSock, *length - sizeof(struct IpHeader) );62 TcpDropPacket(tcpSock, *length - sizeof(struct IpHeader), TCP_DROP_SUM); 59 63 goto error; 60 64 } -
Whitix/branches/netchannel/user/sdk/network/tcp/tcp_input.h
r2101 r2102 5 5 length); 6 6 int TcpSocketRecv(Socket* socket, void* buffer, unsigned long length, int flags); 7 void TcpDropPacket(struct TcpSocket* tcpSock, int length); 7 8 #define TCP_CHECKSUM 0x01 9 void TcpDropPacket(struct TcpSocket* tcpSock, int length, int reason); 8 10 9 11 #endif
