]> The Tcpdump Group git mirrors - tcpdump/blob - print-vjc.c
*** empty log message ***
[tcpdump] / print-vjc.c
1 /*
2 * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 */
21
22 #if defined(__bsdi__)
23
24 #ifndef lint
25 static const char rcsid[] =
26 "@(#) print-vjc.c,v 1.1.2.2 1998/08/31 05:44:21 onoe Exp (LBL)";
27 #endif
28
29 #include <sys/param.h>
30 #include <sys/time.h>
31 #include <sys/socket.h>
32 #include <sys/file.h>
33 #include <sys/ioctl.h>
34
35 #if __STDC__
36 struct mbuf;
37 struct rtentry;
38 #endif
39 #include <net/if.h>
40
41 #include <netinet/in.h>
42 #include <netinet/in_systm.h>
43 #include <netinet/ip.h>
44 #include <netinet/if_ether.h>
45
46 #include <ctype.h>
47 #include <netdb.h>
48 #include <pcap.h>
49 #include <stdio.h>
50
51 #if defined(__NetBSD__)
52 #include <sys/mbuf.h>
53 #include <net/ppp_defs.h>
54 #endif
55
56 #if defined(__bsdi__) || defined(__NetBSD__)
57 #include <net/if_ppp.h>
58 #include <net/slcompress.h>
59 #endif
60
61 #include "interface.h"
62 #include "addrtoname.h"
63
64 int
65 vjc_print(register const char *bp, register u_int length, u_short proto)
66 {
67 int i;
68
69 switch (bp[0] & 0xf0) {
70 case TYPE_IP:
71 if (eflag)
72 printf("(vjc type=IP) ");
73 return PPP_IP;
74 case TYPE_UNCOMPRESSED_TCP:
75 if (eflag)
76 printf("(vjc type=raw TCP) ");
77 return PPP_IP;
78 case TYPE_COMPRESSED_TCP:
79 if (eflag)
80 printf("(vjc type=compressed TCP) ");
81 for (i = 0; i < 8; i++) {
82 if (bp[1] & (0x80 >> i))
83 printf("%c", "?CI?SAWU"[i]);
84 }
85 if (bp[1])
86 printf(" ");
87 printf("C=0x%02x ", bp[2]);
88 printf("sum=0x%04x ", *(u_short *)&bp[3]);
89 return -1;
90 case TYPE_ERROR:
91 if (eflag)
92 printf("(vjc type=error) ");
93 return -1;
94 default:
95 if (eflag)
96 printf("(vjc type=0x%02x) ", bp[0] & 0xf0);
97 return -1;
98 }
99 }
100 #endif /* defined(__bsdi__) || defined(__NetBSD__) */