From 9f23b27eae4720ea4c18eeeacf6ab16f43602132 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 15 Oct 1991 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1991-10-15 --- port/devip.c | 28 ++++++++++++++-------------- port/ipdat.h | 2 ++ port/stil.c | 1 + 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/port/devip.c b/port/devip.c index ffeb29b1923eed7ab5e21b854458806e6495cc10..b7223ce9d0c65130594e6dabc10a3f8647bbf9bd 100644 --- a/port/devip.c +++ b/port/devip.c @@ -176,7 +176,8 @@ ipopen(Chan *c, int omode) error(Ebadarg); break; case iplistenqid: - if(cp->stproto != &tcpinfo) + if(cp->stproto != &tcpinfo && + cp->stproto != &ilinfo) error(Eprotonosup); if(cp->backlog == 0) @@ -227,8 +228,8 @@ ipclonecon(Chan *c) for(new = base; new < etab; new++) { if(new->ref == 0 && canqlock(new)) { if(new->ref || - (new->stproto == &tcpinfo && - new->tcpctl.state != CLOSED)) { + (new->stproto == &tcpinfo && new->tcpctl.state != CLOSED) || + (new->stproto == &ilinfo && new->ilctl.state != Ilclosed)) { qunlock(new); continue; } @@ -299,14 +300,13 @@ ipread(Chan *c, void *a, long n, ulong offset) sprint(buf, "%d.%d.%d.%d %d\n", fmtaddr(Myip), cp->psrc); return stringread(c, a, n, buf, offset); case ipstatusqid: - if(cp->stproto == &tcpinfo) { - sprint(buf, "tcp/%d %d %s %s\n", connection, - cp->ref, tcpstate[cp->tcpctl.state], + if(cp->stproto == &tcpinfo) + sprint(buf, "tcp/%d %d %s %s\n", connection, cp->ref, tcpstate[cp->tcpctl.state], cp->tcpctl.flags & CLONE ? "listen" : "connect"); - } + else if(cp->stproto == &ilinfo) + sprint(buf, "il/%d %d %s\n", connection, cp->ref, ilstate[cp->ilctl.state]); else - sprint(buf, "%s/%d %d\n", cp->stproto->name, - connection, cp->ref); + sprint(buf, "%s/%d %d\n", cp->stproto->name, connection, cp->ref); return stringread(c, a, n, buf, offset); } @@ -333,9 +333,9 @@ ipwrite(Chan *c, char *a, long n, ulong offset) m = getfields(buf, field, 5, ' '); if(strcmp(field[0], "connect") == 0) { - if(cp->stproto == &tcpinfo && - cp->tcpctl.state != CLOSED) - error(Edevbusy); + if((cp->stproto == &tcpinfo && cp->tcpctl.state != CLOSED) || + (cp->stproto == &ilinfo && cp->ilctl.state != Ilclosed)) + error(Edevbusy); if(m != 2) error(Ebadarg); @@ -364,8 +364,8 @@ ipwrite(Chan *c, char *a, long n, ulong offset) } else if(strcmp(field[0], "announce") == 0 || strcmp(field[0], "reserve") == 0) { - if(cp->stproto == &tcpinfo && - cp->tcpctl.state != CLOSED) + if((cp->stproto == &tcpinfo && cp->tcpctl.state != CLOSED) || + (cp->stproto == &ilinfo && cp->ilctl.state != Ilclosed)) error(Edevbusy); if(m != 2) diff --git a/port/ipdat.h b/port/ipdat.h index 053621b3f26cbb50be7b108406e5464d361b3a02..2122972591af69d1c4e23e81bdfb46382d97362b 100644 --- a/port/ipdat.h +++ b/port/ipdat.h @@ -500,6 +500,7 @@ int dupb(Block **, Block *, int, int); void tcp_input(Ipconv *, Block *); void tcprcvwin(Ipconv *); void tcpstart(Ipconv *, int, ushort, char); +void ilstart(Ipconv *, int, int); void tcpflow(void*); void tcp_timeout(void *); void tcp_acktimer(void *); @@ -520,6 +521,7 @@ extern Ipaddr Mymask; extern Ipaddr classmask[4]; extern Ipconv *ipconv[]; extern char *tcpstate[]; +extern char *ilstate[]; extern Rendez tcpflowr; extern Qinfo tcpinfo; extern Qinfo ipinfo; diff --git a/port/stil.c b/port/stil.c index e69b8af30a6803f05d49463c14aab99fe9f0f948..c06b40ee2b392424a33bac0461fdfe79043e831d 100644 --- a/port/stil.c +++ b/port/stil.c @@ -15,6 +15,7 @@ int ilcksum = 1; Queue *Iloutput; /* Il to lance output channel */ static int initseq = 25000; +char *ilstate[] = { "Closed", "Syncer", "Syncee", "Established", "Listening", "Closing" }; void ilrcvmsg(Ipconv*, Block*); void ilackproc(void*);