1*41709Ssklower /* 2*41709Ssklower * Copyright (c) University of British Columbia, 1984 3*41709Ssklower * Copyright (c) 1990 The Regents of the University of California. 4*41709Ssklower * All rights reserved. 5*41709Ssklower * 6*41709Ssklower * This code is derived from software contributed to Berkeley by 7*41709Ssklower * the Laboratory for Computation Vision and the Computer Science Department 8*41709Ssklower * of the University of British Columbia. 9*41709Ssklower * 10*41709Ssklower * %sccs.include.redist.c% 11*41709Ssklower * 12*41709Ssklower * @(#)pk_debug.c 7.2 (Berkeley) 05/11/90 13*41709Ssklower */ 1441591Ssklower 1541591Ssklower #include "../h/param.h" 1641591Ssklower #include "../h/systm.h" 1741591Ssklower #include "../h/mbuf.h" 1841591Ssklower #include "../h/socket.h" 1941591Ssklower #include "../h/protosw.h" 2041591Ssklower #include "../h/socketvar.h" 2141591Ssklower #include "../h/errno.h" 2241591Ssklower 2341591Ssklower #include "../netccitt/x25.h" 2441591Ssklower #include "../netccitt/pk.h" 2541591Ssklower #include "../netccitt/pk_var.h" 2641591Ssklower 2741591Ssklower char *pk_state[] = { 2841591Ssklower "Listen", "Ready", "Received-Call", 2941591Ssklower "Sent-Call", "Data-Transfer","Received-Clear", 3041591Ssklower "Sent-Clear", 3141591Ssklower }; 3241591Ssklower 3341591Ssklower char *pk_name[] = { 3441591Ssklower "Call", "Call-Conf", "Clear", 3541591Ssklower "Clear-Conf", "Data", "Intr", "Intr-Conf", 3641591Ssklower "Rr", "Rnr", "Reset", "Reset-Conf", 3741591Ssklower "Restart", "Restart-Conf", "Invalid" 3841591Ssklower }; 3941591Ssklower 4041591Ssklower pk_trace (xcp, xp, dir) 4141591Ssklower struct x25config *xcp; 4241591Ssklower struct x25_packet *xp; 4341591Ssklower char *dir; 4441591Ssklower { 4541591Ssklower register char *s; 4641591Ssklower register struct mbuf *m; 4741591Ssklower register int i, len = 0, cnt = 0; 4841591Ssklower 4941591Ssklower if (xcp -> xc_ptrace == 0) 5041591Ssklower return; 5141591Ssklower 5241591Ssklower i = pk_decode (xp) / MAXSTATES; 5341591Ssklower for (m = dtom (xp); m; m = m -> m_next) { 5441591Ssklower len = len + m -> m_len; 5541591Ssklower ++cnt; 5641591Ssklower } 5741591Ssklower printf ("LCN=%d %s: %s #=%d, len=%d ", 5841591Ssklower xp -> logical_channel_number, dir, pk_name[i], cnt, len); 5941591Ssklower for (s = (char *) xp, i = 0; i < 5; ++i, ++s) 6041591Ssklower printf ("%x ", (int) * s & 0xff); 6141591Ssklower printf ("\n"); 6241591Ssklower } 63