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