|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1984, 1985, 1986, 1987 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms, with or without ! 6: * modification, are permitted provided that the following conditions ! 7: * are met: ! 8: * 1. Redistributions of source code must retain the above copyright ! 9: * notice, this list of conditions and the following disclaimer. ! 10: * 2. Redistributions in binary form must reproduce the above copyright ! 11: * notice, this list of conditions and the following disclaimer in the ! 12: * documentation and/or other materials provided with the distribution. ! 13: * 3. All advertising materials mentioning features or use of this software ! 14: * must display the following acknowledgement: ! 15: * This product includes software developed by the University of ! 16: * California, Berkeley and its contributors. ! 17: * 4. Neither the name of the University nor the names of its contributors ! 18: * may be used to endorse or promote products derived from this software ! 19: * without specific prior written permission. ! 20: * ! 21: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ! 22: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ! 23: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ! 24: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ! 25: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ! 26: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ! 27: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ! 28: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ! 29: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ! 30: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! 31: * SUCH DAMAGE. ! 32: * ! 33: * @(#)spp_debug.c 7.7 (Berkeley) 6/28/90 ! 34: */ ! 35: ! 36: #include "param.h" ! 37: #include "systm.h" ! 38: #include "mbuf.h" ! 39: #include "socket.h" ! 40: #include "socketvar.h" ! 41: #include "protosw.h" ! 42: #include "errno.h" ! 43: ! 44: #include "../net/route.h" ! 45: #include "../net/if.h" ! 46: #include "../netinet/tcp_fsm.h" ! 47: ! 48: #include "ns.h" ! 49: #include "ns_pcb.h" ! 50: #include "idp.h" ! 51: #include "idp_var.h" ! 52: #include "sp.h" ! 53: #include "spidp.h" ! 54: #define SPPTIMERS ! 55: #include "spp_timer.h" ! 56: #include "spp_var.h" ! 57: #define SANAMES ! 58: #include "spp_debug.h" ! 59: ! 60: int sppconsdebug = 0; ! 61: /* ! 62: * spp debug routines ! 63: */ ! 64: spp_trace(act, ostate, sp, si, req) ! 65: short act; ! 66: u_char ostate; ! 67: struct sppcb *sp; ! 68: struct spidp *si; ! 69: int req; ! 70: { ! 71: #ifdef INET ! 72: #ifdef TCPDEBUG ! 73: u_short seq, ack, len, alo; ! 74: unsigned long iptime(); ! 75: int flags; ! 76: struct spp_debug *sd = &spp_debug[spp_debx++]; ! 77: extern char *prurequests[]; ! 78: extern char *sanames[]; ! 79: extern char *tcpstates[]; ! 80: extern char *spptimers[]; ! 81: ! 82: if (spp_debx == SPP_NDEBUG) ! 83: spp_debx = 0; ! 84: sd->sd_time = iptime(); ! 85: sd->sd_act = act; ! 86: sd->sd_ostate = ostate; ! 87: sd->sd_cb = (caddr_t)sp; ! 88: if (sp) ! 89: sd->sd_sp = *sp; ! 90: else ! 91: bzero((caddr_t)&sd->sd_sp, sizeof (*sp)); ! 92: if (si) ! 93: sd->sd_si = *si; ! 94: else ! 95: bzero((caddr_t)&sd->sd_si, sizeof (*si)); ! 96: sd->sd_req = req; ! 97: if (sppconsdebug == 0) ! 98: return; ! 99: if (ostate >= TCP_NSTATES) ostate = 0; ! 100: if (act >= SA_DROP) act = SA_DROP; ! 101: if (sp) ! 102: printf("%x %s:", sp, tcpstates[ostate]); ! 103: else ! 104: printf("???????? "); ! 105: printf("%s ", sanames[act]); ! 106: switch (act) { ! 107: ! 108: case SA_RESPOND: ! 109: case SA_INPUT: ! 110: case SA_OUTPUT: ! 111: case SA_DROP: ! 112: if (si == 0) ! 113: break; ! 114: seq = si->si_seq; ! 115: ack = si->si_ack; ! 116: alo = si->si_alo; ! 117: len = si->si_len; ! 118: if (act == SA_OUTPUT) { ! 119: seq = ntohs(seq); ! 120: ack = ntohs(ack); ! 121: alo = ntohs(alo); ! 122: len = ntohs(len); ! 123: } ! 124: #ifndef lint ! 125: #define p1(f) { printf("%s = %x, ", "f", f); } ! 126: p1(seq); p1(ack); p1(alo); p1(len); ! 127: #endif ! 128: flags = si->si_cc; ! 129: if (flags) { ! 130: char *cp = "<"; ! 131: #ifndef lint ! 132: #define pf(f) { if (flags&SP_/**/f) { printf("%s%s", cp, "f"); cp = ","; } } ! 133: pf(SP); pf(SA); pf(OB); pf(EM); ! 134: #else ! 135: cp = cp; ! 136: #endif ! 137: printf(">"); ! 138: } ! 139: #ifndef lint ! 140: #define p2(f) { printf("%s = %x, ", "f", si->si_/**/f); } ! 141: p2(sid);p2(did);p2(dt);p2(pt); ! 142: #endif ! 143: ns_printhost(&si->si_sna); ! 144: ns_printhost(&si->si_dna); ! 145: ! 146: if (act==SA_RESPOND) { ! 147: printf("idp_len = %x, ", ! 148: ((struct idp *)si)->idp_len); ! 149: } ! 150: break; ! 151: ! 152: case SA_USER: ! 153: printf("%s", prurequests[req&0xff]); ! 154: if ((req & 0xff) == PRU_SLOWTIMO) ! 155: printf("<%s>", spptimers[req>>8]); ! 156: break; ! 157: } ! 158: if (sp) ! 159: printf(" -> %s", tcpstates[sp->s_state]); ! 160: /* print out internal state of sp !?! */ ! 161: printf("\n"); ! 162: if (sp == 0) ! 163: return; ! 164: #ifndef lint ! 165: #define p3(f) { printf("%s = %x, ", "f", sp->s_/**/f); } ! 166: printf("\t"); p3(rack);p3(ralo);p3(smax);p3(flags); printf("\n"); ! 167: #endif ! 168: #endif ! 169: #endif ! 170: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.