2 * Marko Kiiskila carnil@cs.tut.fi
4 * Tampere University of Technology - Telecommunications Laboratory
6 * Permission to use, copy, modify and distribute this
7 * software and its documentation is hereby granted,
8 * provided that both the copyright notice and this
9 * permission notice appear in all copies of the software,
10 * derivative works or modified versions, and any portions
11 * thereof, that both notices appear in supporting
12 * documentation, and that the use of this software is
13 * acknowledged in any publications resulting from using
16 * TUT ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 * CONDITION AND DISCLAIMS ANY LIABILITY OF ANY KIND FOR
18 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS
24 static const char rcsid
[] _U_
=
25 "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.25.2.1 2005/07/07 01:24:34 guy Exp $ (LBL)";
34 #include <tcpdump-stdinc.h>
39 #include "interface.h"
40 #include "addrtoname.h"
41 #include "ethertype.h"
44 #define RFC1483LLC_LEN 8
46 static unsigned char rfcllc
[] = {
47 0xaa, /* DSAP: non-ISO */
48 0xaa, /* SSAP: non-ISO */
49 0x03, /* Ctrl: Unnumbered Information Command PDU */
50 0x00, /* OUI: EtherType */
58 * There is no MAC-layer header, so just print the length.
60 printf("%d: ", length
);
64 * This is the top level routine of the printer. 'p' points
65 * to the LLC/SNAP or raw header of the packet, 'h->ts' is the timestamp,
66 * 'h->len' is the length of the packet off the wire, and 'h->caplen'
67 * is the number of bytes actually captured.
70 cip_if_print(const struct pcap_pkthdr
*h
, const u_char
*p
)
72 u_int caplen
= h
->caplen
;
73 u_int length
= h
->len
;
74 u_short extracted_ethertype
;
76 if (memcmp(rfcllc
, p
, sizeof(rfcllc
))==0 && caplen
< RFC1483LLC_LEN
) {
84 if (memcmp(rfcllc
, p
, sizeof(rfcllc
)) == 0) {
86 * LLC header is present. Try to print it & higher layers.
88 if (llc_print(p
, length
, caplen
, NULL
, NULL
,
89 &extracted_ethertype
) == 0) {
90 /* ether_type not known, print raw packet */
93 if (extracted_ethertype
) {
95 etherproto_string(htons(extracted_ethertype
)));
97 if (!suppress_default_print
)
98 default_print(p
, caplen
);
102 * LLC header is absent; treat it as just IP.
104 ip_print(gndo
, p
, length
);
113 * c-style: whitesmith