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 * 12 * @(#)pk_debug.c 7.6 (Berkeley) 03/12/91 13 */ 14 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" 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", 39 "Restart", "Restart-Conf", "Reject", "Diagnostic", 40 "Invalid" 41 }; 42 43 pk_trace (xcp, m, dir) 44 struct x25config *xcp; 45 register struct mbuf *m; 46 char *dir; 47 { 48 register char *s; 49 struct x25_packet *xp = mtod(m, struct x25_packet *); 50 register int i, len = 0, cnt = 0; 51 52 if (xcp -> xc_ptrace == 0) 53 return; 54 55 i = pk_decode (xp) / MAXSTATES; 56 for (; m; m = m -> m_next) { 57 len = len + m -> m_len; 58 ++cnt; 59 } 60 printf ("LCN=%d %s: %s #=%d, len=%d ", 61 LCN(xp), dir, pk_name[i], cnt, len); 62 for (s = (char *) xp, i = 0; i < 5; ++i, ++s) 63 printf ("%x ", (int) * s & 0xff); 64 printf ("\n"); 65 } 66