Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 119 lines (104 sloc) 2.977 kb
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
1 /*
111ff8a whitespace cleanup
itojun authored
2 * Marko Kiiskila carnil@cs.tut.fi
3 *
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
4 * Tampere University of Technology - Telecommunications Laboratory
5 *
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
14 * the software.
111ff8a whitespace cleanup
itojun authored
15 *
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
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
19 * SOFTWARE.
111ff8a whitespace cleanup
itojun authored
20 *
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
21 */
22
bbc1cfa @yuguy Have the configure script arrange that the Makefile define _U_
yuguy authored
23 #ifndef lint
24 static const char rcsid[] _U_ =
dd928cf @yuguy Have print_llc() clear out the extracted_ethertype argument, rather than
yuguy authored
25 "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.25 2005-11-13 12:12:42 guy Exp $ (LBL)";
bbc1cfa @yuguy Have the configure script arrange that the Makefile define _U_
yuguy authored
26 #endif
b9ac23c Switch to config.h instead of passing defines in DEFS.
fenner authored
27
28 #ifdef HAVE_CONFIG_H
29 #include "config.h"
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
30 #endif
31
3d93249 Added support for Win32, based on WinPcap.
risso authored
32 #include <tcpdump-stdinc.h>
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
33
34 #include <stdio.h>
35 #include <pcap.h>
36
37 #include "interface.h"
38 #include "addrtoname.h"
fcc82f4 @yuguy The "__attribute__((packed))" tag on structures causes some files not to
yuguy authored
39 #include "extract.h"
e894092 @yuguy Add definitions of Ethernet types from
yuguy authored
40 #include "ether.h"
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
41 #include "lane.h"
42
464c44f @yuguy Add SunATM support, based on code from Yen Yen Lim at North Dakota State
yuguy authored
43 static const struct tok lecop2str[] = {
44 { 0x0001, "configure request" },
45 { 0x0101, "configure response" },
46 { 0x0002, "join request" },
47 { 0x0102, "join response" },
48 { 0x0003, "ready query" },
49 { 0x0103, "ready indication" },
50 { 0x0004, "register request" },
51 { 0x0104, "register response" },
52 { 0x0005, "unregister request" },
53 { 0x0105, "unregister response" },
54 { 0x0006, "ARP request" },
55 { 0x0106, "ARP response" },
56 { 0x0007, "flush request" },
57 { 0x0107, "flush response" },
58 { 0x0008, "NARP request" },
59 { 0x0009, "topology request" },
60 { 0, NULL }
61 };
62
ea5736c @guyharris Process VLAN frames and Alteon jumbo frames in the Ethernet printer.
guyharris authored
63 static void
1cead82 @mcr reworked print-ether to use netdissect
mcr authored
64 lane_hdr_print(netdissect_options *ndo, const u_char *bp)
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
65 {
c4aa877 @guyharris Use the ndo argument to lane_hdr_print().
guyharris authored
66 (void)ND_PRINT((ndo, "lecid:%x ", EXTRACT_16BITS(bp)));
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
67 }
68
69 /*
c422d3a @yuguy Get rid of the "-Wno-unused" flag, and fix up most of the
yuguy authored
70 * This is the top level routine of the printer. 'p' points
71 * to the LANE header of the packet, 'h->ts' is the timestamp,
fb1b6d8 @yuguy Fix up a bunch of comments - the on-the-wire length field in a
yuguy authored
72 * 'h->len' is the length of the packet off the wire, and 'h->caplen'
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
73 * is the number of bytes actually captured.
464c44f @yuguy Add SunATM support, based on code from Yen Yen Lim at North Dakota State
yuguy authored
74 *
75 * This assumes 802.3, not 802.5, LAN emulation.
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
76 */
77 void
464c44f @yuguy Add SunATM support, based on code from Yen Yen Lim at North Dakota State
yuguy authored
78 lane_print(const u_char *p, u_int length, u_int caplen)
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
79 {
464c44f @yuguy Add SunATM support, based on code from Yen Yen Lim at North Dakota State
yuguy authored
80 struct lane_controlhdr *lec;
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
81
464c44f @yuguy Add SunATM support, based on code from Yen Yen Lim at North Dakota State
yuguy authored
82 if (caplen < sizeof(struct lane_controlhdr)) {
83 printf("[|lane]");
84 return;
85 }
86
87 lec = (struct lane_controlhdr *)p;
fcc82f4 @yuguy The "__attribute__((packed))" tag on structures causes some files not to
yuguy authored
88 if (EXTRACT_16BITS(&lec->lec_header) == 0xff00) {
464c44f @yuguy Add SunATM support, based on code from Yen Yen Lim at North Dakota State
yuguy authored
89 /*
90 * LE Control.
91 */
92 printf("lec: proto %x vers %x %s",
93 lec->lec_proto, lec->lec_vers,
fcc82f4 @yuguy The "__attribute__((packed))" tag on structures causes some files not to
yuguy authored
94 tok2str(lecop2str, "opcode-#%u", EXTRACT_16BITS(&lec->lec_opcode)));
464c44f @yuguy Add SunATM support, based on code from Yen Yen Lim at North Dakota State
yuguy authored
95 return;
96 }
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
97
98 /*
ea5736c @guyharris Process VLAN frames and Alteon jumbo frames in the Ethernet printer.
guyharris authored
99 * Go past the LE header.
cfabfb0 @yuguy Add a new routine "default_print_packet()", which takes a pointer to the
yuguy authored
100 */
ea5736c @guyharris Process VLAN frames and Alteon jumbo frames in the Ethernet printer.
guyharris authored
101 length -= 2;
102 caplen -= 2;
103 p += 2;
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
104
105 /*
ea5736c @guyharris Process VLAN frames and Alteon jumbo frames in the Ethernet printer.
guyharris authored
106 * Now print the encapsulated frame, under the assumption
107 * that it's an Ethernet frame.
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
108 */
1cead82 @mcr reworked print-ether to use netdissect
mcr authored
109 ether_print(gndo, p, length, caplen, lane_hdr_print, p - 2);
464c44f @yuguy Add SunATM support, based on code from Yen Yen Lim at North Dakota State
yuguy authored
110 }
111
4bec97f @yuguy Hoist a bunch of stuff that should be done by all if_print routines into
yuguy authored
112 u_int
113 lane_if_print(const struct pcap_pkthdr *h, const u_char *p)
464c44f @yuguy Add SunATM support, based on code from Yen Yen Lim at North Dakota State
yuguy authored
114 {
4bec97f @yuguy Hoist a bunch of stuff that should be done by all if_print routines into
yuguy authored
115 lane_print(p, h->len, h->caplen);
464c44f @yuguy Add SunATM support, based on code from Yen Yen Lim at North Dakota State
yuguy authored
116
4bec97f @yuguy Hoist a bunch of stuff that should be done by all if_print routines into
yuguy authored
117 return (sizeof(struct lecdatahdr_8023));
77b2a44 print of ATM LanEmulation. From Marko Kiiskila <carnil@cs.tut.fi> by wa...
assar authored
118 }
Something went wrong with that request. Please try again.