1b0453382SBill Fenner /* 2b0453382SBill Fenner * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 3b0453382SBill Fenner * The Regents of the University of California. All rights reserved. 4b0453382SBill Fenner * 5b0453382SBill Fenner * Redistribution and use in source and binary forms, with or without 6b0453382SBill Fenner * modification, are permitted provided that: (1) source code distributions 7b0453382SBill Fenner * retain the above copyright notice and this paragraph in its entirety, (2) 8b0453382SBill Fenner * distributions including binary code include the above copyright notice and 9b0453382SBill Fenner * this paragraph in its entirety in the documentation or other materials 10b0453382SBill Fenner * provided with the distribution, and (3) all advertising materials mentioning 11b0453382SBill Fenner * features or use of this software display the following acknowledgement: 12b0453382SBill Fenner * ``This product includes software developed by the University of California, 13b0453382SBill Fenner * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14b0453382SBill Fenner * the University nor the names of its contributors may be used to endorse 15b0453382SBill Fenner * or promote products derived from this software without specific prior 16b0453382SBill Fenner * written permission. 17b0453382SBill Fenner * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18b0453382SBill Fenner * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19b0453382SBill Fenner * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20b0453382SBill Fenner */ 21b0453382SBill Fenner 22b0453382SBill Fenner #ifdef HAVE_CONFIG_H 23b0453382SBill Fenner #include "config.h" 24b0453382SBill Fenner #endif 25b0453382SBill Fenner 26b0453382SBill Fenner #ifndef lint 27b0453382SBill Fenner static const char rcsid[] = 28685295f4SBill Fenner "@(#) $Header: /tcpdump/master/tcpdump/print-vjc.c,v 1.9 2000/10/09 01:53:21 guy Exp $ (LBL)"; 29b0453382SBill Fenner #endif 30b0453382SBill Fenner 31b0453382SBill Fenner #include <sys/param.h> 32b0453382SBill Fenner #include <sys/time.h> 33b0453382SBill Fenner 34b0453382SBill Fenner #include <netinet/in.h> 35b0453382SBill Fenner 36b0453382SBill Fenner #include <ctype.h> 37b0453382SBill Fenner #include <netdb.h> 38b0453382SBill Fenner #include <pcap.h> 39b0453382SBill Fenner #include <stdio.h> 40b0453382SBill Fenner 41b0453382SBill Fenner #include "interface.h" 42b0453382SBill Fenner #include "addrtoname.h" 43b0453382SBill Fenner 44685295f4SBill Fenner #include "slcompress.h" 45685295f4SBill Fenner #include "ppp.h" 46685295f4SBill Fenner 47b0453382SBill Fenner int 48b0453382SBill Fenner vjc_print(register const char *bp, register u_int length, u_short proto) 49b0453382SBill Fenner { 50b0453382SBill Fenner int i; 51b0453382SBill Fenner 52b0453382SBill Fenner switch (bp[0] & 0xf0) { 53b0453382SBill Fenner case TYPE_IP: 54b0453382SBill Fenner if (eflag) 55b0453382SBill Fenner printf("(vjc type=IP) "); 56b0453382SBill Fenner return PPP_IP; 57b0453382SBill Fenner case TYPE_UNCOMPRESSED_TCP: 58b0453382SBill Fenner if (eflag) 59b0453382SBill Fenner printf("(vjc type=raw TCP) "); 60b0453382SBill Fenner return PPP_IP; 61b0453382SBill Fenner case TYPE_COMPRESSED_TCP: 62b0453382SBill Fenner if (eflag) 63b0453382SBill Fenner printf("(vjc type=compressed TCP) "); 64b0453382SBill Fenner for (i = 0; i < 8; i++) { 65b0453382SBill Fenner if (bp[1] & (0x80 >> i)) 66b0453382SBill Fenner printf("%c", "?CI?SAWU"[i]); 67b0453382SBill Fenner } 68b0453382SBill Fenner if (bp[1]) 69b0453382SBill Fenner printf(" "); 70b0453382SBill Fenner printf("C=0x%02x ", bp[2]); 71b0453382SBill Fenner printf("sum=0x%04x ", *(u_short *)&bp[3]); 72b0453382SBill Fenner return -1; 73b0453382SBill Fenner case TYPE_ERROR: 74b0453382SBill Fenner if (eflag) 75b0453382SBill Fenner printf("(vjc type=error) "); 76b0453382SBill Fenner return -1; 77b0453382SBill Fenner default: 78b0453382SBill Fenner if (eflag) 79b0453382SBill Fenner printf("(vjc type=0x%02x) ", bp[0] & 0xf0); 80b0453382SBill Fenner return -1; 81b0453382SBill Fenner } 82b0453382SBill Fenner } 83