2 * Copyright (c) 1984, 1985, 1986, 1987, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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 * 4. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * Copyright (c) 1995, Mike Mitchell
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
34 * 1. Redistributions of source code must retain the above copyright
35 * notice, this list of conditions and the following disclaimer.
36 * 2. Redistributions in binary form must reproduce the above copyright
37 * notice, this list of conditions and the following disclaimer in the
38 * documentation and/or other materials provided with the distribution.
39 * 3. All advertising materials mentioning features or use of this software
40 * must display the following acknowledgement:
41 * This product includes software developed by the University of
42 * California, Berkeley and its contributors.
43 * 4. Neither the name of the University nor the names of its contributors
44 * may be used to endorse or promote products derived from this software
45 * without specific prior written permission.
47 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
48 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 #include <sys/cdefs.h>
63 __FBSDID("$FreeBSD$");
66 #include "opt_tcpdebug.h"
68 #include <sys/param.h>
69 #include <sys/systm.h>
70 #include <sys/protosw.h>
72 #define TCPSTATES /* for logging */
74 #include <netinet/in_systm.h>
75 #include <netinet/tcp_fsm.h>
77 #include <netipx/ipx.h>
78 #include <netipx/ipx_var.h>
79 #include <netipx/spx.h>
81 #include <netipx/spx_timer.h>
83 #include <netipx/spx_debug.h>
87 static int spxconsdebug = 0;
88 static struct spx_debug spx_debug[SPX_NDEBUG];
97 spx_trace(short act, u_char ostate, struct spxpcb *sp, struct spx *si,
102 u_short seq, ack, len, alo;
104 struct spx_debug *sd = &spx_debug[spx_debx++];
106 if (spx_debx == SPX_NDEBUG)
108 sd->sd_time = iptime();
110 sd->sd_ostate = ostate;
111 sd->sd_cb = (caddr_t)sp;
115 bzero((caddr_t)&sd->sd_sp, sizeof(*sp));
119 bzero((caddr_t)&sd->sd_si, sizeof(*si));
121 if (spxconsdebug == 0)
123 if (ostate >= TCP_NSTATES)
128 printf("%p %s:", (void *)sp, tcpstates[ostate]);
131 printf("%s ", spxnames[act]);
144 if (act == SA_OUTPUT) {
151 #define p1(f) { printf("%s = %x, ", "f", f); }
152 p1(seq); p1(ack); p1(alo); p1(len);
158 #define pf(f) { if (flags & SPX_ ## f) { printf("%s%s", cp, "f"); cp = ","; } }
159 pf(SP); pf(SA); pf(OB); pf(EM);
166 #define p2(f) { printf("%s = %x, ", "f", si->si_ ## f); }
167 p2(sid);p2(did);p2(dt);p2(pt);
169 ipx_printhost(&si->si_sna);
170 ipx_printhost(&si->si_dna);
172 if (act == SA_RESPOND) {
173 printf("ipx_len = %x, ",
174 ((struct ipx *)si)->ipx_len);
179 printf("%s", prurequests[req&0xff]);
180 if ((req & 0xff) == PRU_SLOWTIMO)
181 printf("<%s>", spxtimers[req>>8]);
185 printf(" -> %s", tcpstates[sp->s_state]);
186 /* print out internal state of sp !?! */
191 #define p3(f) { printf("%s = %x, ", "f", sp->s_ ## f); }
192 printf("\t"); p3(rack);p3(ralo);p3(smax);p3(flags); printf("\n");