Show
Ignore:
Timestamp:
06/16/10 15:11:16 (2 years ago)
Author:
mwhitworth
Message:

Add to TCP.

Files:
1 modified

Legend:

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

    r2099 r2101  
    88#include <net/ipv4.h> 
    99#include <net/tcp.h> 
     10 
     11#include "../stats/stats.h" 
    1012 
    1113#define CHAN_TYPE_TCP           3 
     
    2022        ulong droppedPackets, droppedBytes; 
    2123        ulong retxBytesSent, retxPacketsSent; 
    22         ulong wrongSumPackets, wrongSumBytes; 
     24        ulong minWin, maxWin; 
    2325 
    2426        /* (Mainly) protocol */ 
     
    6567        struct UserTimer retxTimer; 
    6668        int retxTimerHnd; 
    67         int rto; 
     69        int rto, rtt, mdev; 
    6870 
    6971        /* Sequence numbers. */ 
     
    111113 
    112114        /* Events */ 
    113         struct AsyncCtx* remWinChanged;  
     115        struct AsyncCtx *remWinChanged, *retxTimerOut, *localWinChanged, *droppedPkts;  
    114116}; 
     117 
     118extern int _netDebug; 
     119 
     120#ifndef DEBUG_TCP 
     121#define DEBUG_TCP 0x1 
     122#endif 
    115123 
    116124//#define TCP_DEBUG_Y 
    117125 
    118126#ifdef TCP_DEBUG_Y 
    119 #define TCP_DEBUG(args) do { printf("[TCP]: %d: %s: ", SysGetCurrentThreadId(), __func__); printf args; printf(" (%s:%d)\n", __FILE__, __LINE__); } while (0) 
     127#define TCP_DEBUG(args) do { if (_netDebug & DEBUG_TCP) { printf("[TCP]: %d: %s: ", SysGetCurrentThreadId(), __func__); printf args; printf(" (%s:%d)\n", __FILE__, __LINE__); } } while (0) 
    120128#else 
    121129#define TCP_DEBUG(args) 
     
    132140{ 
    133141        return ((struct Ipv4EndPoint*)(&socket->channel->src))->port; 
     142} 
     143 
     144static inline ulong TcpDestAddress(struct TcpSocket* socket) 
     145{ 
     146        return ((struct Ipv4EndPoint*)(&socket->channel->dest))->address; 
    134147} 
    135148 
     
    156169#define TCP_AGAIN       -2 
    157170 
     171/* Buffer flags */ 
     172#define TCP_FLAG_RETX   0x01 
     173 
    158174#endif