Annotation of 43BSDReno/sys/netns/spp_debug.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1984, 1985, 1986, 1987 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution is only permitted until one year after the first shipment
        !             6:  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
        !             7:  * binary forms are permitted provided that: (1) source distributions retain
        !             8:  * this entire copyright notice and comment, and (2) distributions including
        !             9:  * binaries display the following acknowledgement:  This product includes
        !            10:  * software developed by the University of California, Berkeley and its
        !            11:  * contributors'' in the documentation or other materials provided with the
        !            12:  * distribution and in all advertising materials mentioning features or use
        !            13:  * of this software.  Neither the name of the University nor the names of
        !            14:  * its contributors may be used to endorse or promote products derived from
        !            15:  * this software without specific prior written permission.
        !            16:  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            17:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            18:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            19:  *
        !            20:  *     @(#)spp_debug.c 7.7 (Berkeley) 6/28/90
        !            21:  */
        !            22: 
        !            23: #include "param.h"
        !            24: #include "systm.h"
        !            25: #include "mbuf.h"
        !            26: #include "socket.h"
        !            27: #include "socketvar.h"
        !            28: #include "protosw.h"
        !            29: #include "errno.h"
        !            30: 
        !            31: #include "../net/route.h"
        !            32: #include "../net/if.h"
        !            33: #include "../netinet/tcp_fsm.h"
        !            34: 
        !            35: #include "ns.h"
        !            36: #include "ns_pcb.h"
        !            37: #include "idp.h"
        !            38: #include "idp_var.h"
        !            39: #include "sp.h"
        !            40: #include "spidp.h"
        !            41: #define SPPTIMERS
        !            42: #include "spp_timer.h"
        !            43: #include "spp_var.h"
        !            44: #define        SANAMES
        !            45: #include "spp_debug.h"
        !            46: 
        !            47: int    sppconsdebug = 0;
        !            48: /*
        !            49:  * spp debug routines
        !            50:  */
        !            51: spp_trace(act, ostate, sp, si, req)
        !            52:        short act;
        !            53:        u_char ostate;
        !            54:        struct sppcb *sp;
        !            55:        struct spidp *si;
        !            56:        int req;
        !            57: {
        !            58: #ifdef INET
        !            59: #ifdef TCPDEBUG
        !            60:        u_short seq, ack, len, alo;
        !            61:        unsigned long iptime();
        !            62:        int flags;
        !            63:        struct spp_debug *sd = &spp_debug[spp_debx++];
        !            64:        extern char *prurequests[];
        !            65:        extern char *sanames[];
        !            66:        extern char *tcpstates[];
        !            67:        extern char *spptimers[];
        !            68: 
        !            69:        if (spp_debx == SPP_NDEBUG)
        !            70:                spp_debx = 0;
        !            71:        sd->sd_time = iptime();
        !            72:        sd->sd_act = act;
        !            73:        sd->sd_ostate = ostate;
        !            74:        sd->sd_cb = (caddr_t)sp;
        !            75:        if (sp)
        !            76:                sd->sd_sp = *sp;
        !            77:        else
        !            78:                bzero((caddr_t)&sd->sd_sp, sizeof (*sp));
        !            79:        if (si)
        !            80:                sd->sd_si = *si;
        !            81:        else
        !            82:                bzero((caddr_t)&sd->sd_si, sizeof (*si));
        !            83:        sd->sd_req = req;
        !            84:        if (sppconsdebug == 0)
        !            85:                return;
        !            86:        if (ostate >= TCP_NSTATES) ostate = 0;
        !            87:        if (act >= SA_DROP) act = SA_DROP;
        !            88:        if (sp)
        !            89:                printf("%x %s:", sp, tcpstates[ostate]);
        !            90:        else
        !            91:                printf("???????? ");
        !            92:        printf("%s ", sanames[act]);
        !            93:        switch (act) {
        !            94: 
        !            95:        case SA_RESPOND:
        !            96:        case SA_INPUT:
        !            97:        case SA_OUTPUT:
        !            98:        case SA_DROP:
        !            99:                if (si == 0)
        !           100:                        break;
        !           101:                seq = si->si_seq;
        !           102:                ack = si->si_ack;
        !           103:                alo = si->si_alo;
        !           104:                len = si->si_len;
        !           105:                if (act == SA_OUTPUT) {
        !           106:                        seq = ntohs(seq);
        !           107:                        ack = ntohs(ack);
        !           108:                        alo = ntohs(alo);
        !           109:                        len = ntohs(len);
        !           110:                }
        !           111: #ifndef lint
        !           112: #define p1(f)  { printf("%s = %x, ", "f", f); }
        !           113:                p1(seq); p1(ack); p1(alo); p1(len);
        !           114: #endif
        !           115:                flags = si->si_cc;
        !           116:                if (flags) {
        !           117:                        char *cp = "<";
        !           118: #ifndef lint
        !           119: #define pf(f) { if (flags&SP_/**/f) { printf("%s%s", cp, "f"); cp = ","; } }
        !           120:                        pf(SP); pf(SA); pf(OB); pf(EM);
        !           121: #else
        !           122:                        cp = cp;
        !           123: #endif
        !           124:                        printf(">");
        !           125:                }
        !           126: #ifndef lint
        !           127: #define p2(f)  { printf("%s = %x, ", "f", si->si_/**/f); }
        !           128:                p2(sid);p2(did);p2(dt);p2(pt);
        !           129: #endif
        !           130:                ns_printhost(&si->si_sna);
        !           131:                ns_printhost(&si->si_dna);
        !           132: 
        !           133:                if (act==SA_RESPOND) {
        !           134:                        printf("idp_len = %x, ",
        !           135:                                ((struct idp *)si)->idp_len);
        !           136:                }
        !           137:                break;
        !           138: 
        !           139:        case SA_USER:
        !           140:                printf("%s", prurequests[req&0xff]);
        !           141:                if ((req & 0xff) == PRU_SLOWTIMO)
        !           142:                        printf("<%s>", spptimers[req>>8]);
        !           143:                break;
        !           144:        }
        !           145:        if (sp)
        !           146:                printf(" -> %s", tcpstates[sp->s_state]);
        !           147:        /* print out internal state of sp !?! */
        !           148:        printf("\n");
        !           149:        if (sp == 0)
        !           150:                return;
        !           151: #ifndef lint
        !           152: #define p3(f)  { printf("%s = %x, ", "f", sp->s_/**/f); }
        !           153:        printf("\t"); p3(rack);p3(ralo);p3(smax);p3(flags); printf("\n");
        !           154: #endif
        !           155: #endif
        !           156: #endif
        !           157: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.