虫虫首页|资源下载|资源专辑|精品软件
登录|注册

您现在的位置是:虫虫下载站 > 资源下载 > 接口技术 > net_tcp.h

net_tcp.h

  • 资源大小:18 K
  • 上传时间: 2015-11-22
  • 上传用户:shouck77
  • 资源积分:2 下载积分
  • 标      签: tcp uCOS-II

资 源 简 介

/*
*********************************************************************************************************
*                                             uC/TCP-IP V2
*                                      The Embedded TCP/IP Suite
*
*                          (c) Copyright 2003-2010; Micrium, Inc.; Weston, FL
*
*               All rights reserved.  Protected by international copyright laws.
*
*               uC/TCP-IP is provided in source form to registered licensees ONLY.  It is 
*               illegal to distribute this source code to any third party unless you receive 
*               written permission by an authorized Micrium representative.  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.
*
*               You can contact us at www.micrium.com.
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*
*                                          NETWORK TCP LAYER
*                                   (TRANSMISSION CONTROL PROTOCOL)
*
* Filename      : net_tcp.h
* Version       : V2.10
* 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 Layer 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
*********************************************************************************************************
*/

#if ((defined(NET_TCP_MODULE)) && \
     (defined(NET_GLOBALS_EXT)))
#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                         0xF000u
#define  NET_TCP_HDR_LEN_SHIFT                            12u
#define  NET_TCP_HDR_LEN_NONE                              0u
#define  NET_TCP_HDR_LEN_MIN                               5u
#define  NET_TCP_HDR_LEN_MAX                              15u
#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                          12u   /*  = sizeof(NET_TCP_PSEUDO_HDR)                        */


#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                     0x0000u   /* 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                        0x0FFFu

#define  NET_TCP_HDR_FLAG_NONE                    DEF_BIT_NONE
#define  NET_TCP_HDR_FLAG_RESERVED                    0x0FE0u   /* 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 with their chosen ASCII names.
*********************************************************************************************************
*/

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

#else

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

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

#else                                                           /* Dflt CPU_WORD_SIZE_08.                               */
#define  NET_TCP_TYPE_NONE                        0x4E4F4E45u   /* "NONE" in ASCII.                                     */
#define  NET_TCP_TYPE_CONN                        0x54435020u   /* "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 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                              0u
#define  NET_TCP_ACK_NBR_NONE                            NET_TCP_SEQ_NBR_NONE

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


#define  NET_TCP_ACK_NBR_DUP_WIN_SIZE_SCALE                4


/*$PAGE*/
/*
*********************************************************************************************************
*                                    TCP DATA/TOTAL LENGTH 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.
*********************************************************************************************************
*/

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

#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)


/*$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 DEFINES  Note #1'.
*********************************************************************************************************
*/

                                                                                        /* See Note #1.                 */
#define  NET_TCP_MAX_SEG_SIZE_DFLT                      (NET_IP_MAX_DATAGRAM_SIZE_DFLT - NET_IP_HDR_SIZE_MIN - NET_TCP_HDR_SIZE_MIN)
#define  NET_TCP_MAX_SEG_SIZE_DFLT_RX                    NET_TCP_DATA_LEN_MAX           /* 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                         0u
#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                              1u
#define  NET_TCP_SEG_LEN_FIN                               1u
#define  NET_TCP_SEG_LEN_CLOSE                           NET_TCP_SEG_LEN_FIN
#define  NET_TCP_SEG_LEN_ACK                               0u
#define  NET_TCP_SEG_LEN_RESET                             0u
#define  NET_TCP_SEG_LEN_PROBE                             0u


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

#define  NET_TCP_TX_PROBE_DATA                          0x00u


/*
*********************************************************************************************************
*                                       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                             0u

#define  NET_TCP_WIN_SIZE_MIN                            NET_TCP_MAX_SEG_SIZE_MIN
#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 encoded 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
*
*                   The following TCP option types are multi-octet TCP options where the option's second
*                   octet specify the total TCP option length, in octets, including the option type & the
*                   option length octets :
*
*                   (1) TYPE =  2   Maximum Segment Size        See RFC # 793, Section  3.1 'Header Format :
*                                                                   Options : Maximum Segment Size';
*                                                                   RFC #1122, Section 4.2.2.6;
*                                                                   RFC # 879, Section 3
*
*                   (2) TYPE =  3   Window  Scale               See 'net_tcp.h  Note #1c1'
*                   (3) TYPE =  4   SACK Allowed                See 'net_tcp.h  Note #1c2'
*                   (4) TYPE =  5   SACK Option                 See 'net_tcp.h  Note #1c2'
*                   (5) TYPE =  6   Echo Request                See 'net_tcp.h  Note #1c3'
*                   (6) TYPE =  7   Echo Reply                  See 'net_tcp.h  Note #1c3'
*                   (7) TYPE =  8   Timestamp                   See 'net_tcp.h  Note #1c4'
*
*           (3) TCP header allows for a maximum option list length of 40 octets :
*
*                   NET_TCP_HDR_OPT_SIZE_MAX = NET_TCP_HDR_SIZE_MAX - NET_TCP_HDR_SIZE_MIN
*
*                                            = 60 - 20
*
*                                            = 40
*
*           (4) 'NET_TCP_OPT_SIZE'  MUST be pre-defined PRIOR to all definitions that require TCP option 
*                size data type.
*********************************************************************************************************
*/
/*$PAGE*/
#define  NET_TCP_HDR_OPT_END_LIST                          0u
#define  NET_TCP_HDR_OPT_NOP                               1u
#define  NET_TCP_HDR_OPT_MAX_SEG_SIZE                      2u
#define  NET_TCP_HDR_OPT_WIN_SCALE                         3u
#define  NET_TCP_HDR_OPT_SACK_PERMIT                       4u
#define  NET_TCP_HDR_OPT_SACK                              5u
#define  NET_TCP_HDR_OPT_ECHO_REQ                          6u
#define  NET_TCP_HDR_OPT_ECHO_REPLY                        7u
#define  NET_TCP_HDR_OPT_TS                                8u

#define  NET_TCP_HDR_OPT_PAD                             NET_TCP_HDR_OPT_END_LIST


#define  NET_TCP_HDR_OPT_LEN_END_LIST                      1u
#define  NET_TCP_HDR_OPT_LEN_NOP                           1u
#define  NET_TCP_HDR_OPT_LEN_MAX_SEG_SIZE                  4u
#define  NET_TCP_HDR_OPT_LEN_WIN_SCALE                     3u
#define  NET_TCP_HDR_OPT_LEN_SACK_PERMIT                   2u
#define  NET_TCP_HDR_OPT_LEN_ECHO_REQ                      6u
#define  NET_TCP_HDR_OPT_LEN_ECHO_REPLY                    6u
#define  NET_TCP_HDR_OPT_LEN_TS                           10u

#define  NET_TCP_HDR_OPT_LEN_SACK_MIN                      6u
#define  NET_TCP_HDR_OPT_LEN_SACK_MAX                     38u

#define  NET_TCP_HDR_OPT_LEN_MIN                           1u
#define  NET_TCP_HDR_OPT_LEN_MIN_LEN                       2u
#define  NET_TCP_HDR_OPT_LEN_MAX                          38u



typedef  CPU_INT32U  NET_TCP_OPT_SIZE;                          /* TCP opt size data type (see Note #4).                */

#define  NET_TCP_HDR_OPT_SIZE_WORD               (sizeof(NET_TCP_OPT_SIZE))
#define  NET_TCP_HDR_OPT_SIZE_MAX                       (NET_TCP_HDR_SIZE_MAX - NET_TCP_HDR_SIZE_MIN)


#define  NET_TCP_HDR_OPT_NBR_MIN                           0u
#define  NET_TCP_HDR_OPT_NBR_MAX                        (NET_TCP_HDR_OPT_SIZE_MAX / NET_TCP_HDR_OPT_SIZE_WORD)


#define  NET_TCP_HDR_OPT_IX                              NET_TCP_HDR_SIZE_MIN


/*$PAGE*/
/*
*********************************************************************************************************
*                                TCP OPTION CONFIGURATION TYPE DEFINES
*
* Note(s) : (1) NET_TCP_OPT_CFG_TYPE_&&& #define values specifically chosen as ASCII representations of 
*               the TCP option configuration types.  Memory displays of TCP option configuration buffers 
*               will display the TCP option configuration TYPEs with their chosen ASCII names.
*********************************************************************************************************
*/

                                                                /* ---------------- TCP OPT CFG TYPES ----------------- */
#if     (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
#define  NET_TCP_OPT_CFG_TYPE_NONE                0x4E4F4E45u   /* "NONE" in ASCII.                                     */
#define  NET_TCP_OPT_CFG_TYPE_MAX_SEG_SIZE        0x4D535320u   /* "MSS " in ASCII.                                     */
#define  NET_TCP_OPT_CFG_TYPE_WIN_SCALE           0x57494E20u   /* "WIN " in ASCII (see 'net_tcp.h  Note #1c1').        */
#define  NET_TCP_OPT_CFG_TYPE_SACK_PERMIT         0x53434B50u   /* "SCKP" in ASCII (see 'net_tcp.h  Note #1c2').        */
#define  NET_TCP_OPT_CFG_TYPE_SACK                0x5341434Bu   /* "SACK" in ASCII (see 'net_tcp.h  Note #1c2').        */
#define  NET_TCP_OPT_CFG_TYPE_ECHO_REQ            0x45524551u   /* "EREQ" in ASCII (see 'net_tcp.h  Note #1c3').        */
#define  NET_TCP_OPT_CFG_TYPE_ECHO_REPLY          0x4543484Fu   /* "ECHO" in ASCII (see 'net_tcp.h  Note #1c3').        */
#define  NET_TCP_OPT_CFG_TYPE_TS                  0x54532020u   /* "TS  " in ASCII (see 'net_tcp.h  Note #1c4').        */

#else

#if     (CPU_CFG_DATA_SIZE   == CPU_WORD_SIZE_32)
#define  NET_TCP_OPT_CFG_TYPE_NONE                0x454E4F4Eu   /* "NONE" in ASCII.                                     */
#define  NET_TCP_OPT_CFG_TYPE_MAX_SEG_SIZE        0x2053534Du   /* "MSS " in ASCII.                                     */
#define  NET_TCP_OPT_CFG_TYPE_WIN_SCALE           0x204E4957u   /* "WIN " in ASCII (see 'net_tcp.h  Note #1c1').        */
#define  NET_TCP_OPT_CFG_TYPE_SACK_PERMIT         0x504B4353u   /* "SCKP" in ASCII (see 'net_tcp.h  Note #1c2').        */
#define  NET_TCP_OPT_CFG_TYPE_SACK                0x4B434153u   /* "SACK" in ASCII (see 'net_tcp.h  Note #1c2').        */
#define  NET_TCP_OPT_CFG_TYPE_ECHO_REQ            0x51455245u   /* "EREQ" in ASCII (see 'net_tcp.h  Note #1c3').        */
#define  NET_TCP_OPT_CFG_TYPE_ECHO_REPLY          0x4F484345u   /* "ECHO" in ASCII (see 'net_tcp.h  Note #1c3').        */
#define  NET_TCP_OPT_CFG_TYPE_TS                  0x20205354u   /* "TS  " in ASCII (see 'net_tcp.h  Note #1c4').        */

#elif   (CPU_CFG_DATA_SIZE   == CPU_WORD_SIZE_16)
#define  NET_TCP_OPT_CFG_TYPE_NONE                0x4F4E454Eu   /* "NONE" in ASCII.                                     */
#define  NET_TCP_OPT_CFG_TYPE_MAX_SEG_SIZE        0x534D2053u   /* "MSS " in ASCII.                                     */
#define  NET_TCP_OPT_CFG_TYPE_WIN_SCALE           0x4957204Eu   /* "WIN " in ASCII (see 'net_tcp.h  Note #1c1').        */
#define  NET_TCP_OPT_CFG_TYPE_SACK_PERMIT         0x4353504Bu   /* "SCKP" in ASCII (see 'net_tcp.h  Note #1c2').        */
#define  NET_TCP_OPT_CFG_TYPE_SACK                0x41534B43u   /* "SACK" in ASCII (see 'net_tcp.h  Note #1c2').        */
#define  NET_TCP_OPT_CFG_TYPE_ECHO_REQ            0x52455145u   /* "EREQ" in ASCII (see 'net_tcp.h  Note #1c3').        */
#define  NET_TCP_OPT_CFG_TYPE_ECHO_REPLY          0x43454F48u   /* "ECHO" in ASCII (see 'net_tcp.h  Note #1c3').        */
#define  NET_TCP_OPT_CFG_TYPE_TS                  0x53542020u   /* "TS  " in ASCII (see 'net_tcp.h  Note #1c4').        */

#else                                                           /* Dflt CPU_WORD_SIZE_08.                               */
#define  NET_TCP_OPT_CFG_TYPE_NONE                0x4E4F4E45u   /* "NONE" in ASCII.                                     */
#define  NET_TCP_OPT_CFG_TYPE_MAX_SEG_SIZE        0x4D535320u   /* "MSS " in ASCII.                                     */
#define  NET_TCP_OPT_CFG_TYPE_WIN_SCALE           0x57494E20u   /* "WIN " in ASCII (see 'net_tcp.h  Note #1c1').        */
#define  NET_TCP_OPT_CFG_TYPE_SACK_PERMIT         0x53434B50u   /* "SCKP" in ASCII (see 'net_tcp.h  Note #1c2').        */
#define  NET_TCP_OPT_CFG_TYPE_SACK                0x5341434Bu   /* "SACK" in ASCII (see 'net_tcp.h  Note #1c2').        */
#define  NET_TCP_OPT_CFG_TYPE_ECHO_REQ            0x45524551u   /* "EREQ" in ASCII (see 'net_tcp.h  Note #1c3').        */
#define  NET_TCP_OPT_CFG_TYPE_ECHO_REPLY          0x4543484Fu   /* "ECHO" in ASCII (see 'net_tcp.h  Note #1c3').        */
#define  NET_TCP_OPT_CFG_TYPE_TS                  0x54532020u   /* "TS  " in ASCII (see 'net_tcp.h  Note #1c4').        */

#endif
#endif


/*$PAGE*/
/*
*********************************************************************************************************
*                                   TCP CONNECTION TIMEOUT DEFINES
*
* Note(s) : (1) (a) (1) RFC #1122, Section 4.2.2.13 'DISCUSSION' states that "the graceful close algorithm
*                       of TCP requires that the connection state remain defined on (at least) one end of
*                       the connection, for a timeout period of 2xMSL ... During this period, the (remote 
*                       socket, local socket) pair that defines the connection is busy and cannot be reused".
*
*                   (2) The following sections reiterate that the TIME-WAIT state timeout scalar is two
*                       maximum segment lifetimes (2 MSL) :
*
*                       (A) RFC #793, Section 3.9 'Event Processing : SEGMENT ARRIVES :
*                               Check Sequence Number : TIME-WAIT STATE'
*                       (B) RFC #793, Section 3.9 'Event Processing : SEGMENT ARRIVES :
*                               Check FIN Bit         : TIME-WAIT STATE'
*
*               (b) (1) RFC #793, Section 3.3 'Sequence Numbers : Knowing When to Keep Quiet' states that
*                       "the Maximum Segment Lifetime (MSL) is ... to be 2 minutes.  This is an engineering
*                       choice, and may be changed if experience indicates it is desirable to do so".
*
*                   (2) Microsoft Corporation's Windows XP defaults MSL to 15 seconds.
*********************************************************************************************************
*/

                                                                                    /* Max seg timeout (see Note #1b) : */
#define  NET_TCP_CONN_TIMEOUT_MAX_SEG_MIN_SEC   (  0u                           )   /* ... min  =  0 seconds            */
#define  NET_TCP_CONN_TIMEOUT_MAX_SEG_MAX_SEC   (  2u * DEF_TIME_NBR_SEC_PER_MIN)   /* ... max  =  2 minutes            */
#define  NET_TCP_CONN_TIMEOUT_MAX_SEG_DFLT_SEC  ( 15u                           )   /* ... dflt = 15 seconds            */

#define  NET_TCP_CONN_TIMEOUT_MAX_SEG_SCALAR       2u                               /* ... scalar (see Note #1a).       */


#define  NET_TCP_CONN_TIMEOUT_CONN_DFLT_SEC     (120u * DEF_TIME_NBR_SEC_PER_MIN)   /* Dflt conn timeout = 120 minutes  */
#define  NET_TCP_CONN_TIMEOUT_USER_DFLT_SEC     ( 30u * DEF_TIME_NBR_SEC_PER_MIN)   /* Dflt user timeout =  30 minutes  */


/*$PAGE*/
/*
*********************************************************************************************************
*                                        TCP CONNECTION STATES
*
* Note(s) : (1) See the following RFC's for TCP state machine summary :
*
*               (a) RFC # 793; Sections 3.2, 3.4, 3.5, 3.9
*               (b) RFC #1122; Sections 4.2.2.8, 4.2.2.10, 4.2.2.11, 4.2.2.13, 4.2.2.18, 4.2.2.20
*
*           (2) (a) #### Additional closing-data-available state used for closing connections to allow the
*                   application layer to receive any remaining data.
*
*                   See also 'net_tcp.c  NetTCP_RxPktConnHandlerFinWait1()  Note #2f5A2',
*                            'net_tcp.c  NetTCP_RxPktConnHandlerFinWait2()  Note #2f5B',
*                            'net_tcp.c  NetTCP_RxPktConnHandlerClosing()   Note #2d2B2a1B',
*                          & 'net_tcp.c  NetTCP_RxPktConnHandlerLastAck()   Note #2d2A1b'.
*********************************************************************************************************
*/

#define  NET_TCP_CONN_STATE_NONE                           0u
#define  NET_TCP_CONN_STATE_FREE                           1u

#define  NET_TCP_CONN_STATE_CLOSED                        10u

#define  NET_TCP_CONN_STATE_LISTEN                        20u

#define  NET_TCP_CONN_STATE_SYNC_RXD                      30u
#define  NET_TCP_CONN_STATE_SYNC_RXD_PASSIVE              31u
#define  NET_TCP_CONN_STATE_SYNC_RXD_ACTIVE               32u

#define  NET_TCP_CONN_STATE_SYNC_TXD                      35u

#define  NET_TCP_CONN_STATE_CONN                          40u

#define  NET_TCP_CONN_STATE_FIN_WAIT_1                    50u
#define  NET_TCP_CONN_STATE_FIN_WAIT_2                    51u
#define  NET_TCP_CONN_STATE_CLOSING                       52u
#define  NET_TCP_CONN_STATE_TIME_WAIT                     53u

#define  NET_TCP_CONN_STATE_CLOSE_WAIT                    55u
#define  NET_TCP_CONN_STATE_LAST_ACK                      56u

#define  NET_TCP_CONN_STATE_CLOSING_DATA_AVAIL            59u   /* See Note #2a.                                        */


/*
*********************************************************************************************************
*                                     TCP CONNECTION QUEUE STATES
*********************************************************************************************************
*/

#define  NET_TCP_RX_Q_STATE_NONE                           0u
#define  NET_TCP_RX_Q_STATE_CLOSED                       100u
#define  NET_TCP_RX_Q_STATE_CLOSING                      101u
#define  NET_TCP_RX_Q_STATE_SYNC                         110u
#define  NET_TCP_RX_Q_STATE_CONN                         111u


#define  NET_TCP_TX_Q_STATE_NONE                           0u
#define  NET_TCP_TX_Q_STATE_CLOSED                       200u
#define  NET_TCP_TX_Q_STATE_CLOSING                      201u
#define  NET_TCP_TX_Q_STATE_SYNC                         210u
#define  NET_TCP_TX_Q_STATE_CONN                         211u
#define  NET_TCP_TX_Q_STATE_SUSPEND                      215u
#define  NET_TCP_TX_Q_STATE_CLOSED_SUSPEND               220u
#define  NET_TCP_TX_Q_STATE_CLOSING_SUSPEND              221u


/*$PAGE*/
/*
*********************************************************************************************************
*                                     TCP CONNECTION CODE DEFINES
**************

相 关 资 源

  • net_tcp.h免费下载

    资源简介:/* ********************************************************************************************************* *                                             uC/tcp-IP V2 *                                 ...

    标签: tcp uCOS-II

    上传时间: 2015-11-22

    上传用户:the same kong

  • H桥驱动.rar免费下载

    资源简介:H桥的一些资料,自己整理得,包括一些电路图和pdf文档资料

    标签: H桥驱动

    上传时间: 2013-04-24

    上传用户:banyou

  • 基于FPGA的H.264变换量化、去方块滤波研究及设计.rar免费下载

    资源简介:H.264/AVC是由国际电信联合会的视频专家组和国际标准化组织的运动图像专家组组成的联合视频小组制定的下一代视频压缩标准。新标准采用了一些先进算法,因此具有优异的压缩性能和极好的网络亲和性,满足低码率情况下的高质量视频的传输。 H.264/AVC采用的先进...

    标签: FPGA 264 变换

    上传时间: 2013-04-24

    上传用户:lanjisu111

  • H.264帧内预测算法优化及几个重要模块的FPGA实现.rar免费下载

    资源简介:H.264作为新一代视频编码标准,相比上一代视频编码标准MPEG2,在相同画质下,平均节约64﹪的码流。该标准仅设定了码流的语法结构和解码器结构,实现灵活性极大,其规定了三个档次,每个档次支持一组特定的编码功能,并支持一类特定的应用,因此。H.264的编码...

    标签: FPGA 264 帧内预测

    上传时间: 2013-06-13

    上传用户:夜月十二桥

  • 基于H.264编解码的算法优化研究及FPGA的硬件实现.rar免费下载

    资源简介:H.264/AVC是由ITU和ISO两大组织联合组成的JVT共同制定的一项新的视频压缩技术标准,在较低带宽上提供高质量的图像传输是H.264/AVC的应用亮点。在同样的视觉质量前提下,H.264/AVC比H.263和MPEG-4节约了50%的码率。但H.264获得优越性能的代价是计算复杂度的增...

    标签: FPGA 264 编解码

    上传时间: 2013-07-17

    上传用户:zukfu

  • 适用于H.264视频解码器的VLD设计免费下载

    资源简介:设计了一种适合于H.264 的变字长解码器根据码流特点进行模块划分减少硬件开销采用并行结构解NAL 包解码效率高采用了桶形移位器进行并行解码每个时钟解一个码字采用Verilog 语言进行设计仿真并通过

    标签: 264 VLD 视频解码器

    上传时间: 2013-07-15

    上传用户:shen007yue

  • h.264官方中文版免费下载

    资源简介:H.264官方中文版,H.264官方中文版,H.264官方中文版,H.264官方中文版

    标签: 264

    上传时间: 2013-05-27

    上传用户:h886166

  • H.264解码算法优化及在ARM上的移植免费下载

    资源简介:在信息化发展的当前,音视频等多媒体作为信息的载体,在社会生活的各个领域,起着越来越重要的作用。数字视频的海量性成为阻碍其应用的的瓶颈之一。在这种情况下,H.264作为新一代的视频压缩标准,以其高性能的压缩效率,成为备受关注的焦点和研究问题。H.2...

    标签: 264 ARM 解码 算法优化

    上传时间: 2013-06-03

    上传用户:shijiang

  • 基于H.264的无线传输差错控制及解码器的ARM实现免费下载

    资源简介:信息化社会的到来以及IP技术的兴起,正深刻的改变着电信网络的面貌以及未来技术发展的走向。无线通信技术的发展为实现数字化社区提供了有力的保证。而视频通信则成为多媒体业务的核心。如何在环境恶劣的无线环境中,实时传输高质量的视频面临着巨大的挑战,因...

    标签: 264 ARM 无线传输 差错控制

    上传时间: 2013-06-18

    上传用户:也一样请求

  • H.264高清视频编解码系统中ARM控制模块的软件设计.pdf免费下载

    资源简介:随着数字电视日益深入人心,高清概念越来越为人所熟知。带有高清视频功能的产品已经逐步走向人们的工作和生活,高清视频处理已经从理论研究走向系统实际应用。毫无疑问,无论是从观众的视觉还是从产业的角度来看,高清视频已经成为数字视频技术发展的必然趋势...

    标签: 264 ARM 高清视频

    上传时间: 2013-04-24

    上传用户:acon

  • H-Bridge.rar免费下载

    资源简介:protel原理图 H桥电机驱动器 特点:5-7V低电压供电,带升压电路产生12V以上栅极驱动电压,两片so-8小体积mos管半桥驱动芯片保证驱动效果 本电路已应用到多个直流电机驱动板上,最大驱

    标签: H-Bridge

    上传时间: 2013-06-01

    上传用户:zhuoying119

  • H.264免费下载

    资源简介:h.264文档学习,参考资料,比较全,内容新-h.264 document learning

    标签: 264

    上传时间: 2013-08-03

    上传用户:czl10052678

  • H.264编码解码器源码(c语言).zip免费下载

    资源简介:可以用H.264编码解码器源码(c语言)

    标签: 264 zip 编码解码器 源码

    上传时间: 2013-07-08

    上传用户:wmwai1314

  • H-JTAG-V0.6.1.zip免费下载

    资源简介:The driver of H-JTAG is open and free for ARM debug

    标签: H-JTAG-V zip

    上传时间: 2013-05-18

    上传用户:ynsnjs

  • EasyJTAG-H免费下载

    资源简介:EasyJTAG-H仿真器支持ARM7系列和ARM9的部分芯片,支持ADS1.2集成开发环境,该文档纤细介绍了其安装和应用。-EasyJTAG

    标签: EasyJTAG-H

    上传时间: 2013-05-31

    上传用户:sunjet

  • H.264帧内预测算法优化及几个重要模块的FPGA实现免费下载

    资源简介:H.264作为新一代视频编码标准,相比上一代视频编码标准MPEG2,在相同画质下,平均节约64﹪的码流。该标准仅设定了码流的语法结构和解码器结构,实现灵活性极大,其规定了三个档次,每个档次支持一组特定的编码功能,并支持一类特定的应用,因此。H.264的编码...

    标签: FPGA 264 帧内预测 算法优化

    上传时间: 2013-05-25

    上传用户:refent

  • 基于H.264的网络视频监控的FPGA实现研究免费下载

    资源简介:随着科学技术的发展与公共安全保障需求的提高,视频监控系统在工业生产、日常生活、警备与军事方面的应用越来越广泛。采用基于 FPGA 的SOPC技术、H.264压缩编码技术和网络传输控制技术实现网络视频监控系统,在稳定性、功能、成本与扩展性等方面都有着突出的...

    标签: FPGA 264 网络视频监控 实现研究

    上传时间: 2013-08-02

    上传用户:88mao

  • H-JTAG.rar免费下载

    资源简介:H-JTAG USB仿真器是一款高速USB接口仿真器。仿真器采用USB接口供电,无需外接电源。支持10K~15MHZ的JTAG时钟,,可提供最高可达750 KB/S的下载速度与最高可达550 KB/S读取速度。与H-JTAG/H-FLASHER配合使用,可以实现高速调试与下载。该仿真器灵活,高效,稳定...

    标签: H-JTAG

    上传时间: 2013-04-24

    上传用户:q123321

  • H.264编码器帧内预测算法的研究免费下载

    资源简介:目前,H.264是图像编码研究领域的一个热点。它在语言结构、预测算法、数据变换等方面做了很大的改进,在低码率传输、高清晰度显示及网络接入等性能上相比以往标准有了显著提高,使得H.264在视频会议、视频点播、数字电视和手...

    标签: 264 编码器 帧内预测 法的研究

    上传时间: 2013-05-27

    上传用户:jjj0202

  • H桥电路.doc免费下载

    资源简介:H桥电路,电机驱动原理

    标签: H桥电路

    上传时间: 2013-06-06

    上传用户:yangbo69

  • H.264 source codes免费下载

    资源简介:·详细说明:h.264 source codes , the x264 is the most effience t e. and the codes are the newst codes . you c a n compile ti using VC 文件列表:   x264   ....\AUTHORS   ....\build   ....\

    标签: nbsp source codes 264

    上传时间: 2013-07-31

    上传用户:zhang97080564

  • 基于H.264的嵌入式实时视频采集与传输系统的设计与实现免费下载

    资源简介:·基于H.264的嵌入式实时视频采集与传输系统的设计与实现

    标签: 264 嵌入式 实时视频 传输系统

    上传时间: 2013-07-09

    上传用户:zjt20011220

  • ITU-T H.263视频编解码协议的最新标准文档免费下载

    资源简介:·ITU-T H.263视频编解码协议的最新标准文档

    标签: ITU-T nbsp 263 视频编解码

    上传时间: 2013-07-16

    上传用户:f1364628965

  • H.264标准代码(用于视频编码)免费下载

    资源简介:·详细说明:h.264标准代码,用于视频编码!可以实现各种视频的编码和解码,可以在这个代码的基础上进行各种开发,比如算法的优化,转码技术,实现各种分辨了的转码-h.264 standard code, uses in the video frequency code! May realize each kind of video ...

    标签: 264 标准 代码 视频编码

    上传时间: 2013-05-28

    上传用户:wqxstar

  • H.264 RTSP 串流(live 555)視窗版本免费下载

    资源简介:·H.264 RTSP 串流 (live 555) 視窗版本 (THE Makefile had modified for VC 2008 BUILD)

    标签: nbsp RTSP live 264

    上传时间: 2013-04-24

    上传用户:asddsd

  • 一种基于DSP的H.264实时视频编码器软件架构免费下载

    资源简介:· 摘要:  提出一种适用于通用DSP平台的H.264视频编码器软件架构.以该架构基础实现的H.264视频编码器软件可以高效地运行在DSP系统中,以满足视频应用中对实时编码的要求.通过性能分析工具对原有的软件代码进行分析.找到代码运行效率不高的瓶颈所在,并结合TM...

    标签: DSP 264 实时视频 编码器

    上传时间: 2013-06-17

    上传用户:jhksyghr

  • 音视频编解码的H.263协议-C语言编写免费下载

    资源简介:·音视频编解码的H.263协议-C语言编写

    标签: 263 音视频 编解码 协议

    上传时间: 2013-06-16

    上传用户:user08x

  • H.263编解码原程序及测试程序源码(含测试序列)免费下载

    资源简介:·详细说明:H.263编解码原程序及测试程序源码,含测试序列,很难得的测试程序源代码.文件列表:   H.263编解码原程序及测试程序源码   ...............................\libr263   ...............................\.......\coder.c   .................

    标签: 263 编解码 程序 测试程序

    上传时间: 2013-06-18

    上传用户:ykykpb

  • H.264资料集合免费下载

    资源简介:·文件列表:   264JM10.rar   63616svn.rar   722727181422softmp4.rar   85375528H.264源码.zip   878282h264new.rar   asf0298rtf.zip   h.264.rar   h.264的源代码.rar   H264S

    标签: 264

    上传时间: 2013-07-10

    上传用户:123456wh

  • AVS-中国代替H.264/MPEG4的编解码标准 官方源代码免费下载

    资源简介:·AVS-中国代替H.264/MPEG4的编解码标准 官方源代码

    标签: MPEG nbsp AVS 264

    上传时间: 2013-05-18

    上传用户:shus521