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

📄 tcp.h

📁 用于嵌入式系统的TCP/IP协议栈
💻 H
字号:
/***********************************************************************//*                                                                     *//*   Module:  tcp_ip/tcp/tcp.h                                         *//*   Release: 2001.3                                                   *//*   Version: 99.0                                                     *//*   Purpose: TCP Private Header File                                  *//*                                                                     *//*---------------------------------------------------------------------*//*                                                                     *//*               Copyright 1999, Blunk Microsystems                    *//*                      ALL RIGHTS RESERVED                            *//*                                                                     *//*   Licensees have the non-exclusive right to use, modify, or extract *//*   this computer program for software development at a single site.  *//*   This program may be resold or disseminated in executable format   *//*   only. The source code may not be redistributed or resold.         *//*                                                                     *//***********************************************************************//***********************************************************************//* Configuration                                                       *//***********************************************************************/#define TWO_MSL     (120 * TICKS_PER_SEC) /* twice segment lifetime */#define MAX_RXT     (60 * TICKS_PER_SEC)  /* max retransmit timeout */#define MIN_RXT     ((3 * TICKS_PER_SEC) / 2)   /* min retrans timeout */#define INIT_RXT    (6 * TICKS_PER_SEC)   /* init retransmit timeout */#define MAX_PRS     (60 * TICKS_PER_SEC)  /* max persist timeout */#define MIN_PRS     (5 * TICKS_PER_SEC)   /* min persist timeout */#define ACK_DELAY   (TICKS_PER_SEC / 5)   /* acknowledgment delay */#define KEEPALIVE_TIMEO   (2 * 60 * 60 * TICKS_PER_SEC)/***********************************************************************//* Symbol Definitions                                                  *//***********************************************************************/#define TCPMHLEN        20      /* minimum TCP header length */#define TCPHOFFSET      0x50    /* offset value for TCPMHLEN */#define TCP_MAXOPT      40      /* largest option field, bytes *//*** TCP header length macro must work on possibly unaligned segments*/#define TCP_HLEN(tcp) \  (((((ui8 *)(tcp))[offsetof(Tcp, offset)]) & 0xF0) >> 2)/*** Supported TCP Options*/#define TPO_EOOL        0       /* end of option list */#define TPO_NOOP        1       /* no operation */#define TPO_MSS         2       /* maximum segment size *//*** Output States*/#define TCPO_IDLE       0#define TCPO_XMIT       1       /* keep TCPO_IDLE and TCPO_XMIT less */#define TCPO_REXMT      2       /* than TCPO_REXMT and TCPO_PERSIST */#define TCPO_PERSIST    3/*** Default maximum send and receive window sizes*/#define SOCK_RBUF_SIZE   TCP_BIG_SIZE#define SOCK_SBUF_SIZE   TCP_BIG_SIZE/***********************************************************************//* Type Definitions                                                    *//***********************************************************************//*** TCP Packet Format*/typedef struct tcp{  ui16   src_port;      /* source port */  ui16   dst_port;      /* destination port */  tcpseq seq_num;       /* sequence */  tcpseq ack_num;       /* acknowledged sequence */  ui8    offset;        /* TCP data offset */  ui8    flags;         /* control flags */  ui16   window;        /* window advertisement */  ui16   cksum;         /* check sum */  ui16   urg_ptr;       /* urgent pointer */  ui8    options[TCP_MAXOPT];   /* variable length options */} Tcp;/***********************************************************************//* Global Variable Declarations                                        *//***********************************************************************/extern SOCKET Sock;/***********************************************************************//* Function Prototypes                                                 *//***********************************************************************/void TcpInit(void);ui16 TcpCheckSum(const NetBuf *buf);void TcpReset(void);void TcpDrop(SOCKET sock, int error);void TcpJustAck(SOCKET sock);void TcpTryOut(SOCKET sock);int  TcpData(SOCKET sock);void TcpFreeOoQ(SOCKET sock);int  TcpSendSeg(SOCKET sock, int window);ui16 TcpRcvWin(SOCKET sock);void TcpStrip(SOCKET sock, int flag);#define FREE_RBUF     (1 << 0)#define FREE_SBUF     (1 << 1)void *TcpNewSock(int mode);#define WITH_BUFS     1#define NO_BUFS       0void TcpQuerySock(void);void TcpOutTimeout(void *object);

⌨️ 快捷键说明

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