|
|
1.1 ! root 1: /*- ! 2: * Copyright (c) 1991 The 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: * @(#)tp_trace.c 7.4 (Berkeley) 5/6/91 ! 34: */ ! 35: ! 36: /*********************************************************** ! 37: Copyright IBM Corporation 1987 ! 38: ! 39: All Rights Reserved ! 40: ! 41: Permission to use, copy, modify, and distribute this software and its ! 42: documentation for any purpose and without fee is hereby granted, ! 43: provided that the above copyright notice appear in all copies and that ! 44: both that copyright notice and this permission notice appear in ! 45: supporting documentation, and that the name of IBM not be ! 46: used in advertising or publicity pertaining to distribution of the ! 47: software without specific, written prior permission. ! 48: ! 49: IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ! 50: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ! 51: IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ! 52: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! 53: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ! 54: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ! 55: SOFTWARE. ! 56: ! 57: ******************************************************************/ ! 58: ! 59: /* ! 60: * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison ! 61: */ ! 62: /* ! 63: * ARGO TP ! 64: * ! 65: * $Header: tp_trace.c,v 5.3 88/11/18 17:29:14 nhall Exp $ ! 66: * $Source: /usr/argo/sys/netiso/RCS/tp_trace.c,v $ ! 67: * ! 68: * The whole protocol trace module. ! 69: * We keep a circular buffer of trace structures, which are big ! 70: * unions of different structures we might want to see. ! 71: * Unfortunately this gets too big pretty easily. Pcbs were removed ! 72: * from the tracing when the kernel got too big to boot. ! 73: */ ! 74: ! 75: #define TP_TRACEFILE ! 76: ! 77: #include "param.h" ! 78: #include "systm.h" ! 79: #include "mbuf.h" ! 80: #include "socket.h" ! 81: #include "types.h" ! 82: #include "time.h" ! 83: ! 84: #include "tp_param.h" ! 85: #include "tp_timer.h" ! 86: #include "tp_stat.h" ! 87: #include "tp_param.h" ! 88: #include "tp_ip.h" ! 89: #include "tp_pcb.h" ! 90: #include "tp_tpdu.h" ! 91: #include "argo_debug.h" ! 92: #include "tp_trace.h" ! 93: ! 94: #ifdef TPPT ! 95: static tp_seq = 0; ! 96: u_char tp_traceflags[128]; ! 97: ! 98: /* ! 99: * The argument tpcb is the obvious. ! 100: * event here is just the type of trace event - TPPTmisc, etc. ! 101: * The rest of the arguments have different uses depending ! 102: * on the type of trace event. ! 103: */ ! 104: /*ARGSUSED*/ ! 105: /*VARARGS*/ ! 106: ! 107: void ! 108: tpTrace(tpcb, event, arg, src, len, arg4, arg5) ! 109: struct tp_pcb *tpcb; ! 110: u_int event, arg; ! 111: u_int src; ! 112: u_int len; ! 113: u_int arg4; ! 114: u_int arg5; ! 115: { ! 116: register struct tp_Trace *tp; ! 117: ! 118: tp = &tp_Trace[tp_Tracen++]; ! 119: tp_Tracen %= TPTRACEN; ! 120: ! 121: tp->tpt_event = event; ! 122: tp->tpt_tseq = tp_seq++; ! 123: tp->tpt_arg = arg; ! 124: if(tpcb) ! 125: tp->tpt_arg2 = tpcb->tp_lref; ! 126: bcopy( (caddr_t)&time, (caddr_t)&tp->tpt_time, sizeof(struct timeval) ); ! 127: ! 128: switch(event) { ! 129: ! 130: case TPPTertpdu: ! 131: bcopy((caddr_t)src, (caddr_t)&tp->tpt_ertpdu, ! 132: (unsigned)MIN((int)len, sizeof(struct tp_Trace))); ! 133: break; ! 134: ! 135: case TPPTusrreq: ! 136: case TPPTmisc: ! 137: ! 138: /* arg is a string */ ! 139: bcopy((caddr_t)arg, (caddr_t)tp->tpt_str, ! 140: (unsigned)MIN(1+strlen((caddr_t) arg), TPTRACE_STRLEN)); ! 141: tp->tpt_m2 = src; ! 142: tp->tpt_m3 = len; ! 143: tp->tpt_m4 = arg4; ! 144: tp->tpt_m1 = arg5; ! 145: break; ! 146: ! 147: case TPPTgotXack: ! 148: case TPPTXack: ! 149: case TPPTsendack: ! 150: case TPPTgotack: ! 151: case TPPTack: ! 152: case TPPTindicate: ! 153: default: ! 154: case TPPTdriver: ! 155: tp->tpt_m2 = arg; ! 156: tp->tpt_m3 = src; ! 157: tp->tpt_m4 = len; ! 158: tp->tpt_m5 = arg4; ! 159: tp->tpt_m1 = arg5; ! 160: break; ! 161: case TPPTparam: ! 162: bcopy((caddr_t)src, (caddr_t)&tp->tpt_param, sizeof(struct tp_param)); ! 163: break; ! 164: case TPPTref: ! 165: bcopy((caddr_t)src, (caddr_t)&tp->tpt_ref, sizeof(struct tp_ref)); ! 166: break; ! 167: ! 168: case TPPTtpduin: ! 169: case TPPTtpduout: ! 170: tp->tpt_arg2 = arg4; ! 171: bcopy((caddr_t)src, (caddr_t)&tp->tpt_tpdu, ! 172: (unsigned)MIN((int)len, sizeof(struct tp_Trace))); ! 173: break; ! 174: } ! 175: } ! 176: #endif TPPT
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.