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

📄 net_tcp.h

📁 从Luminary官方网站下载的LM3S6000系列的UCos+Tcp/IP的源码, 经本人稍微修改后可直接在IAR6.2下编译通过,里面包括了LM3S6000系列的所有外设UART, PWn....
💻 H
📖 第 1 页 / 共 5 页
字号:
/*
*********************************************************************************************************
*                                              uC/TCP-IP
*                                      The Embedded TCP/IP Suite
*
*                          (c) Copyright 2003-2007; Micrium, Inc.; Weston, FL
*
*               All rights reserved.  Protected by international copyright laws.
*
*               uC/TCP-IP is provided in source form for FREE evaluation, for educational
*               use or peaceful research.  If you plan on using uC/TCP-IP in a commercial
*               product you need to contact Micrium to properly license its use in your
*               product.  We provide ALL the source code for your convenience and to help
*               you experience uC/TCP-IP.  The fact that the source code is provided does
*               NOT mean that you can use it without paying a licensing fee.
*
*               Knowledge of the source code may NOT be used to develop a similar product.
*
*               Please help us continue to provide the Embedded community with the finest
*               software available.  Your honesty is greatly appreciated.
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*
*                                          NETWORK TCP LAYER
*                                   (TRANSMISSION CONTROL PROTOCOL)
*
* Filename      : net_tcp.h
* Version       : V1.89
* Programmer(s) : ITJ
*********************************************************************************************************
* Note(s)       : (1) Supports Transmission Control Protocol as described in RFC #793 with the following
*                     restrictions/constraints :
*
*                     (a) TCP Security & Precedence NOT supported               RFC # 793, Section 3.6
*
*                     (b) TCP Urgent Data           NOT supported               RFC # 793, Section 3.7
*                                                                                'The Communication of
*                                                                                  Urgent Information'
*
*                     (c) The following TCP options NOT supported :             
*
*                         (1) Window Scale                                      RFC #1072, Section 2
*                                                                               RFC #1323, Section 2
*                         (2) Selective Acknowledgement (SACK)                  RFC #1072, Section 3
*                                                                               RFC #2018
*                                                                               RFC #2883
*                         (3) TCP Echo                                          RFC #1072, Section 4
*                         (4) Timestamp                                         RFC #1323, Section 3.2
*                         (5) Protection Against Wrapped Sequences (PAWS)       RFC #1323, Section 4
*
*                     (d) #### IP-Options-to-TCP-Connection                     RFC #1122, Section 4.2.3.8
*                                Handling NOT           supported
*
*                     (e) #### ICMP-Error-Message-to-TCP-Connection             RFC #1122, Section 4.2.3.9
*                                Handling NOT currently supported
*
*                 (2) TCP Layer assumes/requires Network Socket Layer (see 'net_sock.h  MODULE  Note #1a2').
*********************************************************************************************************
*/

/*$PAGE*/
/*
*********************************************************************************************************
*                                               MODULE
*
* Note(s) : (1) TCP module is NOT required for UDP-to-Application API configuration.
*
*               See also 'net_cfg.h  TRANSPORT LAYER CONFIGURATION'
*                      & 'net_cfg.h  USER DATAGRAM PROTOCOL LAYER CONFIGURATION'.
*
*               See also 'net_tcp.h  Note #2'.
*
*           (2) The following TCP-module-present configuration value MUST be pre-#define'd in 
*               'net_cfg_net.h' PRIOR to all other network modules that require TCP Layer
*               Configuration (see 'net_cfg_net.h  TCP LAYER CONFIGURATION  Note #2b') :
*
*                   NET_TCP_MODULE_PRESENT
*********************************************************************************************************
*/

#ifdef   NET_TCP_MODULE_PRESENT                                 /* See Note #2.                                         */


/*
*********************************************************************************************************
*                                               EXTERNS
*********************************************************************************************************
*/

#ifdef   NET_TCP_MODULE
#define  NET_TCP_EXT
#else
#define  NET_TCP_EXT  extern
#endif


/*$PAGE*/
/*
*********************************************************************************************************
*                                               DEFINES
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                         TCP HEADER DEFINES
*
* Note(s) : (1) The following TCP value MUST be pre-#define'd in 'net_def.h' PRIOR to 'net_buf.h' so that
*               the Network Buffer Module can configure maximum buffer header size (see 'net_def.h  TCP
*               LAYER DEFINES' & 'net_buf.h  NETWORK BUFFER INDEX & SIZE DEFINES  Note #1') :
*
*               (a) NET_TCP_HDR_SIZE_MAX                  60        (NET_TCP_HDR_LEN_MAX         
*                                                                  * NET_TCP_HDR_LEN_WORD_SIZE)
*
*           (2) Urgent pointer & data NOT supported (see 'net_tcp.h  Note #1b').
*********************************************************************************************************
*/

#define  NET_TCP_HDR_LEN_MASK                         0xF000
#define  NET_TCP_HDR_LEN_SHIFT                            12
#define  NET_TCP_HDR_LEN_NONE                              0
#define  NET_TCP_HDR_LEN_MIN                               5
#define  NET_TCP_HDR_LEN_MAX                              15
#define  NET_TCP_HDR_LEN_WORD_SIZE                       CPU_WORD_SIZE_32

#define  NET_TCP_HDR_SIZE_MIN                           (NET_TCP_HDR_LEN_MIN * NET_TCP_HDR_LEN_WORD_SIZE)
#if 0                                                           /* See Note #1a.                                        */
#define  NET_TCP_HDR_SIZE_MAX                           (NET_TCP_HDR_LEN_MAX * NET_TCP_HDR_LEN_WORD_SIZE)
#endif

#define  NET_TCP_HDR_SIZE_TOT_MIN                       (NET_IP_HDR_SIZE_TOT_MIN + NET_TCP_HDR_SIZE_MIN)
#define  NET_TCP_HDR_SIZE_TOT_MAX                       (NET_IP_HDR_SIZE_TOT_MAX + NET_TCP_HDR_SIZE_MAX)


#define  NET_TCP_PSEUDO_HDR_SIZE                          12    /* Sizeof(NET_TCP_PSEUDO_HDR) [see 'TCP PSEUDO-HEADER'].*/


#define  NET_TCP_PORT_NBR_RESERVED                       NET_PORT_NBR_RESERVED
#define  NET_TCP_PORT_NBR_NONE                           NET_TCP_PORT_NBR_RESERVED


#define  NET_TCP_HDR_URG_PTR_NONE                     0x0000    /* See Note #2.                                         */


/*$PAGE*/
/*
*********************************************************************************************************
*                                       TCP HEADER FLAG DEFINES
*
* Note(s) : (1) See 'TCP HEADER  Note #2' for flag fields.
*
*           (2) Urgent pointer & data NOT supported (see 'net_tcp.h  Note #1b').
*********************************************************************************************************
*/

#define  NET_TCP_HDR_FLAG_MASK                        0x0FFF

#define  NET_TCP_HDR_FLAG_NONE                    DEF_BIT_NONE
#define  NET_TCP_HDR_FLAG_RESERVED                    0x0FE0    /* MUST be '0'.                                         */
#define  NET_TCP_HDR_FLAG_URGENT                  DEF_BIT_05    /* See Note #2.                                         */
#define  NET_TCP_HDR_FLAG_ACK                     DEF_BIT_04
#define  NET_TCP_HDR_FLAG_PUSH                    DEF_BIT_03
#define  NET_TCP_HDR_FLAG_RESET                   DEF_BIT_02
#define  NET_TCP_HDR_FLAG_SYNC                    DEF_BIT_01
#define  NET_TCP_HDR_FLAG_FIN                     DEF_BIT_00
#define  NET_TCP_HDR_FLAG_CLOSE                   NET_TCP_HDR_FLAG_FIN


/*
*********************************************************************************************************
*                                          TCP FLAG DEFINES
*********************************************************************************************************
*/

                                                                /* ------------------ NET TCP FLAGS ------------------- */
#define  NET_TCP_FLAG_NONE                        DEF_BIT_NONE
#define  NET_TCP_FLAG_USED                        DEF_BIT_00    /* TCP conn cur used; i.e. NOT in free TCP conn pool.   */

                                                                /* ------------------ TCP TX  FLAGS ------------------- */
                                                                /* TCP tx flags copied from TCP hdr flags.              */
#define  NET_TCP_FLAG_TX_FIN                      NET_TCP_HDR_FLAG_FIN
#define  NET_TCP_FLAG_TX_CLOSE                    NET_TCP_FLAG_TX_FIN
#define  NET_TCP_FLAG_TX_SYNC                     NET_TCP_HDR_FLAG_SYNC
#define  NET_TCP_FLAG_TX_RESET                    NET_TCP_HDR_FLAG_RESET
#define  NET_TCP_FLAG_TX_PUSH                     NET_TCP_HDR_FLAG_PUSH
#define  NET_TCP_FLAG_TX_ACK                      NET_TCP_HDR_FLAG_ACK
#define  NET_TCP_FLAG_TX_URGENT                   NET_TCP_HDR_FLAG_URGENT

#define  NET_TCP_FLAG_TX_BLOCK                    DEF_BIT_07

                                                                /* ------------------ TCP RX  FLAGS ------------------- */
#define  NET_TCP_FLAG_RX_DATA_PEEK                DEF_BIT_08
#define  NET_TCP_FLAG_RX_BLOCK                    DEF_BIT_15


/*$PAGE*/
/*
*********************************************************************************************************
*                                          TCP TYPE DEFINES
*
* Note(s) : (1) NET_TCP_TYPE_??? #define values specifically chosen as ASCII representations of the TCP
*               types.  Memory displays of TCP types will display the TCP TYPE with the chosen ASCII name.
*********************************************************************************************************
*/

                                                                /* ------------------ NET TCP TYPES ------------------- */
#if     (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
#define  NET_TCP_TYPE_NONE                        0x4E4F4E45    /* "NONE" in ASCII.                                     */
#define  NET_TCP_TYPE_CONN                        0x54435020    /* "TCP " in ASCII.                                     */

#else

#if     (CPU_CFG_DATA_SIZE   == CPU_WORD_SIZE_32)
#define  NET_TCP_TYPE_NONE                        0x454E4F4E    /* "NONE" in ASCII.                                     */
#define  NET_TCP_TYPE_CONN                        0x20504354    /* "TCP " in ASCII.                                     */

⌨️ 快捷键说明

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