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