tcp_cfg.h

来自「一种操作系统源码核」· C头文件 代码 · 共 97 行

H
97
字号
#define DEBUG_ENABLE   TRUE
#define EPT_ARP_HIGH    0x08
#define EPT_ARP_LOW     0x06

/* IP packet type is 0x0800 */
#define EPT_IP_HIGH     0x08
#define EPT_IP_LOW      0x00

#define ARP_LENGTH      (8 + HW_ALEN + IP_ALEN + HW_ALEN + IP_ALEN)
#define	ARP_QSIZE	3	/* ARP port queue size			*/
#define ARP_HLEN	8	/* ARP header length			*/
#define	ARP_REQUEST	1	/* ARP request to resolve address	*/
#define	ARP_REPLY	2	/* reply to a resolve request		*/
#define	ARP_FREE	0	/* Entry is unused (initial value)	*/
#define	ARP_PENDING	1	/* Entry is used but incomplete		*/
#define	ARP_RESOLVED	2	/* Entry has been resolved		*/

#define ARP_TIMEOUT	3		/* 10 minutes			*/

#define	ARP_MAX_RETRY	5	/* give up after ~30 seconds		*/
#define  ArpBufLength  ARP_QSIZE*(EP_ALEN+IP_ALEN)


#define EP_ALEN	    6		// MAC address on ethernet length is 6 
#define IP_ALEN     4		// IP address length is 4 
//ip type
#define	IPT_ICMP	1	/* protocol type for ICMP packets	*/
#define	IPT_IGMP	2	/* protocol type for IGMP packets	*/
#define	IPT_TCP		6	/* protocol type for TCP packets	*/
#define IPT_EGP		8	/* protocol type for EGP packets	*/
#define	IPT_UDP		17	/* protocol type for UDP packets	*/
#define IP_FIRST_BYTE   0x45					/*  which incoming pac. queued	*/
#define	IP_VERSION	4	/* current version value		*/
#define IP_INIT_TTL     128 /* initial time-to-live value */
#define TCB_LENGTH          28
#define	TCP_MIN_OFFSET	0x50
#define TCP_MHLEN  20

#define	TCP_HLEN(ptcp)		(((ptcp)->offset & 0xf0)>>2)
#define TCP_WINDOW_SIZE	    198		// Max tcp data
//tcp code

#define	TCPF_URG	0x20	/* urgent poINT16Uer is valid		*/
#define	TCPF_ACK	0x10	/* acknowledgement field is valid	*/
#define	TCPF_PSH	0x08	/* this segment requests a push		*/
#define	TCPF_RST	0x04	/* reset the connection			*/
#define	TCPF_SYN	0x02	/* synchronize sequence numbers		*/
#define	TCPF_FIN	0x01	/* snder has reached end of its stream	*/
//tcb state
#define TCPS_FREE		0
#define TCPS_CLOSED		1
#define	TCPS_LISTEN		2
#define	TCPS_SYNSENT		3
#define	TCPS_SYNRCVD		4
#define	TCPS_ESTABLISHED	5
#define	TCPS_FINWAIT1		6
#define	TCPS_FINWAIT2		7
#define	TCPS_CLOSEWAIT		8
#define	TCPS_LASTACK		9
#define	TCPS_CLOSING		10
#define	TCPS_TIMEWAIT		11
//tcb flag
#define	TCBF_NEED_OUT	0x01	/* we need output			*/
#define	TCBF_FIRST_SND	0x02	/* no data to ACK			*/
#define	TCBF_RDONE	0x04	/* no more to receive			*/
#define	TCBF_RCV_DONE	0x08	/* no more receive data to process	*/
#define	TCBF_SND_DONE	0x10	/* no more snd data allowed		*/
#define	TCBF_DELAY_ACK	0x20	/* do delayed ACK's			*/
#define	TCBF_BUFFER	0x40	/* do TCP buffering (default no)	*/
#define	TCBF_SND_FIN	0x80	/* user process has closed; snd a FIN	*/
#define	TCP_SERVER		0
#define	TCP_CLIENT		1
#define TCP_MAX_LEN    197
#define UDP_MAX_LEN    768
#define UDP_HLEN  8
#define UDP_LOCAL_PORT_HIGH		0x20

#define UDP_DEBUG_PORT_LOW		0x21
#define UDP_TEST_PORT_LOW		0x22

#define DNS_LOCAL_PORT_HIGH		0x24
#define DNS_LOCAL_PORT_LOW		0x23

#define TCP_LOCAL_PORT_HIGH		0x22
#define TCP_UPGRADE_PORT_LOW	0x23


// Wellknown DHCP server and client
#define DHCP_SERVER_PORT_HIGH	0
#define DHCP_SERVER_PORT_LOW	67
#define DHCP_LOCAL_PORT_HIGH	0
#define DHCP_LOCAL_PORT_LOW		68

#define DNS_SERVER_PORT_HIGH	0	
#define DNS_SERVER_PORT_LOW		53
#define TELNET_SERVER_PORT_HIGH		0x00
#define TELNET_SERVER_PORT_LOW		0x17

⌨️ 快捷键说明

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