Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/ip/pktmedium.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname ip/pktmedium.c 1998/0306
## diff -e /dev/null /n/emeliedump/1998/0306/sys/src/brazil/ip/pktmedium.c
0a
#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
#include "../port/error.h"

#include "ip.h"
#include "kernel.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);
static void	pktin(Ipifc *ifc, Block *bp);

Medium pktmedium =
{
	"pkt",
	14,
	60,
	1514,
	6,
	pktbind,
	pktunbind,
	pktbwrite,
	nil,		/* addmulti */
	nil,		/* remmulti */
	pktin,
	nil,		/* addroute */
	nil,		/* remroute */
	nil,		/* flushroute */
	nil,		/* joinmulti */
	nil,		/* leave multi */
};

/*
 *  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);
}

/*
 *  called when someone write's to 'data' with ifc rlocked
 */
static void
pktin(Ipifc *ifc, Block *bp)
{
	if(ifc->lifc == nil)
		freeb(bp);
	else
		ipiput(ifc->lifc->local, bp);
}
.
## diffname ip/pktmedium.c 1998/0307
## diff -e /n/emeliedump/1998/0306/sys/src/brazil/ip/pktmedium.c /n/emeliedump/1998/0307/sys/src/brazil/ip/pktmedium.c
34a
	1,		/* unbind on last close */
.
## diffname ip/pktmedium.c 1998/0313
## diff -e /n/emeliedump/1998/0307/sys/src/brazil/ip/pktmedium.c /n/emeliedump/1998/0313/sys/src/brazil/ip/pktmedium.c
75c
		ipiput(f, ifc->lifc->local, bp);
.
70c
pktin(Fs *f, Ipifc *ifc, Block *bp)
.
67c
 *  called with ifc rlocked when someone write's to 'data'
.
15c
static void	pktin(Fs*, Ipifc *ifc, Block *bp);
.
## diffname ip/pktmedium.c 1998/0330
## diff -e /n/emeliedump/1998/0313/sys/src/brazil/ip/pktmedium.c /n/emeliedump/1998/0330/sys/src/brazil/ip/pktmedium.c
21,22c
	40,
	4*1024,
.
## diffname ip/pktmedium.c 1998/0423
## diff -e /n/emeliedump/1998/0330/sys/src/brazil/ip/pktmedium.c /n/emeliedump/1998/0423/sys/src/brazil/ip/pktmedium.c
76a

void
pktmediumlink(void)
{
	addipmedium(&pktmedium);
}
.
## diffname ip/pktmedium.c 1998/0714
## diff -e /n/emeliedump/1998/0423/sys/src/brazil/ip/pktmedium.c /n/emeliedump/1998/0714/sys/src/brazil/ip/pktmedium.c
34a
	nil,		/* ares */
.
## diffname ip/pktmedium.c 1999/0731
## diff -e /n/emeliedump/1998/0714/sys/src/brazil/ip/pktmedium.c /n/emeliedump/1999/0731/sys/src/brazil/ip/pktmedium.c
19,36c
.name=		"pkt",
.hsize=		14,
.minmtu=	40,
.maxmtu=	4*1024,
.maclen=	6,
.bind=		pktbind,
.unbind=	pktunbind,
.bwrite=	pktbwrite,
.pktin=		pktin,
.unbindonclose=	1,
.
## diffname ip/pktmedium.c 2000/1111
## diff -e /n/emeliedump/1999/0731/sys/src/brazil/ip/pktmedium.c /n/emeliedump/2000/1111/sys/src/9/ip/pktmedium.c
9d
## diffname ip/pktmedium.c 2001/0623
## diff -e /n/emeliedump/2000/1111/sys/src/9/ip/pktmedium.c /n/emeliedump/2001/0623/sys/src/9/ip/pktmedium.c
67c
		ipiput(f, ifc, bp);
.
## diffname ip/pktmedium.c 2002/0507
## diff -e /n/emeliedump/2001/0623/sys/src/9/ip/pktmedium.c /n/emeliedump/2002/0507/sys/src/9/ip/pktmedium.c
67c
		ipiput4(f, ifc, bp);
.
## diffname ip/pktmedium.c 2002/1110
## diff -e /n/emeliedump/2002/0507/sys/src/9/ip/pktmedium.c /n/emeliedump/2002/1110/sys/src/9/ip/pktmedium.c
67a
	}
.
66c
	else {
		if(ifc->conv->snoopers.ref > 0)
			qpass(ifc->conv->sq, copyblock(bp, BLEN(bp)));
.
54a
	if(ifc->conv->snoopers.ref > 0)
		qpass(ifc->conv->sq, copyblock(bp, BLEN(bp)));
.
## diffname ip/pktmedium.c 2003/0209
## diff -e /n/emeliedump/2002/1110/sys/src/9/ip/pktmedium.c /n/emeliedump/2003/0209/sys/src/9/ip/pktmedium.c
20,21c
.mintu=	40,
.maxtu=	4*1024,
.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].