minor other leres-like changes but this branch didn't include 5.7
[unix-history] / usr / src / usr.bin / netstat / iso.c
index fa664af..4e3a22b 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)iso.c      5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)iso.c      5.9 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -18,13 +18,13 @@ static char sccsid[] = "@(#)iso.c   5.7 (Berkeley) %G%";
 
                       All Rights Reserved
 
 
                       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
@@ -50,11 +50,6 @@ SOFTWARE.
 #include <errno.h>
 #include <net/if.h>
 #include <net/route.h>
 #include <errno.h>
 #include <net/if.h>
 #include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/in_pcb.h>
-#include <netinet/ip_var.h>
 #include <netiso/iso.h>
 #include <netiso/iso_errno.h>
 #include <netiso/clnp.h>
 #include <netiso/iso.h>
 #include <netiso/iso_errno.h>
 #include <netiso/clnp.h>
@@ -75,20 +70,27 @@ SOFTWARE.
 #endif
 #include <netiso/cons_pcb.h>
 #include <netdb.h>
 #endif
 #include <netiso/cons_pcb.h>
 #include <netdb.h>
+#include <string.h>
+#include <stdio.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 *));
 
 /*
  *     Dump esis stats
  */
 
 /*
  *     Dump esis stats
  */
+void
 esis_stats(off, name)
        off_t   off;
        char    *name;
 {
        struct esis_stat esis_stat;
 
 esis_stats(off, name)
        off_t   off;
        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 +98,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 +110,51 @@ esis_stats(off, name)
 /*
  * Dump clnp statistics structure.
  */
 /*
  * Dump clnp statistics structure.
  */
+void
 clnp_stats(off, name)
        off_t off;
        char *name;
 {
        struct clnp_stat clnp_stat;
 
 clnp_stats(off, name)
        off_t off;
        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)
        off_t off;
        char *name;
 {
        struct cltpstat cltpstat;
 
 cltp_stats(off, name)
        off_t off;
        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 +167,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((off_t)(o), (char *)&p, sizeof (p)))
 
 static int first = 1;
 
 
 static int first = 1;
 
@@ -180,20 +181,21 @@ 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)
        off_t off;
        char *name;
 {
        struct isopcb cb;
        register struct isopcb *prev, *next;
 iso_protopr(off, name)
        off_t off;
        char *name;
 {
        struct isopcb cb;
        register struct isopcb *prev, *next;
+       int istp = (strcmp(name, "tp") == 0);
 
        if (off == 0) {
                printf("%s control block: symbol not in namelist\n", name);
                return;
        }
 
        if (off == 0) {
                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 (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,117 +209,68 @@ iso_protopr(off, name)
                        break;
                }
                kget(isopcb.isop_socket, sockb);
                        break;
                }
                kget(isopcb.isop_socket, sockb);
-               iso_protopr1((off_t)next, 0);
-               putchar('\n');
-               prev = next;
-       }
-}
-
-iso_protopr1(kern_addr, istp)
-off_t kern_addr;
-{
-       if (first) {
-               printf("Active ISO net connections");
-               if (aflag)
-                       printf(" (including servers)");
-               putchar('\n');
+               if (istp) {
+                       kget(sockb.so_tpcb, tpcb);
+                       if (tpcb.tp_state == ST_ERROR)
+                               fprintf(stderr,"addr: 0x%x, prev 0x%x\n", next, prev);
+                       if (!aflag &&
+                               tpcb.tp_state == TP_LISTENING ||
+                               tpcb.tp_state == TP_CLOSED ||
+                               tpcb.tp_state == TP_REFWAIT) {
+                               prev = next;
+                               continue;
+                       }
+               }
+               if (first) {
+                       printf("Active ISO net connections");
+                       if (aflag)
+                               printf(" (including servers)");
+                       putchar('\n');
+                       if (Aflag)
+                               printf("%-8.8s ", "PCB");
+                       printf(Aflag ?
+                               "%-5.5s %-6.6s %-6.6s  %-18.18s %-18.18s %s\n" :
+                               "%-5.5s %-6.6s %-6.6s  %-22.22s %-22.22s %s\n",
+                               "Proto", "Recv-Q", "Send-Q",
+                               "Local Address", "Foreign Address", "(state)");
+                       first = 0;
+               }
                if (Aflag)
                if (Aflag)
-                       printf("%-8.8s ", "PCB");
-               printf(Aflag ?
-                       "%-5.5s %-6.6s %-6.6s  %-18.18s %-18.18s %s\n" :
-                       "%-5.5s %-6.6s %-6.6s  %-22.22s %-22.22s %s\n",
-                       "Proto", "Recv-Q", "Send-Q",
-                       "Local Address", "Foreign Address", "(state)");
-               first = 0;
-       }
-       if (Aflag)
                        printf("%8x ",
                        printf("%8x ",
-                                       (sockb.so_pcb ? (off_t)sockb.so_pcb : (off_t)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("\t");
-       } else if (isopcb.isop_laddr == 0)
+                               (istp ? (off_t)sockb.so_tpcb : (off_t)next));
+               printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc,
+                       sockb.so_snd.sb_cc);
+               if (isopcb.isop_laddr == 0)
                        printf("*.*\t");
                        printf("*.*\t");
-       else {
-                       if ((char *)isopcb.isop_laddr == ((char *)kern_addr) +
-                                       _offsetof(struct isopcb, isop_sladdr))
-                                       laddr.siso = isopcb.isop_sladdr;
+               else {
+                       if ((char *)isopcb.isop_laddr == ((char *)next) +
+                               _offsetof(struct isopcb, isop_sladdr))
+                               laddr.siso = isopcb.isop_sladdr;
                        else
                        else
-                                       kget(isopcb.isop_laddr, laddr);
-                       isonetprint(&laddr, 1);
-       }
-       if (istp && tpcb.tp_fsuffixlen) {
-                       hexprint(tpcb.tp_fsuffixlen, tpcb.tp_fsuffix, "()");
-                       printf("\t");
-       } else if (isopcb.isop_faddr == 0)
-               printf("*.*\t");
-       else {
-               if ((char *)isopcb.isop_faddr == ((char *)kern_addr) +
-                       _offsetof(struct isopcb, isop_sfaddr))
-                       faddr.siso = isopcb.isop_sfaddr;
-               else
-                       kget(isopcb.isop_faddr, faddr);
-               isonetprint(&faddr, 0);
-       }
-}
-
-tp_protopr(off, name)
-off_t off;
-char *name;
-{
-       struct tp_ref *tpr, *tpr_base;
-       struct tp_refinfo tpkerninfo;
-       int size;
-
-       kget(off, tpkerninfo);
-       size = tpkerninfo.tpr_size * sizeof (*tpr);
-       tpr_base = (struct tp_ref *)malloc(size);
-       if (tpr_base == 0)
-               return;
-       kvm_read((off_t)(tpkerninfo.tpr_base), (char *)tpr_base, size);
-       for (tpr = tpr_base; tpr < tpr_base + tpkerninfo.tpr_size; tpr++) {
-               if (tpr->tpr_pcb == 0)
-                       continue;
-               kget(tpr->tpr_pcb, tpcb);
-               if (tpcb.tp_state == ST_ERROR)
-                       printf("undefined tpcb state: 0x%x\n", tpr->tpr_pcb);
-               if (!aflag &&
-                       (tpcb.tp_state == TP_LISTENING ||
-                        tpcb.tp_state == TP_CLOSED ||
-                        tpcb.tp_state == TP_REFWAIT)) {
-                       continue;
+                               kget(isopcb.isop_laddr, laddr);
+                       isonetprint((struct sockaddr_iso *)&laddr, 1);
                }
                }
-               kget(tpcb.tp_sock, sockb);
-               if (tpcb.tp_npcb) switch(tpcb.tp_netservice) {
-                       case IN_CLNS:
-                               tp_inproto(tpkerninfo.tpr_base);
-                               break;
-                       default:
-                               kget(tpcb.tp_npcb, isopcb);
-                               iso_protopr1(tpcb.tp_npcb, 1);
-                               break;
+               if (isopcb.isop_faddr == 0)
+                       printf("*.*\t");
+               else {
+                       if ((char *)isopcb.isop_faddr == ((char *)next) +
+                               _offsetof(struct isopcb, isop_sfaddr))
+                               faddr.siso = isopcb.isop_sfaddr;
+                       else
+                               kget(isopcb.isop_faddr, faddr);
+                       isonetprint((struct sockaddr_iso *)&faddr, 0);
+               }
+               if (istp) {
+                       if (tpcb.tp_state >= tp_NSTATES)
+                               printf(" %d", tpcb.tp_state);
+                       else
+                               printf(" %-12.12s", tp_sstring[tpcb.tp_state]);
                }
                }
-               if (tpcb.tp_state >= tp_NSTATES)
-                       printf(" %d", tpcb.tp_state);
-               else
-                       printf(" %-12.12s", tp_sstring[tpcb.tp_state]);
                putchar('\n');
                putchar('\n');
+               prev = next;
        }
 }
        }
 }
-tp_inproto(pcb)
-off_t pcb;
-{
-       struct inpcb inpcb;
-       kget(tpcb.tp_npcb, inpcb);
-       if (!aflag && inet_lnaof(inpcb.inp_laddr) == INADDR_ANY)
-               return;
-       if (Aflag)
-               printf("%8x ", pcb);
-       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");
-}
+
 /*
  * 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 +287,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 +309,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 +318,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 +327,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,6 +367,7 @@ isonetprint(iso, sufx, sufxlen, islocal)
 #endif
 
 #ifdef notdef
 #endif
 
 #ifdef notdef
+static void
 x25_protopr(off, name)
        off_t off;
        char *name;
 x25_protopr(off, name)
        off_t off;
        char *name;
@@ -433,18 +387,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((off_t)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((off_t)xpcb.x_socket, &sockb, sizeof (sockb));
 
                if (!aflag &&
                        xpcb.x_state == LISTENING ||
 
                if (!aflag &&
                        xpcb.x_state == LISTENING ||
@@ -468,9 +422,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 +438,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 +453,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 +527,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 +575,36 @@ 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, div;
+               register float f;
+               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 +644,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);
@@ -718,7 +698,7 @@ int indent;
                                                                                s->ts_ackreason[_ACK_REORDER_] );
        fprintf(OUT, "\t%*s%6d user rcvd\n", indent, " ",
                                                                                s->ts_ackreason[_ACK_USRRCV_] );
                                                                                s->ts_ackreason[_ACK_REORDER_] );
        fprintf(OUT, "\t%*s%6d user rcvd\n", indent, " ",
                                                                                s->ts_ackreason[_ACK_USRRCV_] );
-       fprintf(OUT, "\t%*s%6d fcc reqd\n",     indent, " ",
+       fprintf(OUT, "\t%*s%6d fcc reqd\n", indent, " ",
                                                                                s->ts_ackreason[_ACK_FCC_] );
 }
 #ifndef SSEL
                                                                                s->ts_ackreason[_ACK_FCC_] );
 }
 #ifndef SSEL
@@ -726,9 +706,10 @@ int indent;
 #define PSEL(s) ((s)->siso_slen + SSEL(s))
 #endif
 
 #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)
@@ -741,8 +722,10 @@ int islocal;
 }
 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;