]> The Tcpdump Group git mirrors - tcpdump/blob - print-vjc.c
Get rid of unneeded includes of <net/if.h>.
[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 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25
26 #if defined(__bsdi__)
27
28 #ifndef lint
29 static const char rcsid[] =
30 "@(#) $Header: /tcpdump/master/tcpdump/print-vjc.c,v 1.7 2000-09-28 06:43:09 guy Exp $ (LBL)";
31 #endif
32
33 #include <sys/param.h>
34 #include <sys/time.h>
35 #include <sys/socket.h>
36 #include <sys/file.h>
37 #include <sys/ioctl.h>
38
39 struct mbuf;
40 struct rtentry;
41
42 #include <netinet/in.h>
43 #include <netinet/in_systm.h>
44
45 #include <ctype.h>
46 #include <netdb.h>
47 #include <pcap.h>
48 #include <stdio.h>
49
50 #if defined(__NetBSD__)
51 #include <sys/mbuf.h>
52 #include <net/ppp_defs.h>
53 #endif
54
55 #if defined(__bsdi__) || defined(__NetBSD__)
56 #include <net/if_ppp.h>
57 #include <net/slcompress.h>
58 #endif
59
60 #include "interface.h"
61 #include "addrtoname.h"
62
63 int
64 vjc_print(register const char *bp, register u_int length, u_short proto)
65 {
66 int i;
67
68 switch (bp[0] & 0xf0) {
69 case TYPE_IP:
70 if (eflag)
71 printf("(vjc type=IP) ");
72 return PPP_IP;
73 case TYPE_UNCOMPRESSED_TCP:
74 if (eflag)
75 printf("(vjc type=raw TCP) ");
76 return PPP_IP;
77 case TYPE_COMPRESSED_TCP:
78 if (eflag)
79 printf("(vjc type=compressed TCP) ");
80 for (i = 0; i < 8; i++) {
81 if (bp[1] & (0x80 >> i))
82 printf("%c", "?CI?SAWU"[i]);
83 }
84 if (bp[1])
85 printf(" ");
86 printf("C=0x%02x ", bp[2]);
87 printf("sum=0x%04x ", *(u_short *)&bp[3]);
88 return -1;
89 case TYPE_ERROR:
90 if (eflag)
91 printf("(vjc type=error) ");
92 return -1;
93 default:
94 if (eflag)
95 printf("(vjc type=0x%02x) ", bp[0] & 0xf0);
96 return -1;
97 }
98 }
99 #endif /* defined(__bsdi__) || defined(__NetBSD__) */