Changeset 2102

Show
Ignore:
Timestamp:
06/17/10 09:10:13 (20 months ago)
Author:
mwhitworth
Message:

Add to TCP, soon we'll add to host and port entries when connection is closed.

Location:
Whitix/branches/netchannel/user/sdk/network/tcp
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/netchannel/user/sdk/network/tcp/tcp.c

    r2101 r2102  
    200200        ulong seqEnd = seq + dataLen; 
    201201        int err = TCP_ERROR; 
     202    int reason = TCP_DROP_NONE; 
    202203        int after; 
    203204 
     
    209210                err = 0; 
    210211                TCP_DEBUG(("Duplicate packet, seq < REM.next")); 
     212        reason = TCP_DROP_DUP; 
    211213                goto dropPacket; 
    212214        } 
     
    215217        { 
    216218                TCP_DEBUG(("SEG.SEQ > REM.windowEnd")); 
     219        reason = TCP_DROP_SEQ; 
    217220                goto dropPacket; 
    218221        } 
     
    245248 
    246249                err = 0; 
     250        reason = TCP_DROP_ACK; 
    247251 
    248252                goto dropPacket; 
     
    283287                TcpSendBit(tcpSock, TCP_FLAG_ACK); 
    284288                err = 0; 
     289        reason = TCP_DROP_OOO; 
    285290                goto dropPacket; 
    286291        } 
     
    361366 
    362367dropPacket: 
    363         TcpDropPacket(tcpSock, dataLen); 
     368        TcpDropPacket(tcpSock, dataLen, reason); 
    364369        return err; 
    365370} 
  • Whitix/branches/netchannel/user/sdk/network/tcp/tcp.h

    r2101 r2102  
    1010 
    1111#include "../stats/stats.h" 
    12  
    13 #define CHAN_TYPE_TCP           3 
    1412 
    1513#define TCP_SYN_TIMEOUT                         2 /* seconds */ 
     
    3028        /* Information that we need to keep */ 
    3129        ulong destAddr, destPort, srcPort; 
     30    int epRole; 
    3231}; 
    3332 
     
    111110 
    112111        struct TcpStatistics stats; 
     112    struct HostEntry* hostEntry; 
    113113 
    114114        /* Events */ 
  • Whitix/branches/netchannel/user/sdk/network/tcp/tcp_input.c

    r2101 r2102  
    2424} 
    2525 
    26 void TcpDropPacket(struct TcpSocket* tcp, int length) 
     26void TcpDropPacket(struct TcpSocket* tcp, int length, int reason) 
    2727{ 
    2828        tcp->stats.droppedPackets++; 
     
    3131        if (tcp->socket && tcp->droppedPkts) 
    3232        { 
    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)); 
    3438        } 
    3539} 
     
    5660        if (tcpHeader->checkSum != TcpCalcChecksum(ipHeader, tcpHeader, *length)) 
    5761        { 
    58                 TcpDropPacket(tcpSock, *length - sizeof(struct IpHeader)); 
     62                TcpDropPacket(tcpSock, *length - sizeof(struct IpHeader), TCP_DROP_SUM); 
    5963                goto error; 
    6064        } 
  • Whitix/branches/netchannel/user/sdk/network/tcp/tcp_input.h

    r2101 r2102  
    55                length); 
    66int TcpSocketRecv(Socket* socket, void* buffer, unsigned long length, int flags); 
    7 void TcpDropPacket(struct TcpSocket* tcpSock, int length); 
     7 
     8#define TCP_CHECKSUM    0x01 
     9void TcpDropPacket(struct TcpSocket* tcpSock, int length, int reason); 
    810 
    911#endif