⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 net_tcp.h

📁 从Luminary官方网站下载的LM3S6000系列的UCos+Tcp/IP的源码, 经本人稍微修改后可直接在IAR6.2下编译通过,里面包括了LM3S6000系列的所有外设UART, PWn....
💻 H
📖 第 1 页 / 共 5 页
字号:
*                           there SHOULD be an ACK for at least every second segment".
*
*                       (B) RFC #2581, Section 4.2 reiterates that "an ACK SHOULD be generated for at 
*                           least every second full-sized segment".
*
*                   (2) However, RFC #2581, Section 4.2 states that "an implementation is deemed to
*                       comply with this requirement ... by acknowledging at least every second segment,
*                       regardless of size".
*
*               (b) (1) RFC #1122, Section 4.2.3.2 states that "an ACK should not be excessively delayed;
*                       in particular, the delay MUST be less than 0.5 seconds".
*
*                   (2) RFC #2581, Section 4.2 reiterates that "an ACK ... MUST be generated within 500 ms
*                       of the arrival of the first unacknowledged packet".
*
*               See also 'net_tcp.c  NetTCP_TxConnAck()  Note #6'.
*$PAGE*
*           (7) RFC #1122, Section 4.2.3.5 states that "excessive retransmission of the same segment by TCP
*               indicates some failure of the remote host or the Internet path".
*
*               (a) "The following procedure MUST be used to handle excessive retransmissions of data segments" :
*
*                   (a) "There are ... thresholds ... measuring the amount of retransmission that has occurred
*                        for the same segment ... measured in time units or as a count of retransmissions."
*
*                   (c) "When the number of transmissions of the same segment reaches a threshold ... close the
*                        connection."
*
*                   (d) "An application MUST be able to set the [threshold] value ... for a particular connection.
*                        For example, an interactive application might set [the threshold value] to 'infinity'."
*
*                   See also 'net_tcp.c  NetTCP_TxConnReTxQ()  Note #3'.
*
*               (b) (1) (A) "The value of ... [the threshold] SHOULD correspond to at least 100 seconds."
*
*                       (B) Therefore, the minimum threshold value is calculated as follows :
*
*                                                [                                       ]         Minimum
*                           (1)    Summation     [ Exponential * (Exponential ^ (N - 1)) ]  >=  Retransmission
*                               i = 1 --> i = N  [   Scalar          Base                ]        Threshold
*
*                                  Summation     [ 3 * (2 ^ (N - 1))]  >=  100 seconds
*                               i = 1 --> i = N
*
*                                                                   N  >=  5.06
*
*                           (2)                                     N   =  6
*
*                                   where
*                                           N                           Minimum Excessive Retransmission Threshold
*                                                                           (in number of retransmissions)
*                                           Exponential Scalar          Exponential Scalar = 3 (see 'TCP ROUND-TRIP
*                                                                           TIME (RTT) DEFINES  Note #3ab')
*                                           Exponential Base            Exponential Base   = 2 (see 'TCP ROUND-TRIP
*                                                                           TIME (RTT) DEFINES  Note #3c2')
*                                           Minimum Retransmission      Minimum Excessive Retransmission Threshold 
*                                                 Threshold                 (in seconds; see Note #7b1A)
*
*                   (2) (A) Stevens, TCP/IP Illustrated, Volume 1, 8th Printing, Section 21.2, Page 299 
*                           states that "on most implementations this total timeout value is not tunable
*                           ... and its default is ... the more common 9 minutes".
*
*                       (B) Therefore, the default threshold value is calculated as follows :
*
*                           (1)   [                                                                      ]
*                                 [ Exponential * (Exponential ^ (M - 1))  ,  when < Maximum Exponential ]
*                                 [   Scalar          Base                              Timeout Value    ]          Common
*                   Summation     [                                                                      ]  >=  Retransmission
*                i = 1 --> i = M  [ Maximum Exponential                                                  ]        Threshold
*                                 [    Timeout Value                       ,  otherwise                  ]
*                                 [                                                                      ]
*
*                                 [                                          ]
*                                 [  3 * (2 ^ (M - 1))  ,  when < 64 seconds ]
*                   Summation     [                                          ]  >=  9 minutes
*                i = 1 --> i = M  [ 64 seconds          ,  otherwise         ]
*                                 [                                          ]
*
*                                                                            M  >=  11.98
*
*                           (2)                                              M   =  12
*
*                                   where
*                                           M                           Default Excessive Retransmission Threshold
*                                                                           (in number of retransmissions)
*                                           Exponential Scalar          Exponential Scalar = 3 (see 'TCP ROUND-TRIP
*                                                                           TIME (RTT) DEFINES  Note #3ab')
*                                           Exponential Base            Exponential Base   = 2 (see 'TCP ROUND-TRIP
*                                                                           TIME (RTT) DEFINES  Note #3c2')
*                                           Maximum Exponential         Maximum Exponential Timeout Value (see 'TCP
*                                              Timeout Value                ROUND-TRIP TIME (RTT) DEFINES  Note #3c3')
*                                           Common Retransmission       Common Default Retransmission Threshold 
*                                                Threshold                  (in minutes; see Note #7b2A)
*********************************************************************************************************
*/
/*$PAGE*/
                                                                                /* See Note #2b3.                       */
#define  NET_TCP_SST_UNACKD_DATA_NUMER                     1
#define  NET_TCP_SST_UNACKD_DATA_DENOM                     2

#define  NET_TCP_SST_MSS_SCALAR                            2



#define  NET_TCP_CONG_WIN_MSS_SCALAR_INIT                  2                    /* See Note  #3a.                       */
#define  NET_TCP_CONG_WIN_MSS_SCALAR_INC                   1                    /* See Notes #3b & #4c.                 */
#define  NET_TCP_CONG_WIN_MSS_SCALAR_TIMEOUT               1                    /* See Note  #3c.                       */



#define  NET_TCP_FAST_RE_TX_ACK_DUP_TH                     3                    /* See Note #4a.                        */
                                                                                /* See Note #4b2.                       */
#define  NET_TCP_FAST_RECOVERY_MSS_SCALAR                NET_TCP_FAST_RE_TX_ACK_DUP_TH  


                                                                                /* See Note #5a1D.                      */
#define  NET_TCP_RX_SILLY_WIN_NUMER                        1
#define  NET_TCP_RX_SILLY_WIN_DENOM                        2

                                                                                /* See Note #5b3.                       */
#define  NET_TCP_TX_SILLY_WIN_NUMER                        1
#define  NET_TCP_TX_SILLY_WIN_DENOM                        2
                                                                                /* See Note #5b4.                       */
#define  NET_TCP_TX_SILLY_WIN_TIMEOUT_MIN_MS             100
#define  NET_TCP_TX_SILLY_WIN_TIMEOUT_MAX_MS            1000
#define  NET_TCP_TX_SILLY_WIN_TIMEOUT_DFLT_MS            NET_TCP_TX_SILLY_WIN_TIMEOUT_MAX_MS



#define  NET_TCP_ACK_DLY_CNT_TH                            2                    /* See Note #6a.                        */

#define  NET_TCP_ACK_DLY_TIME_MIN_MS                       0            
#define  NET_TCP_ACK_DLY_TIME_MAX_MS                     500                    /* See Note #6b.                        */


#define  NET_TCP_RE_TX_TH_MIN                              6                    /* See Note #7b1B2.                     */
#define  NET_TCP_RE_TX_TH_MAX                            DEF_INT_16U_MAX_VAL    /* See Note #7ad.                       */
#define  NET_TCP_RE_TX_TH_DFLT                            12                    /* See Note #7b2B2.                     */


/*$PAGE*/
/*
*********************************************************************************************************
*                    TCP ROUND-TRIP TIME (RTT) / RE-TRANSMIT TIMEOUT (RTO) DEFINES
*
* Note(s) : (1) See the following RFC's for TCP Round-Trip Times (RTT) & Re-transmit Timeout (RTO) summary :
*
*               (a) RFC #2988                               TCP Round-Trip Time Calculations (RTT) /
*               (b) RFC #1122                               TCP Retransmission Timeout       (RTO)
*                   (1) Section 4.2.2.15
*                   (2) Section 4.2.3.1
*               (c) RFC # 793, Section 3.7 'Retransmission Timeout'
*               (d) Jacobson/Karels, "Congestion Avoidance and Control"
*               (e) Karn/Partridge,  "Improving Round-Trip Time Estimates in Reliable Transport Protocols"
*
*
*           (2) (a) RFC #793, Section 3.7 'Data Communication : Retransmission Timeout' states that 
*                   "because of the variability of the networks that compose an internetwork system 
*                   and the wide range of uses of TCP connections the retransmission timeout must be 
*                   dynamically determined.  One procedure for determining a retransmission time out 
*                   is given here as an illustration".
*
*               (b) However, RFC #1122, Section 4.2.2.15 states that "the algorithm suggested in 
*                   RFC-793 for calculating the retransmission timeout is now known to be inadequate"
*                   & Section 4.2.3.1 states that "a host TCP MUST implement Karn's algorithm and
*                   Jacobson's algorithm for computing the retransmission timeout".
*
*               (c) Further, RFC #2988, Section 1 states that "this document codifies the algorithm 
*                   for setting the RTO ... expands on the discussion in section 4.2.3.1 of RFC 1122
*                    ... [but] does not alter the ... retransmission ... behavior outlined in RFC 2581".
*
*           (3) (a) (1) (A) (1) RFC #1122, Section 4.2.3.1 states that "the following values SHOULD be
*                               used to initialize the estimation parameters for a new connection" :
*
*                                   (a) RTT = 0 seconds
*                                   (b) RTO = 3 seconds
*
*                                           where
*                                                   RTO                 Retransmission Timeout
*                                                   RTT                 Round-Trip Time
*
*                               (A) RFC #2988, Section 2.1 reiterates that "until a round-trip time (RTT) 
*                                   measurement has been made ... the sender SHOULD set RTO <- 3 seconds".
*
*                               (B) Furthermore, RFC #1122, Section 4.2.3.1.(b) states that "the smoothed 
*                                   variance is to be initialized to the value that will result in" these
*                                   values.
*
*                                   Since computing the RTT retransmit timer      is given by the following 
*                                   equation (see RFC #2988, Section 2.3) :
*
*                                       (1) RTO     =  RTT_Avg + (RTT_RTO_Gain * RTT_Dev)
*
*                                   then the RTT deviation, or smoothed variance, is given by the following
*                                   equation :
*
*                                       (2) RTT_Dev = (RTO - RTT_Avg) / RTT_RTO_Gain
*
*                                               where
*                                                       RTT_Avg                 RTT Average
*                                                       RTT_Dev                 RTT Deviation
*                                                       RTT_RTO_Gain            RTT-RTO Gain
*
*
*                           (2) However, since RFC #2988, Section 2.2 amends the RFC #1122, Section 
*                               4.2.3.1 RTT initialization; the smoothed RTT average & deviation do
*                               NOT truly require explicit initialization.  Nonetheless, these RTT
*                               values are initialized to conform with RFC #1122, Section 4.2.3.1.
*
*                           See also 'net_tcp.c  NetTCP_TxConnRTT_Init()  Note #1'
*                                  & 'net_tcp.c  NetTCP_TxConnRTO_Init()  Note #2'.
*$PAGE*
*                       (B) RFC #2988, Section 2 states that "the rules governing the computation of SRTT
*                           (smoothed round-trip time), RTTVAR RTTVAR (round-trip time variation), and RTO
*                           are as follows" :
*
*                           (a) RFC #2988, Section 2.2 states that for "the first RTT measurement R ...
*                             

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -