ue_write.c,v

来自「TCP-IP红宝书源代码」· C,V 代码 · 共 88 行

C,V
88
字号
head	1.2;
access;
symbols;
locks
	dls:1.2; strict;
comment	@ * @;


1.2
date	97.09.21.19.26.10;	author dls;	state Dist;
branches;
next	1.1;

1.1
date	94.08.04.20.19.17;	author dls;	state Orig;
branches;
next	;


desc
@@


1.2
log
@pre-3e code
@
text
@/* ue_write.c - ue_write */

#include <conf.h>
#include <kernel.h>
#include <network.h>

/*------------------------------------------------------------------------
 * ue_write - write a single packet to an SMC Ultra Ethernet
 *------------------------------------------------------------------------
 */
int
ue_write(pdev, pep, len)
struct devsw	*pdev;
struct ep	*pep;
int		len;
{
	struct utdev	*pud;

	pud = (struct utdev *)pdev->dvioblk;
	if (len > EP_MAXLEN) {
		nif[pud->ud_ifnum].ni_odiscard++;
		freebuf(pep);
		return SYSERR;
	}
	/* subtract the local header */
	len -= (int)&pep->ep_eh - (int)pep;
	if (len < EP_MINLEN)
		len = EP_MINLEN;
	blkcopy(pep->ep_src, pud->ud_paddr, EP_ALEN);
	pep->ep_len = len;
	pep->ep_type = hs2net(pep->ep_type);
	pep->ep_order &= ~EPO_NET;
		
	if (enq(pud->ud_outq, pep, 0) < 0) {
		nif[pud->ud_ifnum].ni_odiscard++;
		freebuf(pep);
		ue_wstrt(pud);
		return SYSERR;
	}
	ue_wstrt(pud);
	return OK;
}
@


1.1
log
@Initial revision
@
text
@a32 7
if (pep->ep_type == hs2net(EPT_IP)) {
	struct ip *pip = (struct ip *)pep->ep_data;
	if (pip->ip_proto == hs2net(IPT_TCP)) {
		kprintf("ue_write:\n");
		pdump(pep);
	}
}
@

⌨️ 快捷键说明

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