plan 9 kernel history: overview | file list | diff list

2002/1110/ip/pktmedium.c (diff list | history)

ip/pktmedium.c on 1998/0306
1998/0306    
#include "u.h" 
#include "../port/lib.h" 
#include "mem.h" 
#include "dat.h" 
#include "fns.h" 
#include "../port/error.h" 
 
#include "ip.h" 
 
 
static void	pktbind(Ipifc *ifc, int argc, char **argv); 
static void	pktunbind(Ipifc *ifc); 
static void	pktbwrite(Ipifc *ifc, Block *bp, int version, uchar *ip); 
1998/0313    
static void	pktin(Fs*, Ipifc *ifc, Block *bp); 
1998/0306    
 
Medium pktmedium = 
{ 
1999/0731    
.name=		"pkt", 
.hsize=		14, 
.minmtu=	40, 
.maxmtu=	4*1024, 
.maclen=	6, 
.bind=		pktbind, 
.unbind=	pktunbind, 
.bwrite=	pktbwrite, 
.pktin=		pktin, 
.unbindonclose=	1, 
1998/0306    
}; 
 
/* 
 *  called to bind an IP ifc to an ethernet device 
 *  called with ifc wlock'd 
 */ 
static void 
pktbind(Ipifc*, int, char**) 
{ 
} 
 
/* 
 *  called with ifc wlock'd 
 */ 
static void 
pktunbind(Ipifc*) 
{ 
} 
 
/* 
 *  called by ipoput with a single packet to write 
 */ 
static void 
pktbwrite(Ipifc *ifc, Block *bp, int, uchar*) 
{ 
	/* enqueue onto the conversation's rq */ 
	bp = concatblock(bp); 
2002/1110    
	if(ifc->conv->snoopers.ref > 0) 
		qpass(ifc->conv->sq, copyblock(bp, BLEN(bp))); 
1998/0306    
	qpass(ifc->conv->rq, bp); 
} 
 
/* 
1998/0313    
 *  called with ifc rlocked when someone write's to 'data' 
1998/0306    
 */ 
static void 
1998/0313    
pktin(Fs *f, Ipifc *ifc, Block *bp) 
1998/0306    
{ 
	if(ifc->lifc == nil) 
		freeb(bp); 
2002/1110    
	else { 
		if(ifc->conv->snoopers.ref > 0) 
			qpass(ifc->conv->sq, copyblock(bp, BLEN(bp))); 
2002/0507    
		ipiput4(f, ifc, bp); 
2002/1110    
	} 
1998/0306    
} 
1998/0423    
 
void 
pktmediumlink(void) 
{ 
	addipmedium(&pktmedium); 
} 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)