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.2 (Berkeley) 05/11/90 13 */ 14 15 #include "../h/param.h" 16 #include "../h/systm.h" 17 #include "../h/mbuf.h" 18 #include "../h/socket.h" 19 #include "../h/protosw.h" 20 #include "../h/socketvar.h" 21 #include "../h/errno.h" 22 23 #include "../netccitt/x25.h" 24 #include "../netccitt/pk.h" 25 #include "../netccitt/pk_var.h" 26 27 char *pk_state[] = { 28 "Listen", "Ready", "Received-Call", 29 "Sent-Call", "Data-Transfer","Received-Clear", 30 "Sent-Clear", 31 }; 32 33 char *pk_name[] = { 34 "Call", "Call-Conf", "Clear", 35 "Clear-Conf", "Data", "Intr", "Intr-Conf", 36 "Rr", "Rnr", "Reset", "Reset-Conf", 37 "Restart", "Restart-Conf", "Invalid" 38 }; 39 40 pk_trace (xcp, xp, dir) 41 struct x25config *xcp; 42 struct x25_packet *xp; 43 char *dir; 44 { 45 register char *s; 46 register struct mbuf *m; 47 register int i, len = 0, cnt = 0; 48 49 if (xcp -> xc_ptrace == 0) 50 return; 51 52 i = pk_decode (xp) / MAXSTATES; 53 for (m = dtom (xp); m; m = m -> m_next) { 54 len = len + m -> m_len; 55 ++cnt; 56 } 57 printf ("LCN=%d %s: %s #=%d, len=%d ", 58 xp -> logical_channel_number, dir, pk_name[i], cnt, len); 59 for (s = (char *) xp, i = 0; i < 5; ++i, ++s) 60 printf ("%x ", (int) * s & 0xff); 61 printf ("\n"); 62 } 63