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

📄 ipfhcopy.c

📁 关于IP协议方面的
💻 C
字号:
/* ipfhcopy.c - ipfhcopy */#include <conf.h>#include <kernel.h>#include <network.h>/*------------------------------------------------------------------------ *  ipfhcopy -  copy the hardware, IP header, and options for a fragment *------------------------------------------------------------------------ */intipfhcopy(struct ep *pepto, struct ep *pepfrom, unsigned offindg){	struct	ip	*pipfrom = (struct ip *)pepfrom->ep_data;	unsigned	i, maxhlen, olen, otype;	unsigned	hlen = (IP_MINHLEN<<2);	if (offindg == 0) {		memcpy(pepto, pepfrom, EP_HLEN+IP_HLEN(pipfrom));		return IP_HLEN(pipfrom);	}	memcpy(pepto, pepfrom, EP_HLEN+hlen);	/* copy options */	maxhlen = IP_HLEN(pipfrom);	i = hlen;	while (i < maxhlen) {		otype = pepfrom->ep_data[i];		olen = pepfrom->ep_data[++i];		if (otype & IPO_COPY) {			memcpy(&pepto->ep_data[hlen],				&pepfrom->ep_data[i-1], olen);			hlen += olen;		} else if (otype == IPO_NOP || otype == IPO_EOOP) {			pepto->ep_data[hlen++] = otype;			olen = 1;		}		i += olen-1;				if (otype == IPO_EOOP)			break;	}	/* pad to a multiple of 4 octets */	while (hlen % 4)		pepto->ep_data[hlen++] = IPO_NOP;	return hlen;}

⌨️ 快捷键说明

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