xref: /csrg-svn/sys/netiso/trtp.c (revision 49351)
1*49351Ssklower #include <stdio.h>
2*49351Ssklower #define TPPT
3*49351Ssklower 
4*49351Ssklower #include <sys/param.h>
5*49351Ssklower #include <sys/systm.h>
6*49351Ssklower #include <sys/mbuf.h>
7*49351Ssklower #include <sys/socket.h>
8*49351Ssklower #include <sys/socketvar.h>
9*49351Ssklower #include <sys/types.h>
10*49351Ssklower #include <sys/time.h>
11*49351Ssklower 
12*49351Ssklower #include <netiso/tp_param.h>
13*49351Ssklower #include <netiso/tp_timer.h>
14*49351Ssklower #include <netiso/tp_stat.h>
15*49351Ssklower #include <netiso/tp_param.h>
16*49351Ssklower #include <netiso/tp_ip.h>
17*49351Ssklower #include <netiso/tp_pcb.h>
18*49351Ssklower #include <netiso/tp_tpdu.h>
19*49351Ssklower #include <netiso/argo_debug.h>
20*49351Ssklower #include <netiso/tp_trace.h>
21*49351Ssklower 
22*49351Ssklower static tp_seq = 0;
23*49351Ssklower u_char tp_traceflags[128];
24*49351Ssklower 
main(argc,argv)25*49351Ssklower main(argc, argv)
26*49351Ssklower {
27*49351Ssklower 
28*49351Ssklower }
29*49351Ssklower 
30*49351Ssklower #ifdef notdef
31*49351Ssklower 
tpprint(tp)32*49351Ssklower tpprint(tp)
33*49351Ssklower 	register struct tp_Trace *tp;
34*49351Ssklower {
35*49351Ssklower /*tptrace(tpcb, event, arg, src, len, arg4, arg5)*/
36*49351Ssklower 	struct tp_pcb	*tpcb;
37*49351Ssklower 	u_int 			event, arg;
38*49351Ssklower 	u_int	 		src;
39*49351Ssklower 	u_int	 		len;
40*49351Ssklower 	u_int	 		arg4;
41*49351Ssklower 	u_int	 		arg5;
42*49351Ssklower 
43*49351Ssklower 	tp->tpt_event = event;
44*49351Ssklower 	tp->tpt_tseq = tp_seq++;
45*49351Ssklower 	tp->tpt_arg = arg;
46*49351Ssklower 	if(tpcb)
47*49351Ssklower 		tp->tpt_arg2 = tpcb->tp_lref;
48*49351Ssklower 	bcopy( (caddr_t)&time, (caddr_t)&tp->tpt_time, sizeof(struct timeval) );
49*49351Ssklower 
50*49351Ssklower 	switch(tp->tpt_event) {
51*49351Ssklower 
52*49351Ssklower 	case TPPTertpdu:
53*49351Ssklower 		bcopy((caddr_t)src, (caddr_t)&tp->tpt_ertpdu,
54*49351Ssklower 			(unsigned)MIN((int)len, sizeof(struct tp_Trace)));
55*49351Ssklower 		break;
56*49351Ssklower 
57*49351Ssklower 	case TPPTusrreq:
58*49351Ssklower 	case TPPTmisc:
59*49351Ssklower 
60*49351Ssklower 		printf(tp->tpt_str,
61*49351Ssklower 			tp->tpt_m2/* = src */,
62*49351Ssklower 			tp->tpt_m3/* = len */,
63*49351Ssklower 			tp->tpt_m4/* = arg4 */,
64*49351Ssklower 			tp->tpt_m1/* = arg5 */);
65*49351Ssklower 
66*49351Ssklower 	case TPPTgotXack:
67*49351Ssklower 	case TPPTXack:
68*49351Ssklower 	case TPPTsendack:
69*49351Ssklower 	case TPPTgotack:
70*49351Ssklower 	case TPPTack:
71*49351Ssklower 	case TPPTindicate:
72*49351Ssklower 	default:
73*49351Ssklower 	case TPPTdriver:
74*49351Ssklower 		tp->tpt_m2 = arg;
75*49351Ssklower 		tp->tpt_m3 = src;
76*49351Ssklower 		tp->tpt_m4 = len;
77*49351Ssklower 		tp->tpt_m5 = arg4;
78*49351Ssklower 		tp->tpt_m1 = arg5;
79*49351Ssklower 		break;
80*49351Ssklower 	case TPPTparam:
81*49351Ssklower 		bcopy((caddr_t)src, (caddr_t)&tp->tpt_param, sizeof(struct tp_param));
82*49351Ssklower 		break;
83*49351Ssklower 	case TPPTref:
84*49351Ssklower 		bcopy((caddr_t)src, (caddr_t)&tp->tpt_ref, sizeof(struct tp_ref));
85*49351Ssklower 		break;
86*49351Ssklower 
87*49351Ssklower 	case TPPTtpduin:
88*49351Ssklower 	case TPPTtpduout:
89*49351Ssklower 		tp->tpt_arg2 = arg4;
90*49351Ssklower 		bcopy((caddr_t)src, (caddr_t)&tp->tpt_tpdu,
91*49351Ssklower 		      (unsigned)MIN((int)len, sizeof(struct tp_Trace)));
92*49351Ssklower 		break;
93*49351Ssklower 	}
94*49351Ssklower }
95*49351Ssklower #endif
96*49351Ssklower 
97*49351Ssklower char tpdu_types[][4] = {
98*49351Ssklower "#0", "XPD", "XAK", "GR", "#4", "#5", "AK", "ER",
99*49351Ssklower "DR", "#9", "#10", "#11", "DC", "CC", "CR", "DT"};
100*49351Ssklower 
101*49351Ssklower p_tpdu(tpdu, xtype)
102*49351Ssklower struct tpdu *tpdu;
103*49351Ssklower {
104*49351Ssklower 	struct tpdu t = *tpdu;
105*49351Ssklower 	int type = t.tpdu_type;
106*49351Ssklower 
107*49351Ssklower 	printf("<(%d)%s:", t.tpdu_li, tpdu_types[type]);
108*49351Ssklower 	switch (type) {
109*49351Ssklower 	case DT_TPDU_type:
110*49351Ssklower 	case XPD_TPDU_type:
111*49351Ssklower 		printf("to %x cdt %d seq %d eot %d\>", t.tpdu_dref, t.tpdu_cdt
112*49351Ssklower 			xtype ? t.tpdu_DTseqX : t.tpdu_DTseq,
113*49351Ssklower 			xtype ? t.tpdu_DTeotX : t.tpdu_DTeot);
114*49351Ssklower 		break;
115*49351Ssklower 	}
116*49351Ssklower }
117