networkprotocols/tcpipv4v6prt/inc/tcp.h
branchRCL_3
changeset 58 8d540f55e491
parent 57 abbed5a4b42a
child 75 c1029e558ef5
equal deleted inserted replaced
57:abbed5a4b42a 58:8d540f55e491
    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
   512 	TUint32			iFRTOsent;  //< True, if rto was sent and no acks have yet arrived
   515 	TUint32			iFRTOsent;  //< True, if rto was sent and no acks have yet arrived
   513 	TTcpSeqNum		iRealSendHigh;  //< iSendHigh is not real with SACK
   516 	TTcpSeqNum		iRealSendHigh;  //< iSendHigh is not real with SACK
   514 
   517 
   515 	// -1=linger disabled, >=0 linger enabled with given time in seconds.
   518 	// -1=linger disabled, >=0 linger enabled with given time in seconds.
   516 	TInt			iLinger;
   519 	TInt			iLinger;
       
   520 	
       
   521 	//Introduce specifically for Browser usecase where in Normal shutdown is expected to close with in certain time.
       
   522     //current structure is using secs. This Bit will enable calculation in Mircosecs.
       
   523     TBool           iMicroSecCalcFlag;
   517 
   524 
   518 	// Window scaling factor for the send window, advertised by the other end.
   525 	// Window scaling factor for the send window, advertised by the other end.
   519 	TUint8			iSndWscale:4;
   526 	TUint8			iSndWscale:4;
   520 
   527 
   521 	// Window scaling factor for receive window, based on ini settings.
   528 	// Window scaling factor for receive window, based on ini settings.
   780 	iDelayAckTimer->Cancel();
   787 	iDelayAckTimer->Cancel();
   781 	}
   788 	}
   782 
   789 
   783 inline TUint32 CProviderTCP6::TimeStamp()
   790 inline TUint32 CProviderTCP6::TimeStamp()
   784 	{
   791 	{
   785 	TTime now;
   792     TInt tickPeriod;
       
   793     TUint64 ticsInMs;
       
   794     // 
       
   795     HAL::Get( HAL::ENanoTickPeriod, tickPeriod );
       
   796     ticsInMs = (static_cast<TUint64> ( User::NTickCount() ) * tickPeriod)
       
   797         / KOneMsInUs;
       
   798     return static_cast<TUint32> ( ticsInMs );
       
   799     /*
       
   800     // This used to return micro seconds, but since the resolution of NTick
       
   801     // is something around  ~1ms, we return now the timestamp in milliseconds
       
   802     // (which is more than sufficient resolution for this). This is done to
       
   803     // mittigate the risk of counter overflow. 
       
   804 	// The existing implementation is commented and not removed for future reference
       
   805 	// if required.
       
   806     TTime now;
   786 	now.UniversalTime();
   807 	now.UniversalTime();
   787 #ifdef I64LOW
   808 #ifdef I64LOW
   788 	return I64LOW(now.Int64());
   809 	return I64LOW(now.Int64());
   789 #else
   810 #else
   790 	return (TUint32)now.Int64().GetTInt();
   811 	return (TUint32)now.Int64().GetTInt();
   791 #endif
   812 #endif
       
   813 */
   792 	}
   814 	}
   793 
   815 
   794 /**
   816 /**
   795  * Return maximum segment size allowed by transmission path. Following tradition,
   817  * 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
   818  * the value represents the maximum number of data bytes that can be passed in