@@ 180,16 180,15 @@ netopen(Chan *c, int omode, Network *np)
case Sdataqid:
case Sctlqid:
id = STREAMID(c->qid.path);
+ id = (*np->open)(c, id);
break;
case Qlisten:
- streamopen(c, np->devp);
id = (*np->listen)(c);
- streamclose(c);
c->qid.path = STREAMQID(id, Sctlqid);
ptclone(c, 1, id);
break;
case Qclone:
- id = (*np->clone)(c);
+ id = (*np->open)(c, -1);
c->qid.path = STREAMQID(id, Sctlqid);
ptclone(c, 0, id);
break;
@@ 200,9 199,6 @@ netopen(Chan *c, int omode, Network *np)
switch(STREAMTYPE(c->qid.path)){
case Sdataqid:
case Sctlqid:
- streamopen(c, np->devp);
- if(np->protop && c->stream->devq->next->info != np->protop)
- pushq(c->stream, np->protop);
p = findprot(np, id);
if(netown(p, up->user, omode&7) < 0)
error(Eperm);
@@ 221,9 217,6 @@ netread(Chan *c, void *a, long n, ulong offset, Network *np)
int t;
char buf[256];
- if(c->stream)
- return streamread(c, a, n);
-
if(c->qid.path&CHDIR)
return devdirread(c, a, n, (Dirtab*)np, 0, netgen);
@@ 242,6 235,7 @@ netadd(Network *np, Netprot *p, int id)
memset(p, 0, sizeof(Netprot));
p->id = id;
+ p->net = np;
l = &np->prot;
for(pp = np->prot; pp; pp = pp->next){
@@ 7,7 7,6 @@ typedef struct Dev Dev;
typedef struct Dirtab Dirtab;
typedef struct Egrp Egrp;
typedef struct Evalue Evalue;
-typedef struct Etherpkt Etherpkt;
typedef struct Fgrp Fgrp;
typedef struct Image Image;
typedef struct IOQ IOQ;
@@ 214,25 213,6 @@ struct Dirtab
long perm;
};
-/*
- * Ethernet packet buffers.
- */
-struct Etherpkt
-{
- uchar d[6];
- uchar s[6];
- uchar type[2];
- uchar data[1500];
- uchar crc[4];
-};
-
-enum
-{
- ETHERMINTU = 60, /* minimum transmit size */
- ETHERMAXTU = 1514, /* maximum transmit size */
- ETHERHDRSIZE = 14, /* size of an ethernet header */
-};
-
/* SCSI devices. */
enum
{
@@ 788,12 768,13 @@ struct Netprot
Netprot *next; /* linked list of protections */
ulong mode;
char owner[NAMELEN];
+ Network *net;
};
struct Netinf
{
char *name;
- void (*fill)(Chan*, char*, int);
+ void (*fill)(Netprot*, char*, int);
};
struct Network
@@ 801,13 782,12 @@ struct Network
Lock;
char *name;
int nconv; /* max # of conversations */
- Qinfo *devp; /* device end line disc */
- Qinfo *protop; /* protocol line disc */
- int (*listen)(Chan*);
- int (*clone)(Chan*);
+ int (*listen)(Netprot*);
+ int (*open)(Netprot*, int);
int ninfo;
Netinf info[5];
Netprot *prot; /* linked list of protections */
+ void *ptr;
};
enum