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

📄 tcpip.h

📁 S3C2440驱动DM9000A的裸机程序
💻 H
字号:
#ifndef  _TCPIP_
#define  _TCPIP_

#define	MAX_CONN			255
typedef	struct _CONN{
	U8  ipaddr[4];
	U8  port[2];
	U8  his_sequence[4];
	U8  my_sequence[4];
	U8  old_sequence[4];
	U8  his_ack[4];
	U8  inactivity;
	U8  state;
}CONN;

#define	NULL						((void*)0)
#define	ICMP_TYPE				0x01
#define	TCP_TYPE					0x06
#define	UDP_TYPE					0x11
#define	IP_PACKET				0x0008
#define	ARP_PACKET				0x0608
#define	ARP_REQUEST				0x0100
#define	ARP_RESPONSE			0x0200

#define	HTTP_PORT				80

#define	TCP_FIN					0x01
#define	TCP_SYN					0x02
#define	TCP_RST					0x04
#define	TCP_PSH					0x08
#define	TCP_ACK					0x10
#define	TCP_URG					0x20

#define	STATE_CLOSED			0
#define	STATE_LISTEN			1
#define	STATE_SYN_RCVD			2
#define	STATE_ESTABLISHED		3
#define	STATE_CLOSE_WAIT		4
#define	STATE_LAST_ACK			5
#define	STATE_FIN_WAIT_1		6
#define	STATE_FIN_WAIT_2		7
#define	STATE_CLOSING			8
#define	STATE_TIME_WAIT			9

#define	CACHESIZE				255
#define	CACHETIME				20		// 20min(60 second intervals)
#define	ARP_TIMEOUT				4		// 2sec(0.5 second intervals)

extern U16 gUDP_counter, gUDP_Port, gIP_ident;//mytcpip.c
extern U32 netlock;//mytcpip.c//是否锁定网络通信
extern U8  gMyIP[4];//mytcpip.c
extern U8  gMyPhy[8];////mytcpip.c
extern  U32 gSendUDP;//mytcpip.c
extern U8  gMyDestIP[4];//mytcpip.c
extern void Tcpip_check(void);//tcpip.c

extern void DM9000_SetPhy(U8 *Phy);
extern U8 DM9000_init(void);
extern void DM9000_SendBuf(U8 *buf, U32 len);
extern U32  DM9000_RecvBuf(U8 *buf);
extern void Arp_update(U8 *ipaddr, U8 *hwaddr);				// arp.c
extern void Arp_init(void);	//初始IP地址, gUDP_counter, gUDP_Port, gIP_ident;								// arp.c
extern U8*  Arp_resolve(U8 *ipaddr);							// arp.c
extern void Arp_receive(U8 *buf);								// arp.c
extern U32  Calc_checksum(U8 *buf, U32 len);					// ip.c
//ipaddr=目标地址,proro_id=协议类型,len是上一级的数据包长度,从buf[34]开始
extern void IP_send(U8 *buf, U8 *ipaddr, U8 proto_id, U32 len);	// ip.c
extern void IP_receive(U8 *buf, U32 len);						// ip.c
extern void ICMP_receive(U8 *buf, U32 payload_len);		// icmp.c
extern void UDP_receive(U8 *buf, U32 len);					// 自定义
extern void UDP_SendImg(U8* destIP);
//extern void TCP_receive(U8 *buf, U32 len);					// 自定义

#endif

⌨️ 快捷键说明

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