Deleted Added
full compact
1/*
2 * Copyright (c) 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

--- 4 unchanged lines hidden (view full) ---

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 * $FreeBSD: head/contrib/tcpdump/print-atm.c 56896 2000-01-30 01:05:24Z fenner $
21 * $FreeBSD: head/contrib/tcpdump/print-atm.c 75118 2001-04-03 07:50:46Z fenner $
22 */
23#ifndef lint
24static const char rcsid[] =
25 "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.12 1999/11/21 09:36:48 fenner Exp $ (LBL)";
25 "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.20 2000/12/22 22:45:09 guy Exp $ (LBL)";
26#endif
27
28#ifdef HAVE_CONFIG_H
29#include "config.h"
30#endif
31
32#include <sys/param.h>
33#include <sys/time.h>
34#include <sys/socket.h>
35
36#if __STDC__
37struct mbuf;
38struct rtentry;
39#endif
40
41#include <net/if.h>
42#include <net/if_var.h>
43
36#include <netinet/in.h>
45#include <net/ethernet.h>
46#include <netinet/in_systm.h>
47#include <netinet/ip.h>
48#include <netinet/ip_var.h>
49#include <netinet/udp.h>
50#include <netinet/udp_var.h>
51#include <netinet/tcp.h>
37
38#include <stdio.h>
39#include <pcap.h>
40
41#include "interface.h"
42#include "addrtoname.h"
43#include "ethertype.h"
44
45/*
46 * This is the top level routine of the printer. 'p' is the points
47 * to the LLC/SNAP header of the packet, 'tvp' is the timestamp,
48 * 'length' is the length of the packet off the wire, and 'caplen'
49 * is the number of bytes actually captured.
50 */
51void
52atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
53{
54 u_int caplen = h->caplen;
55 u_int length = h->len;
71 u_short ethertype;
56 u_short ethertype, extracted_ethertype;
57
58 ts_print(&h->ts);
59
60 if (caplen < 8) {
61 printf("[|atm]");
62 goto out;
63 }
64

--- 74 unchanged lines hidden (view full) ---

139 case ETHERTYPE_MOPRC:
140 case ETHERTYPE_MOPDL:
141 /* default_print for now */
142#endif
143 default:
144 /* ether_type not known, forward it to llc_print */
145 if (!eflag)
146 printf("%02x %02x %02x %02x-%02x-%02x %04x: ",
162 p[0], p[1], p[2], /* dsap/ssap/ctrl */
163 p[3], p[4], p[5], /* manufacturer's code */
147 packetp[0], packetp[1], packetp[2], /* dsap/ssap/ctrl */
148 packetp[3], packetp[4], packetp[5], /* manufacturer's code */
149 ethertype);
165 if (!xflag && !qflag)
150 if (!xflag && !qflag) {
151 extracted_ethertype = 0;
152 /* default_print(p, caplen); */
167 llc_print(p-8,length+8,caplen+8,"000000","000000");
153 llc_print(p-8,length+8,caplen+8,"000000","000000", &extracted_ethertype);
154 }
155 }
156 if (xflag)
157 default_print(p, caplen);
158 out:
159 putchar('\n');
160}