4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / usr.bin / netstat / iso.c
index fa664af..d389191 100644 (file)
@@ -1,30 +1,30 @@
-/*-
- * Copyright (c) 1989, 1990 The Regents of the University of California.
- * All rights reserved.
+/*
+ * Copyright (c) 1983, 1988, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * %sccs.include.redist.c%
  */
 
 #ifndef lint
  *
  * %sccs.include.redist.c%
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)iso.c      5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)iso.c      8.1 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
- * $Header: iso.c,v 3.3 88/12/08 14:44:49 hagens Exp $
- * $Source: /usr/argo/src/ucb/netstat/RCS/iso.c,v $
+ * $Header: iso.c,v 1.5 92/06/04 00:36:32 leres Exp $
+ * $Source: /usr/src/usr.bin/netstat/RCS/iso.c,v $
  */
 /*******************************************************************************
                  Copyright IBM Corporation 1987
 
                       All Rights Reserved
 
  */
 /*******************************************************************************
                  Copyright IBM Corporation 1987
 
                       All Rights Reserved
 
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
 provided that the above copyright notice appear in all copies and that
 provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
+both that copyright notice and this permission notice appear in
 supporting documentation, and that the name of IBM not be
 used in advertising or publicity pertaining to distribution of the
 supporting documentation, and that the name of IBM not be
 used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
+software without specific, written prior permission.
 
 IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
 
 IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
@@ -64,7 +64,6 @@ SOFTWARE.
 #undef satosiso
 #include <netiso/tp_param.h>
 #include <netiso/tp_states.h>
 #undef satosiso
 #include <netiso/tp_param.h>
 #include <netiso/tp_states.h>
-#include <netiso/tp_astring.c>
 #include <netiso/tp_pcb.h>
 #include <netiso/tp_stat.h>
 #include <netiso/iso_pcb.h>
 #include <netiso/tp_pcb.h>
 #include <netiso/tp_stat.h>
 #include <netiso/iso_pcb.h>
@@ -74,21 +73,31 @@ SOFTWARE.
 #undef IncStat
 #endif
 #include <netiso/cons_pcb.h>
 #undef IncStat
 #endif
 #include <netiso/cons_pcb.h>
+#include <arpa/inet.h>
 #include <netdb.h>
 #include <netdb.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "netstat.h"
 
 
+static void tprintstat __P((struct tp_stat *, int));
+static void isonetprint __P((struct sockaddr_iso *, int));
+static void hexprint __P((int, char *, char *));
+extern void inetprint __P((struct in_addr *, int, char *));
 
 /*
  *     Dump esis stats
  */
 
 /*
  *     Dump esis stats
  */
+void
 esis_stats(off, name)
 esis_stats(off, name)
-       off_t   off;
+       u_long  off;
        char    *name;
 {
        struct esis_stat esis_stat;
 
        char    *name;
 {
        struct esis_stat esis_stat;
 
-       if (off == 0)
+       if (off == 0 ||
+           kread(off, (char *)&esis_stat, sizeof (struct esis_stat)))
                return;
                return;
-       kvm_read(off, (char *)&esis_stat, sizeof (struct esis_stat));
        printf("%s:\n", name);
        printf("\t%d esh sent, %d esh received\n", esis_stat.es_eshsent,
                esis_stat.es_eshrcvd);
        printf("%s:\n", name);
        printf("\t%d esh sent, %d esh received\n", esis_stat.es_eshsent,
                esis_stat.es_eshrcvd);
@@ -96,10 +105,10 @@ esis_stats(off, name)
                esis_stat.es_ishrcvd);
        printf("\t%d rd sent, %d rd received\n", esis_stat.es_rdsent,
                esis_stat.es_rdrcvd);
                esis_stat.es_ishrcvd);
        printf("\t%d rd sent, %d rd received\n", esis_stat.es_rdsent,
                esis_stat.es_rdrcvd);
-       printf("\t%d pdus not sent due to insufficient memory\n", 
+       printf("\t%d pdus not sent due to insufficient memory\n",
                esis_stat.es_nomem);
        printf("\t%d pdus received with bad checksum\n", esis_stat.es_badcsum);
                esis_stat.es_nomem);
        printf("\t%d pdus received with bad checksum\n", esis_stat.es_badcsum);
-       printf("\t%d pdus received with bad version number\n", 
+       printf("\t%d pdus received with bad version number\n",
                esis_stat.es_badvers);
        printf("\t%d pdus received with bad type field\n", esis_stat.es_badtype);
        printf("\t%d short pdus received\n", esis_stat.es_toosmall);
                esis_stat.es_badvers);
        printf("\t%d pdus received with bad type field\n", esis_stat.es_badtype);
        printf("\t%d short pdus received\n", esis_stat.es_toosmall);
@@ -108,49 +117,51 @@ esis_stats(off, name)
 /*
  * Dump clnp statistics structure.
  */
 /*
  * Dump clnp statistics structure.
  */
+void
 clnp_stats(off, name)
 clnp_stats(off, name)
-       off_t off;
+       u_long off;
        char *name;
 {
        struct clnp_stat clnp_stat;
 
        char *name;
 {
        struct clnp_stat clnp_stat;
 
-       if (off == 0)
+       if (off == 0 ||
+           kread(off, (char *)&clnp_stat, sizeof (clnp_stat)))
                return;
                return;
-       kvm_read(off, (char *)&clnp_stat, sizeof (clnp_stat));
 
        printf("%s:\n\t%d total packets sent\n", name, clnp_stat.cns_sent);
        printf("\t%d total fragments sent\n", clnp_stat.cns_fragments);
        printf("\t%d total packets received\n", clnp_stat.cns_total);
 
        printf("%s:\n\t%d total packets sent\n", name, clnp_stat.cns_sent);
        printf("\t%d total fragments sent\n", clnp_stat.cns_fragments);
        printf("\t%d total packets received\n", clnp_stat.cns_total);
-       printf("\t%d with fixed part of header too small\n", 
+       printf("\t%d with fixed part of header too small\n",
                clnp_stat.cns_toosmall);
        printf("\t%d with header length not reasonable\n", clnp_stat.cns_badhlen);
                clnp_stat.cns_toosmall);
        printf("\t%d with header length not reasonable\n", clnp_stat.cns_badhlen);
-       printf("\t%d incorrect checksum%s\n", 
+       printf("\t%d incorrect checksum%s\n",
                clnp_stat.cns_badcsum, plural(clnp_stat.cns_badcsum));
        printf("\t%d with unreasonable address lengths\n", clnp_stat.cns_badaddr);
                clnp_stat.cns_badcsum, plural(clnp_stat.cns_badcsum));
        printf("\t%d with unreasonable address lengths\n", clnp_stat.cns_badaddr);
-       printf("\t%d with forgotten segmentation information\n", 
+       printf("\t%d with forgotten segmentation information\n",
                clnp_stat.cns_noseg);
        printf("\t%d with an incorrect protocol identifier\n", clnp_stat.cns_noproto);
        printf("\t%d with an incorrect version\n", clnp_stat.cns_badvers);
                clnp_stat.cns_noseg);
        printf("\t%d with an incorrect protocol identifier\n", clnp_stat.cns_noproto);
        printf("\t%d with an incorrect version\n", clnp_stat.cns_badvers);
-       printf("\t%d dropped because the ttl has expired\n", 
+       printf("\t%d dropped because the ttl has expired\n",
                clnp_stat.cns_ttlexpired);
        printf("\t%d clnp cache misses\n", clnp_stat.cns_cachemiss);
                clnp_stat.cns_ttlexpired);
        printf("\t%d clnp cache misses\n", clnp_stat.cns_cachemiss);
-       printf("\t%d clnp congestion experience bits set\n", 
+       printf("\t%d clnp congestion experience bits set\n",
                clnp_stat.cns_congest_set);
                clnp_stat.cns_congest_set);
-       printf("\t%d clnp congestion experience bits received\n", 
+       printf("\t%d clnp congestion experience bits received\n",
                clnp_stat.cns_congest_rcvd);
 }
 /*
  * Dump CLTP statistics structure.
  */
                clnp_stat.cns_congest_rcvd);
 }
 /*
  * Dump CLTP statistics structure.
  */
+void
 cltp_stats(off, name)
 cltp_stats(off, name)
-       off_t off;
+       u_long off;
        char *name;
 {
        struct cltpstat cltpstat;
 
        char *name;
 {
        struct cltpstat cltpstat;
 
-       if (off == 0)
+       if (off == 0 ||
+           kread(off, (char *)&cltpstat, sizeof (cltpstat)))
                return;
                return;
-       kvm_read(off, (char *)&cltpstat, sizeof (cltpstat));
        printf("%s:\n\t%u incomplete header%s\n", name,
                cltpstat.cltps_hdrops, plural(cltpstat.cltps_hdrops));
        printf("\t%u bad data length field%s\n",
        printf("%s:\n\t%u incomplete header%s\n", name,
                cltpstat.cltps_hdrops, plural(cltpstat.cltps_hdrops));
        printf("\t%u bad data length field%s\n",
@@ -163,14 +174,11 @@ struct    tp_pcb tpcb;
 struct isopcb isopcb;
 struct socket sockb;
 union  {
 struct isopcb isopcb;
 struct socket sockb;
 union  {
-struct sockaddr_iso    siso;
-char   data[128];
+       struct sockaddr_iso     siso;
+       char    data[128];
 } laddr, faddr;
 #define kget(o, p) \
 } laddr, faddr;
 #define kget(o, p) \
-       (kvm_read((off_t)(o), (char *)&p, sizeof (p)))
-extern int Aflag;
-extern int aflag;
-extern int nflag;
+       (kread((u_long)(o), (char *)&p, sizeof (p)))
 
 static int first = 1;
 
 
 static int first = 1;
 
@@ -180,8 +188,9 @@ static      int first = 1;
  * Listening processes (aflag) are suppressed unless the
  * -a (all) flag is specified.
  */
  * Listening processes (aflag) are suppressed unless the
  * -a (all) flag is specified.
  */
+void
 iso_protopr(off, name)
 iso_protopr(off, name)
-       off_t off;
+       u_long off;
        char *name;
 {
        struct isopcb cb;
        char *name;
 {
        struct isopcb cb;
@@ -191,9 +200,12 @@ iso_protopr(off, name)
                printf("%s control block: symbol not in namelist\n", name);
                return;
        }
                printf("%s control block: symbol not in namelist\n", name);
                return;
        }
-       if (strcmp(name, "tp") == 0)
-               return tp_protopr(off, name);
-       kget(off, cb);
+       if (strcmp(name, "tp") == 0) {
+               tp_protopr(off, name);
+               return;
+       }
+       if (kread(off, (char *)&cb, sizeof(cb)))
+               return;
        isopcb = cb;
        prev = (struct isopcb *)off;
        if (isopcb.isop_next == (struct isopcb *)off)
        isopcb = cb;
        prev = (struct isopcb *)off;
        if (isopcb.isop_next == (struct isopcb *)off)
@@ -207,14 +219,16 @@ iso_protopr(off, name)
                        break;
                }
                kget(isopcb.isop_socket, sockb);
                        break;
                }
                kget(isopcb.isop_socket, sockb);
-               iso_protopr1((off_t)next, 0);
+               iso_protopr1((u_long)next, 0);
                putchar('\n');
                prev = next;
        }
 }
 
                putchar('\n');
                prev = next;
        }
 }
 
+void
 iso_protopr1(kern_addr, istp)
 iso_protopr1(kern_addr, istp)
-off_t kern_addr;
+       u_long kern_addr;
+       int istp;
 {
        if (first) {
                printf("Active ISO net connections");
 {
        if (first) {
                printf("Active ISO net connections");
@@ -232,7 +246,7 @@ off_t kern_addr;
        }
        if (Aflag)
                        printf("%8x ",
        }
        if (Aflag)
                        printf("%8x ",
-                                       (sockb.so_pcb ? (off_t)sockb.so_pcb : (off_t)kern_addr));
+                                       (sockb.so_pcb ? (void *)sockb.so_pcb : (void *)kern_addr));
        printf("%-5.5s %6d %6d ", "tp", sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc);
        if (istp && tpcb.tp_lsuffixlen) {
                        hexprint(tpcb.tp_lsuffixlen, tpcb.tp_lsuffix, "()");
        printf("%-5.5s %6d %6d ", "tp", sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc);
        if (istp && tpcb.tp_lsuffixlen) {
                        hexprint(tpcb.tp_lsuffixlen, tpcb.tp_lsuffix, "()");
@@ -245,7 +259,7 @@ off_t kern_addr;
                                        laddr.siso = isopcb.isop_sladdr;
                        else
                                        kget(isopcb.isop_laddr, laddr);
                                        laddr.siso = isopcb.isop_sladdr;
                        else
                                        kget(isopcb.isop_laddr, laddr);
-                       isonetprint(&laddr, 1);
+                       isonetprint((struct sockaddr_iso *)&laddr, 1);
        }
        if (istp && tpcb.tp_fsuffixlen) {
                        hexprint(tpcb.tp_fsuffixlen, tpcb.tp_fsuffix, "()");
        }
        if (istp && tpcb.tp_fsuffixlen) {
                        hexprint(tpcb.tp_fsuffixlen, tpcb.tp_fsuffix, "()");
@@ -258,14 +272,16 @@ off_t kern_addr;
                        faddr.siso = isopcb.isop_sfaddr;
                else
                        kget(isopcb.isop_faddr, faddr);
                        faddr.siso = isopcb.isop_sfaddr;
                else
                        kget(isopcb.isop_faddr, faddr);
-               isonetprint(&faddr, 0);
+               isonetprint((struct sockaddr_iso *)&faddr, 0);
        }
 }
 
        }
 }
 
+void
 tp_protopr(off, name)
 tp_protopr(off, name)
-off_t off;
-char *name;
+       u_long off;
+       char *name;
 {
 {
+       extern char *tp_sstring[];
        struct tp_ref *tpr, *tpr_base;
        struct tp_refinfo tpkerninfo;
        int size;
        struct tp_ref *tpr, *tpr_base;
        struct tp_refinfo tpkerninfo;
        int size;
@@ -275,7 +291,7 @@ char *name;
        tpr_base = (struct tp_ref *)malloc(size);
        if (tpr_base == 0)
                return;
        tpr_base = (struct tp_ref *)malloc(size);
        if (tpr_base == 0)
                return;
-       kvm_read((off_t)(tpkerninfo.tpr_base), (char *)tpr_base, size);
+       kread((u_long)(tpkerninfo.tpr_base), (char *)tpr_base, size);
        for (tpr = tpr_base; tpr < tpr_base + tpkerninfo.tpr_size; tpr++) {
                if (tpr->tpr_pcb == 0)
                        continue;
        for (tpr = tpr_base; tpr < tpr_base + tpkerninfo.tpr_size; tpr++) {
                if (tpr->tpr_pcb == 0)
                        continue;
@@ -291,11 +307,11 @@ char *name;
                kget(tpcb.tp_sock, sockb);
                if (tpcb.tp_npcb) switch(tpcb.tp_netservice) {
                        case IN_CLNS:
                kget(tpcb.tp_sock, sockb);
                if (tpcb.tp_npcb) switch(tpcb.tp_netservice) {
                        case IN_CLNS:
-                               tp_inproto(tpkerninfo.tpr_base);
+                               tp_inproto((u_long)tpkerninfo.tpr_base);
                                break;
                        default:
                                kget(tpcb.tp_npcb, isopcb);
                                break;
                        default:
                                kget(tpcb.tp_npcb, isopcb);
-                               iso_protopr1(tpcb.tp_npcb, 1);
+                               iso_protopr1((u_long)tpcb.tp_npcb, 1);
                                break;
                }
                if (tpcb.tp_state >= tp_NSTATES)
                                break;
                }
                if (tpcb.tp_state >= tp_NSTATES)
@@ -305,8 +321,10 @@ char *name;
                putchar('\n');
        }
 }
                putchar('\n');
        }
 }
+
+void
 tp_inproto(pcb)
 tp_inproto(pcb)
-off_t pcb;
+       u_long pcb;
 {
        struct inpcb inpcb;
        kget(tpcb.tp_npcb, inpcb);
 {
        struct inpcb inpcb;
        kget(tpcb.tp_npcb, inpcb);
@@ -314,10 +332,12 @@ off_t pcb;
                return;
        if (Aflag)
                printf("%8x ", pcb);
                return;
        if (Aflag)
                printf("%8x ", pcb);
-       printf("%-5.5s %6d %6d ", "tpip", sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc);
+       printf("%-5.5s %6d %6d ", "tpip",
+           sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc);
        inetprint(&inpcb.inp_laddr, inpcb.inp_lport, "tp");
        inetprint(&inpcb.inp_faddr, inpcb.inp_fport, "tp");
 }
        inetprint(&inpcb.inp_laddr, inpcb.inp_lport, "tp");
        inetprint(&inpcb.inp_faddr, inpcb.inp_fport, "tp");
 }
+
 /*
  * Pretty print an iso address (net address + port).
  * If the nflag was specified, use numbers instead of names.
 /*
  * Pretty print an iso address (net address + port).
  * If the nflag was specified, use numbers instead of names.
@@ -334,7 +354,6 @@ isonetname(iso)
        struct iso_hostent *iso_getserventrybytsel();
        struct iso_hostent Ihe;
        static char line[80];
        struct iso_hostent *iso_getserventrybytsel();
        struct iso_hostent Ihe;
        static char line[80];
-       char *index();
 
        bzero(line, sizeof(line));
        if( iso->isoa_afi ) {
 
        bzero(line, sizeof(line));
        if( iso->isoa_afi ) {
@@ -357,6 +376,7 @@ isonetname(iso)
        return line;
 }
 
        return line;
 }
 
+static void
 isonetprint(iso, sufx, sufxlen, islocal)
        register struct iso_addr *iso;
        char *sufx;
 isonetprint(iso, sufx, sufxlen, islocal)
        register struct iso_addr *iso;
        char *sufx;
@@ -365,7 +385,7 @@ isonetprint(iso, sufx, sufxlen, islocal)
 {
        struct iso_hostent *iso_getserventrybytsel(), *ihe;
        struct iso_hostent Ihe;
 {
        struct iso_hostent *iso_getserventrybytsel(), *ihe;
        struct iso_hostent Ihe;
-       char *line, *cp, *index();
+       char *line, *cp;
        int Alen = Aflag?18:22;
 
        line =  isonetname(iso);
        int Alen = Aflag?18:22;
 
        line =  isonetname(iso);
@@ -374,7 +394,7 @@ isonetprint(iso, sufx, sufxlen, islocal)
 
        if( islocal )
                islocal = 20;
 
        if( islocal )
                islocal = 20;
-       else 
+       else
                islocal = 22 + Alen;
 
        if(Aflag)
                islocal = 22 + Alen;
 
        if(Aflag)
@@ -414,8 +434,9 @@ isonetprint(iso, sufx, sufxlen, islocal)
 #endif
 
 #ifdef notdef
 #endif
 
 #ifdef notdef
+static void
 x25_protopr(off, name)
 x25_protopr(off, name)
-       off_t off;
+       u_long off;
        char *name;
 {
        static char *xpcb_states[] = {
        char *name;
 {
        static char *xpcb_states[] = {
@@ -433,18 +454,18 @@ x25_protopr(off, name)
                printf("%s control block: symbol not in namelist\n", name);
                return;
        }
                printf("%s control block: symbol not in namelist\n", name);
                return;
        }
-       kvm_read(off, &xpcb, sizeof (struct x25_pcb));
+       kread(off, &xpcb, sizeof (struct x25_pcb));
        prev = (struct isopcb *)off;
        if (xpcb.x_next == (struct isopcb *)off)
                return;
        while (xpcb.x_next != (struct isopcb *)off) {
                next = isopcb.isop_next;
        prev = (struct isopcb *)off;
        if (xpcb.x_next == (struct isopcb *)off)
                return;
        while (xpcb.x_next != (struct isopcb *)off) {
                next = isopcb.isop_next;
-               kvm_read((off_t)next, &xpcb, sizeof (struct x25_pcb));
+               kread((u_long)next, &xpcb, sizeof (struct x25_pcb));
                if (xpcb.x_prev != prev) {
                        printf("???\n");
                        break;
                }
                if (xpcb.x_prev != prev) {
                        printf("???\n");
                        break;
                }
-               kvm_read((off_t)xpcb.x_socket, &sockb, sizeof (sockb));
+               kread((u_long)xpcb.x_socket, &sockb, sizeof (sockb));
 
                if (!aflag &&
                        xpcb.x_state == LISTENING ||
 
                if (!aflag &&
                        xpcb.x_state == LISTENING ||
@@ -468,9 +489,9 @@ x25_protopr(off, name)
                }
                printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc,
                        sockb.so_snd.sb_cc);
                }
                printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc,
                        sockb.so_snd.sb_cc);
-               isonetprint(&xpcb.x_laddr.siso_addr, &xpcb.x_lport, 
+               isonetprint(&xpcb.x_laddr.siso_addr, &xpcb.x_lport,
                        sizeof(xpcb.x_lport), 1);
                        sizeof(xpcb.x_lport), 1);
-               isonetprint(&xpcb.x_faddr.siso_addr, &xpcb.x_fport, 
+               isonetprint(&xpcb.x_faddr.siso_addr, &xpcb.x_fport,
                        sizeof(xpcb.x_lport), 0);
                if (xpcb.x_state < 0 || xpcb.x_state >= x25_NSTATES)
                        printf(" 0x0x0x0x0x0x0x0x0x%x", xpcb.x_state);
                        sizeof(xpcb.x_lport), 0);
                if (xpcb.x_state < 0 || xpcb.x_state >= x25_NSTATES)
                        printf(" 0x0x0x0x0x0x0x0x0x%x", xpcb.x_state);
@@ -484,8 +505,9 @@ x25_protopr(off, name)
 
 struct tp_stat tp_stat;
 
 
 struct tp_stat tp_stat;
 
+void
 tp_stats(off, name)
 tp_stats(off, name)
-caddr_t off, name;
+       caddr_t off, name;
 {
        if (off == 0) {
                printf("TP not configured\n\n");
 {
        if (off == 0) {
                printf("TP not configured\n\n");
@@ -498,11 +520,10 @@ caddr_t off, name;
 
 #define OUT stdout
 
 
 #define OUT stdout
 
-#define plural(x) (x>1?"s":"")
-
+static void
 tprintstat(s, indent)
 tprintstat(s, indent)
-register struct tp_stat *s;
-int indent;
+       register struct tp_stat *s;
+       int indent;
 {
        fprintf(OUT,
                "%*sReceiving:\n",indent," ");
 {
        fprintf(OUT,
                "%*sReceiving:\n",indent," ");
@@ -573,7 +594,7 @@ int indent;
                "\t%*s%d cluster%s\n", indent, " ",
                s->ts_mb_cluster, plural(s->ts_mb_cluster));
        fprintf(OUT,
                "\t%*s%d cluster%s\n", indent, " ",
                s->ts_mb_cluster, plural(s->ts_mb_cluster));
        fprintf(OUT,
-               "\t%*s%d source quench \n",indent, " ", 
+               "\t%*s%d source quench \n",indent, " ",
                s->ts_quench);
        fprintf(OUT,
                "\t%*s%d dec bit%s\n", indent, " ",
                s->ts_quench);
        fprintf(OUT,
                "\t%*s%d dec bit%s\n", indent, " ",
@@ -621,10 +642,35 @@ int indent;
        fprintf(OUT,
                "\t%*s%d tp 0 connection%s\n",  indent, " ",
                s->ts_tp0_conn ,plural(s->ts_tp0_conn));
        fprintf(OUT,
                "\t%*s%d tp 0 connection%s\n",  indent, " ",
                s->ts_tp0_conn ,plural(s->ts_tp0_conn));
+    {
+               register int j;
+               static char *name[]= {
+                       "~LOCAL, PDN",
+                       "~LOCAL,~PDN",
+                       " LOCAL,~PDN",
+                       " LOCAL, PDN"
+               };
+
+               fprintf(OUT,
+                       "\n%*sRound trip times, listed in ticks:\n", indent, " ");
+               fprintf(OUT,
+                       "\t%*s%11.11s  %12.12s | %12.12s | %s\n", indent, " ",
+                               "Category",
+                               "Smoothed avg", "Deviation", "Deviation/Avg");
+               for (j = 0; j <= 3; j++) {
+                       fprintf(OUT,
+                               "\t%*s%11.11s: %-11d | %-11d | %-11d | %-11d\n", indent, " ",
+                               name[j],
+                               s->ts_rtt[j],
+                               s->ts_rtt[j],
+                               s->ts_rtv[j],
+                               s->ts_rtv[j]);
+               }
+       }
        fprintf(OUT,
 "\n%*sTpdus RECVD [%d valid, %3.6f %% of total (%d); %d dropped]\n",indent," ",
                s->ts_tpdu_rcvd ,
        fprintf(OUT,
 "\n%*sTpdus RECVD [%d valid, %3.6f %% of total (%d); %d dropped]\n",indent," ",
                s->ts_tpdu_rcvd ,
-               ((s->ts_pkt_rcvd > 0) ? 
+               ((s->ts_pkt_rcvd > 0) ?
                        ((100 * (float)s->ts_tpdu_rcvd)/(float)s->ts_pkt_rcvd)
                        : 0),
                s->ts_pkt_rcvd,
                        ((100 * (float)s->ts_tpdu_rcvd)/(float)s->ts_pkt_rcvd)
                        : 0),
                s->ts_pkt_rcvd,
@@ -664,7 +710,7 @@ int indent;
        "\t%*sXPD %6d (%5.2f%%)\n",  indent, " ",
                s->ts_retrans_xpd,
                PERCENT(s->ts_retrans_xpd, s->ts_XPD_sent));
        "\t%*sXPD %6d (%5.2f%%)\n",  indent, " ",
                s->ts_retrans_xpd,
                PERCENT(s->ts_retrans_xpd, s->ts_XPD_sent));
-       
+
 
        fprintf(OUT,
                "\n%*sE Timers: [%6d ticks]\n", indent, " ", s->ts_Eticks);
 
        fprintf(OUT,
                "\n%*sE Timers: [%6d ticks]\n", indent, " ", s->ts_Eticks);
@@ -705,30 +751,31 @@ int indent;
        fprintf(OUT,
                "\n%*sACK reasons:\n", indent, " ");
        fprintf(OUT, "\t%*s%6d not acked immediately\n", indent, " ",
        fprintf(OUT,
                "\n%*sACK reasons:\n", indent, " ");
        fprintf(OUT, "\t%*s%6d not acked immediately\n", indent, " ",
-                                                                               s->ts_ackreason[_ACK_DONT_] );
+               s->ts_ackreason[_ACK_DONT_] );
        fprintf(OUT, "\t%*s%6d strategy==each\n", indent, " ",
        fprintf(OUT, "\t%*s%6d strategy==each\n", indent, " ",
-                                                                               s->ts_ackreason[_ACK_STRAT_EACH_] );
+               s->ts_ackreason[_ACK_STRAT_EACH_] );
        fprintf(OUT, "\t%*s%6d strategy==fullwindow\n", indent, " ",
        fprintf(OUT, "\t%*s%6d strategy==fullwindow\n", indent, " ",
-                                                                               s->ts_ackreason[_ACK_STRAT_FULLWIN_] );
+               s->ts_ackreason[_ACK_STRAT_FULLWIN_] );
        fprintf(OUT, "\t%*s%6d duplicate DT\n", indent, " ",
        fprintf(OUT, "\t%*s%6d duplicate DT\n", indent, " ",
-                                                                               s->ts_ackreason[_ACK_DUP_] );
+               s->ts_ackreason[_ACK_DUP_] );
        fprintf(OUT, "\t%*s%6d EOTSDU\n", indent, " ",
        fprintf(OUT, "\t%*s%6d EOTSDU\n", indent, " ",
-                                                                               s->ts_ackreason[_ACK_EOT_] );
+               s->ts_ackreason[_ACK_EOT_] );
        fprintf(OUT, "\t%*s%6d reordered DT\n", indent, " ",
        fprintf(OUT, "\t%*s%6d reordered DT\n", indent, " ",
-                                                                               s->ts_ackreason[_ACK_REORDER_] );
+               s->ts_ackreason[_ACK_REORDER_] );
        fprintf(OUT, "\t%*s%6d user rcvd\n", indent, " ",
        fprintf(OUT, "\t%*s%6d user rcvd\n", indent, " ",
-                                                                               s->ts_ackreason[_ACK_USRRCV_] );
-       fprintf(OUT, "\t%*s%6d fcc reqd\n",     indent, " ",
-                                                                               s->ts_ackreason[_ACK_FCC_] );
+               s->ts_ackreason[_ACK_USRRCV_] );
+       fprintf(OUT, "\t%*s%6d fcc reqd\n", indent, " ",
+               s->ts_ackreason[_ACK_FCC_] );
 }
 #ifndef SSEL
 #define SSEL(s) ((s)->siso_tlen + TSEL(s))
 #define PSEL(s) ((s)->siso_slen + SSEL(s))
 #endif
 
 }
 #ifndef SSEL
 #define SSEL(s) ((s)->siso_tlen + TSEL(s))
 #define PSEL(s) ((s)->siso_slen + SSEL(s))
 #endif
 
+static void
 isonetprint(siso, islocal)
 isonetprint(siso, islocal)
-register struct sockaddr_iso *siso;
-int islocal;
+       register struct sockaddr_iso *siso;
+       int islocal;
 {
        hexprint(siso->siso_nlen, siso->siso_addr.isoa_genaddr, "{}");
        if (siso->siso_tlen || siso->siso_slen || siso->siso_plen)
 {
        hexprint(siso->siso_nlen, siso->siso_addr.isoa_genaddr, "{}");
        if (siso->siso_tlen || siso->siso_slen || siso->siso_plen)
@@ -739,10 +786,13 @@ int islocal;
                hexprint(siso->siso_plen, PSEL(siso), "<>");
        putchar(' ');
 }
                hexprint(siso->siso_plen, PSEL(siso), "<>");
        putchar(' ');
 }
+
 static char hexlist[] = "0123456789abcdef", obuf[128];
 
 static char hexlist[] = "0123456789abcdef", obuf[128];
 
+static void
 hexprint(n, buf, delim)
 hexprint(n, buf, delim)
-char *buf, *delim;
+       int n;
+       char *buf, *delim;
 {
        register u_char *in = (u_char *)buf, *top = in + n;
        register char *out = obuf;
 {
        register u_char *in = (u_char *)buf, *top = in + n;
        register char *out = obuf;