Commit | Line | Data |
---|---|---|
51386eb2 KS |
1 | /* |
2 | * Copyright (c) University of British Columbia, 1984 | |
3 | * Copyright (c) 1990 The Regents of the University of California. | |
4 | * All rights reserved. | |
5 | * | |
6 | * This code is derived from software contributed to Berkeley by | |
7 | * the Laboratory for Computation Vision and the Computer Science Department | |
8 | * of the University of British Columbia. | |
9 | * | |
10 | * %sccs.include.redist.c% | |
11 | * | |
528d7313 | 12 | * @(#)pk_debug.c 7.6 (Berkeley) %G% |
51386eb2 | 13 | */ |
7f874860 | 14 | |
4507dea2 KS |
15 | #include "param.h" |
16 | #include "systm.h" | |
17 | #include "mbuf.h" | |
18 | #include "socket.h" | |
19 | #include "protosw.h" | |
20 | #include "socketvar.h" | |
21 | #include "errno.h" | |
22 | ||
23 | #include "../net/if.h" | |
24 | ||
25 | #include "x25.h" | |
26 | #include "pk.h" | |
27 | #include "pk_var.h" | |
7f874860 KS |
28 | |
29 | char *pk_state[] = { | |
30 | "Listen", "Ready", "Received-Call", | |
31 | "Sent-Call", "Data-Transfer","Received-Clear", | |
32 | "Sent-Clear", | |
33 | }; | |
34 | ||
35 | char *pk_name[] = { | |
36 | "Call", "Call-Conf", "Clear", | |
37 | "Clear-Conf", "Data", "Intr", "Intr-Conf", | |
38 | "Rr", "Rnr", "Reset", "Reset-Conf", | |
528d7313 KS |
39 | "Restart", "Restart-Conf", "Reject", "Diagnostic", |
40 | "Invalid" | |
7f874860 KS |
41 | }; |
42 | ||
9c9b50bc | 43 | pk_trace (xcp, m, dir) |
7f874860 | 44 | struct x25config *xcp; |
9c9b50bc | 45 | register struct mbuf *m; |
7f874860 KS |
46 | char *dir; |
47 | { | |
48 | register char *s; | |
9c9b50bc | 49 | struct x25_packet *xp = mtod(m, struct x25_packet *); |
7f874860 KS |
50 | register int i, len = 0, cnt = 0; |
51 | ||
52 | if (xcp -> xc_ptrace == 0) | |
53 | return; | |
54 | ||
55 | i = pk_decode (xp) / MAXSTATES; | |
9c9b50bc | 56 | for (; m; m = m -> m_next) { |
7f874860 KS |
57 | len = len + m -> m_len; |
58 | ++cnt; | |
59 | } | |
60 | printf ("LCN=%d %s: %s #=%d, len=%d ", | |
78a470b6 | 61 | LCN(xp), dir, pk_name[i], cnt, len); |
7f874860 KS |
62 | for (s = (char *) xp, i = 0; i < 5; ++i, ++s) |
63 | printf ("%x ", (int) * s & 0xff); | |
64 | printf ("\n"); | |
65 | } |