networkprotocols/tcpipv4v6prt/inc/tcp.h
changeset 66 34ec136802c5
parent 51 78fceed50f62
equal deleted inserted replaced
60:d69860d28da4 66:34ec136802c5
    30 #include <tcp_hdr.h>
    30 #include <tcp_hdr.h>
    31 #include <in_chk.h>
    31 #include <in_chk.h>
    32 #include "frag.h"
    32 #include "frag.h"
    33 #include "inet6log.h"
    33 #include "inet6log.h"
    34 #include <in6_opt.h>
    34 #include <in6_opt.h>
       
    35 #include <hal.h>
    35 
    36 
    36 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
    37 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
    37 #include <in_sock.h>
    38 #include <in_sock.h>
    38 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
    39 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
    39 
    40 
    47 #endif
    48 #endif
    48 
    49 
    49 //
    50 //
    50 // Constants affecting protocol performance
    51 // Constants affecting protocol performance
    51 //
    52 //
    52 const TUint KOneSecondUs      = 1000000;    //< Help for converting longer times to microseconds
    53 const TUint KOneSecondInUs      = 1000000;   //< For sec <-> usec conversions
       
    54 const TUint KOneSecondInMs      = 1000;      //< For sec <-> msec conversions
       
    55 const TUint KOneMsInUs          = 1000;      //< For msec <-> usec conversions
    53 
    56 
    54 const TUint KTcpMaximumWindow = 0x3fffffff;  //< Maximum receive window size
    57 const TUint KTcpMaximumWindow = 0x3fffffff;  //< Maximum receive window size
    55 const TUint KTcpMinimumWindow =      1024;  //< Minimum receive window size
    58 const TUint KTcpMinimumWindow =      1024;  //< Minimum receive window size
    56 const TUint KTcpDefaultRcvWnd = 48 * 1024;  //< Default receive window size
    59 const TUint KTcpDefaultRcvWnd = 48 * 1024;  //< Default receive window size
    57 const TUint KTcpDefaultSndWnd = 16 * 1024;  //< Default send window size
    60 const TUint KTcpDefaultSndWnd = 16 * 1024;  //< Default send window size
    58 
    61 
    59 const TUint KTcpDefaultMSS    =     65535;  //< By default, MSS is not limited by user
    62 const TUint KTcpDefaultMSS    =     65535;  //< By default, MSS is not limited by user
    60 const TUint KTcpStandardMSS   =       536;  //< Internet standard MSS
    63 const TUint KTcpStandardMSS   =       536;  //< Internet standard MSS
    61 const TUint KTcpMinimumMSS    =        64;  //< Minimum acceptable MSS.
    64 const TUint KTcpMinimumMSS    =        64;  //< Minimum acceptable MSS.
    62 const TUint KTcpMaxTransmit   =         2;  //< Transmit at most this many segments at one time.
    65 const TUint KTcpMaxTransmit   =         1;  //< Transmit at most this many segments at one time.
    63 
    66 
    64 const TUint KTcpMinRTO        =   1000000;  //< us (1s)
    67 const TUint KTcpMinRTO        =   1000000;  //< us (1s)
    65 const TUint KTcpMaxRTO        =  60000000;  //< us (60s)
    68 const TUint KTcpMaxRTO        =  60000000;  //< us (60s)
    66 const TUint KTcpInitialRTO    =   3000000;  //< us (3s)
    69 const TUint KTcpInitialRTO    =   3000000;  //< us (3s)
    67 const TUint KTcpSrttSmooth    =         8;  //< alpha = 1/8
    70 const TUint KTcpSrttSmooth    =         8;  //< alpha = 1/8
   780 	iDelayAckTimer->Cancel();
   783 	iDelayAckTimer->Cancel();
   781 	}
   784 	}
   782 
   785 
   783 inline TUint32 CProviderTCP6::TimeStamp()
   786 inline TUint32 CProviderTCP6::TimeStamp()
   784 	{
   787 	{
   785 	TTime now;
   788 	TInt tickPeriod;
       
   789     TUint64 ticsInMs;
       
   790     // 
       
   791     HAL::Get( HAL::ENanoTickPeriod, tickPeriod );
       
   792     ticsInMs = (static_cast<TUint64> ( User::NTickCount() ) * tickPeriod)
       
   793         / KOneMsInUs;
       
   794     return static_cast<TUint32> ( ticsInMs );
       
   795     /*
       
   796     // This used to return micro seconds, but since the resolution of NTick
       
   797     // is something around  ~1ms, we return now the timestamp in milliseconds
       
   798     // (which is more than sufficient resolution for this). This is done to
       
   799     // mittigate the risk of counter overflow. 
       
   800 	// The existing implementation is commented and not removed for future reference
       
   801 	// if required.
       
   802     TTime now;
   786 	now.UniversalTime();
   803 	now.UniversalTime();
   787 #ifdef I64LOW
   804 #ifdef I64LOW
   788 	return I64LOW(now.Int64());
   805 	return I64LOW(now.Int64());
   789 #else
   806 #else
   790 	return (TUint32)now.Int64().GetTInt();
   807 	return (TUint32)now.Int64().GetTInt();
   791 #endif
   808 #endif
       
   809 */
   792 	}
   810 	}
   793 
   811 
   794 /**
   812 /**
   795  * Return maximum segment size allowed by transmission path. Following tradition,
   813  * Return maximum segment size allowed by transmission path. Following tradition,
   796  * the value represents the maximum number of data bytes that can be passed in
   814  * the value represents the maximum number of data bytes that can be passed in