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

2001/0623/ip/pktmedium.c (diff list | history)

2001/0623/sys/src/9/ip/pktmedium.c:1,742002/0507/sys/src/9/ip/pktmedium.c:1,74 (short | long | prev | next)
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); 
	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); 
	else 
2001/0623    
		ipiput(f, ifc, bp); 
2002/0507    
		ipiput4(f, ifc, bp); 
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)