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

📄 net_tcp.h

📁 从Luminary官方网站下载的LM3S6000系列的UCos+Tcp/IP的源码, 经本人稍微修改后可直接在IAR6.2下编译通过,里面包括了LM3S6000系列的所有外设UART, PWn....
💻 H
📖 第 1 页 / 共 5 页
字号:

#elif   (CPU_CFG_DATA_SIZE   == CPU_WORD_SIZE_16)
#define  NET_TCP_TYPE_NONE                        0x4F4E454E    /* "NONE" in ASCII.                                     */
#define  NET_TCP_TYPE_CONN                        0x43542050    /* "TCP " in ASCII.                                     */

#else                                                           /* Dflt CPU_WORD_SIZE_08.                               */
#define  NET_TCP_TYPE_NONE                        0x4E4F4E45    /* "NONE" in ASCII.                                     */
#define  NET_TCP_TYPE_CONN                        0x54435020    /* "TCP " in ASCII.                                     */

#endif
#endif


/*
*********************************************************************************************************
*                                     TCP SEQUENCE NUMBER DEFINES
*
* Note(s) : (1) TCP initial transmit sequence number is incremented by a fixed value, preferably a large
*               prime value or a large value with multiple unique prime factors.
*
*               (a) One reasonable TCP initial transmit sequence number increment value example :
*
*                       65527  =  37 * 23 * 11 * 7
*
*
*               #### NET_TCP_TX_SEQ_NBR_CTR_INC could be developer-configured in 'net_cfg.h'.
*
*               See also 'NET_TCP_TX_GET_SEQ_NBR()  Notes #1b2 & #1c2'.
*********************************************************************************************************
*/

#define  NET_TCP_SEQ_NBR_NONE                              0
#define  NET_TCP_ACK_NBR_NONE                            NET_TCP_SEQ_NBR_NONE

#define  NET_TCP_TX_SEQ_NBR_CTR_INC                    65527uL  /* See Note #1.                                         */


#define  NET_TCP_ACK_NBR_DUP_WIN_SIZE_SCALE                4


/*$PAGE*/
/*
*********************************************************************************************************
*                   TCP DATA/TOTAL LENGTH & MAXIMUM TRANSMISSION UNIT (MTU) DEFINES
*
* Note(s) : (1) (a) TCP total length #define's (NET_TCP_TOT_LEN)  relate to the total size of a complete
*                   TCP packet, including the packet's TCP header.  Note that a complete TCP packet MAY
*                   be fragmented in multiple Internet Protocol packets.
*
*               (b) TCP data  length #define's (NET_TCP_DATA_LEN) relate to the data  size of a complete
*                   TCP packet, equal to the total TCP packet length minus its TCP header size.  Note 
*                   that a complete TCP packet MAY be fragmented in multiple Internet Protocol packets.
*
*               (c) TCP MTU #define's (NET_TCP_MTU) relate to the data size for any single, non-fragmented
*                   TCP packet, equal to a packet's Internet Protocol MTU minus its TCP header size.
*
*           (2) The 'NET_TCP_MTU_NET_RSRC' pre-processor 'else'-conditional code will never be compiled/
*               linked since 'net_buf.h' ensures that at least one of the two configuration constants 
*               (NET_BUF_CFG_NBR_SMALL or NET_BUF_CFG_NBR_LARGE) will be configured with a value greater
*               than zero (see 'net_buf.h  CONFIGURATION ERRORS').  The 'else'-conditional code is
*               included for completeness & as an extra precaution in case 'net_buf.h' is incorrectly
*               modified.
*********************************************************************************************************
*/

                                                                                /* See Notes #1a & #1b.                 */
#define  NET_TCP_DATA_LEN_MIN                              0

#define  NET_TCP_TOT_LEN_MIN                            (NET_TCP_HDR_SIZE_MIN + NET_TCP_DATA_LEN_MIN)
#define  NET_TCP_TOT_LEN_MAX                            (NET_IP_TOT_LEN_MAX   - NET_IP_HDR_SIZE_MIN )

#define  NET_TCP_DATA_LEN_MAX                           (NET_TCP_TOT_LEN_MAX  - NET_TCP_HDR_SIZE_MIN)


                                                                                /* See Note #1c.                        */
#define  NET_TCP_MTU_MIN                                (NET_IP_MTU_MIN       - NET_TCP_HDR_SIZE_MAX)
#define  NET_TCP_MTU_MAX                                (NET_IP_MTU_MAX       - NET_TCP_HDR_SIZE_MIN)
#define  NET_TCP_MTU                                     NET_TCP_MTU_MIN


#define  NET_TCP_MTU_NET_RSRC                            NET_TCP_MTU_MAX

#if     (NET_BUF_CFG_NBR_LARGE > 0)
#if    ((NET_BUF_CFG_DATA_SIZE_LARGE - NET_BUF_DATA_SIZE_MIN) < NET_TCP_MTU_NET_RSRC)
#undef   NET_TCP_MTU_NET_RSRC
#define  NET_TCP_MTU_NET_RSRC                           (NET_BUF_CFG_DATA_SIZE_LARGE - NET_BUF_DATA_SIZE_MIN)
#endif

#elif   (NET_BUF_CFG_NBR_SMALL > 0)
#if    ((NET_BUF_CFG_DATA_SIZE_SMALL - NET_BUF_DATA_SIZE_MIN) < NET_TCP_MTU_NET_RSRC)
#undef   NET_TCP_MTU_NET_RSRC
#define  NET_TCP_MTU_NET_RSRC                           (NET_BUF_CFG_DATA_SIZE_SMALL - NET_BUF_DATA_SIZE_MIN)
#endif

#else                                                                           /* See Note #2.                         */
#error  "NET_BUF_CFG_NBR_SMALL  illegally #defined in 'net_buf.h'      "
#error  "NET_BUF_CFG_NBR_LARGE  illegally #defined in 'net_buf.h'      "
#error  "                       [See 'net_buf.h  CONFIGURATION ERRORS']"
#endif


#define  NET_TCP_MTU_ACTUAL                     (DEF_MIN(NET_TCP_MTU, NET_TCP_MTU_NET_RSRC))


/*$PAGE*/
/*
*********************************************************************************************************
*                                      TCP SEGMENT SIZE DEFINES
*
* Note(s) : (1) (a) RFC # 879, Section 3 states that the TCP Maximum Segment Size "counts only
*                   data octets in the segment, ... not the TCP header or the IP header".
*
*               (b) RFC #1122, Section 4.2.2.6 requires that ... :
*
*                   (1) "The MSS value to be sent in an MSS option must be less than or equal to
*
*                        (A) MMS_R - 20
*
*                        where MMS_R is the maximum size for a transport-layer message that can
*                        be received."
*
*                   (2) "If an MSS option is not received at connection setup, TCP MUST assume a
*                        default send MSS of 536 (576 - 40)."
*
*                   See also 'net_ip.h  IP DATA/TOTAL LENGTH & MAXIMUM TRANSMISSION UNIT (MTU) DEFINES
*                       Note #1'.
*********************************************************************************************************
*/

                                                                                        /* See Note #1.                 */
#define  NET_TCP_MAX_SEG_SIZE_DFLT_BASE                  NET_IP_MAX_DATAGRAM_SIZE_DFLT
#define  NET_TCP_MAX_SEG_SIZE_DFLT                      (NET_TCP_MAX_SEG_SIZE_DFLT_BASE - NET_IP_HDR_SIZE_MIN - NET_TCP_HDR_SIZE_MIN)

#define  NET_TCP_MAX_SEG_SIZE_DFLT_RX                    NET_TCP_MTU_NET_RSRC           /* See Note #1b1.               */
#define  NET_TCP_MAX_SEG_SIZE_DFLT_TX                    NET_TCP_MAX_SEG_SIZE_DFLT      /* See Note #1b2.               */


#define  NET_TCP_MAX_SEG_SIZE_NONE                         0
#define  NET_TCP_MAX_SEG_SIZE_MIN                        NET_TCP_MAX_SEG_SIZE_DFLT
#define  NET_TCP_MAX_SEG_SIZE_MAX                        NET_TCP_DATA_LEN_MAX


#define  NET_TCP_SEG_LEN_MIN                             NET_TCP_DATA_LEN_MIN
#define  NET_TCP_SEG_LEN_MAX                             NET_TCP_DATA_LEN_MAX

#define  NET_TCP_SEG_LEN_SYNC                              1
#define  NET_TCP_SEG_LEN_FIN                               1
#define  NET_TCP_SEG_LEN_CLOSE                           NET_TCP_SEG_LEN_FIN
#define  NET_TCP_SEG_LEN_ACK                               0
#define  NET_TCP_SEG_LEN_RESET                             0
#define  NET_TCP_SEG_LEN_PROBE                             0


#define  NET_TCP_DATA_LEN_TX_SYNC                          0
#define  NET_TCP_DATA_LEN_TX_FIN                           0
#define  NET_TCP_DATA_LEN_TX_CLOSE                       NET_TCP_DATA_LEN_TX_FIN
#define  NET_TCP_DATA_LEN_TX_ACK                           0
#define  NET_TCP_DATA_LEN_TX_PROBE_NO_DATA                 0
#define  NET_TCP_DATA_LEN_TX_PROBE_DATA                    1
#define  NET_TCP_DATA_LEN_TX_RESET                         0

#define  NET_TCP_TX_PROBE_DATA                          0x00


/*
*********************************************************************************************************
*                                       TCP WINDOW SIZE DEFINES
*
* Note(s) : (1) Although NO RFC specifies the absolute minimum TCP connection window size value allowed,
*               RFC #793, Section 3.7 'Data Communication : Managing the Window' states that for "the
*               window ... there is an assumption that this is related to the currently available data
*               buffer space available for this connection".
*********************************************************************************************************
*/

#define  NET_TCP_WIN_SIZE_NONE                             0

#define  NET_TCP_WIN_SIZE_MIN                            NET_TCP_MTU_NET_RSRC           /* See Note #1.                 */
#define  NET_TCP_WIN_SIZE_MAX                            DEF_INT_16U_MAX_VAL


/*$PAGE*/
/*
*********************************************************************************************************
*                                     TCP HEADER OPTIONS DEFINES
*
* Note(s) : (1) See the following RFC's for TCP options summary :
*
*               (a) RFC # 793, Section  3.1 'Header Format : Options'
*               (b) RFC #1122; Sections 4.2.2.5, 4.2.2.6
*
*           (2) TCP option types are coded in the first octet for each TCP option as follows :
*
*                           --------
*                           | TYPE |
*                           --------
*
*               The TCP option type value determines the TCP option format :
*
*               (a) The following TCP option types are single-octet TCP options -- i.e. the option type
*                   octet is the ONLY octet for the TCP option.
*
*                   (1) TYPE =  0   End of Options List
*                   (2) TYPE =  1   No Operation
*
*
*               (b) All other TCP options MUST be multi-octet TCP options (see RFC #1122, Section 4.2.2.5) :
*
*                           ------------------------------
*                           | TYPE | LEN  |   TCP OPT    |
*                           ------------------------------
*
*                       where 
*                               TYPE        Indicates the specific TCP option type
*                               LEN         Indicates the total    TCP option length, in octets, including 
*                                                the option type & the option length octets
*                               TCP OPT     Additional TCP option octets, if any, that contain the remaining
*                                                TCP option information

⌨️ 快捷键说明

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