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 |
234 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW |
237 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW |
235 //Function to set and get receive window |
238 //Function to set and get receive window |
236 void SetRecvWin(TUint aRecvWin) { iRecvBuf = aRecvWin;} |
239 void SetRecvWin(TUint aRecvWin) { iRecvBuf = aRecvWin;} |
237 TUint GetRecvWinSize() { return iRecvBuf; } |
240 TUint GetRecvWinSize() { return iRecvBuf; } |
238 TUint RecvMaxWnd() { return iTcpMaxRecvWin;} |
241 TUint RecvMaxWnd() { return iTcpMaxRecvWin;} |
|
242 TUint RecvBufFromIniFile() { return iRecvBufFromIniFile; } |
239 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW |
243 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW |
240 |
244 |
241 #ifdef _LOG |
245 #ifdef _LOG |
242 static void LogPacket(char aDir, RMBufChain& aPacket, RMBufPktInfo *info = 0, TInt aOffset = 0); |
246 static void LogPacket(char aDir, RMBufChain& aPacket, RMBufPktInfo *info = 0, TInt aOffset = 0); |
243 #endif |
247 #endif |
293 |
297 |
294 TUint32 iRandomIncrement; |
298 TUint32 iRandomIncrement; |
295 RMBufAllocator iBufAllocator; |
299 RMBufAllocator iBufAllocator; |
296 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW |
300 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW |
297 TUint iTcpMaxRecvWin; |
301 TUint iTcpMaxRecvWin; |
|
302 TUint iRecvBufFromIniFile; |
298 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW |
303 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW |
299 }; |
304 }; |
300 |
305 |
301 |
306 |
302 /** |
307 /** |
440 TUint32 iHiddenFreeWindow; |
445 TUint32 iHiddenFreeWindow; |
441 // Size of Window Shrink |
446 // Size of Window Shrink |
442 TUint32 iShrinkedWindowSize; |
447 TUint32 iShrinkedWindowSize; |
443 // Window size set by user. This will override the default values for the bearers |
448 // Window size set by user. This will override the default values for the bearers |
444 TBool iWindowSetByUser; |
449 TBool iWindowSetByUser; |
|
450 //Flag for socket startup case. No tcp window expand/shrink in this case. |
|
451 TBool iSocketStartupCase; |
445 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW |
452 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW |
446 |
453 |
447 // Maximum Segment Sizes |
454 // Maximum Segment Sizes |
448 TUint iMSS; //< Maximum set by user |
455 TUint iMSS; //< Maximum set by user |
449 TUint iSMSS; //< Send MSS |
456 TUint iSMSS; //< Send MSS |
776 iDelayAckTimer->Cancel(); |
783 iDelayAckTimer->Cancel(); |
777 } |
784 } |
778 |
785 |
779 inline TUint32 CProviderTCP6::TimeStamp() |
786 inline TUint32 CProviderTCP6::TimeStamp() |
780 { |
787 { |
781 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; |
782 now.UniversalTime(); |
803 now.UniversalTime(); |
783 #ifdef I64LOW |
804 #ifdef I64LOW |
784 return I64LOW(now.Int64()); |
805 return I64LOW(now.Int64()); |
785 #else |
806 #else |
786 return (TUint32)now.Int64().GetTInt(); |
807 return (TUint32)now.Int64().GetTInt(); |
787 #endif |
808 #endif |
|
809 */ |
788 } |
810 } |
789 |
811 |
790 /** |
812 /** |
791 * Return maximum segment size allowed by transmission path. Following tradition, |
813 * Return maximum segment size allowed by transmission path. Following tradition, |
792 * 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 |