add support for DLT_JUNIPER{PPP,ETHER,FRELAY,CHDLC} printers

This commit is contained in:
hannes 2005-08-23 10:24:58 +00:00
parent eec536eee1
commit 0bf0df6572
4 changed files with 96 additions and 6 deletions

View File

@ -18,7 +18,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.259 2005-07-20 22:12:39 hannes Exp $ (LBL)
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.260 2005-08-23 10:24:58 hannes Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@ -253,6 +253,7 @@ extern u_int lane_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int cip_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int sl_bsdos_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int chdlc_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int chdlc_print(register const u_char *, u_int);
extern u_int juniper_atm1_print(const struct pcap_pkthdr *, const u_char *);
extern u_int juniper_atm2_print(const struct pcap_pkthdr *, const u_char *);
extern u_int juniper_mfr_print(const struct pcap_pkthdr *, register const u_char *);
@ -264,6 +265,10 @@ extern u_int juniper_ggsn_print(const struct pcap_pkthdr *, const u_char *);
extern u_int juniper_es_print(const struct pcap_pkthdr *, const u_char *);
extern u_int juniper_monitor_print(const struct pcap_pkthdr *, const u_char *);
extern u_int juniper_services_print(const struct pcap_pkthdr *, const u_char *);
extern u_int juniper_ether_print(const struct pcap_pkthdr *, const u_char *);
extern u_int juniper_ppp_print(const struct pcap_pkthdr *, const u_char *);
extern u_int juniper_frelay_print(const struct pcap_pkthdr *, const u_char *);
extern u_int juniper_chdlc_print(const struct pcap_pkthdr *, const u_char *);
extern u_int sll_if_print(const struct pcap_pkthdr *, const u_char *);
extern void snmp_print(const u_char *, u_int);
extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.39 2005-04-27 14:33:24 hannes Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.40 2005-08-23 10:24:58 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -48,13 +48,18 @@ chdlc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
{
register u_int length = h->len;
register u_int caplen = h->caplen;
const struct ip *ip;
u_int proto;
if (caplen < CHDLC_HDRLEN) {
printf("[|chdlc]");
return (caplen);
}
return (chdlc_print(p,length));
}
u_int
chdlc_print(register const u_char *p, u_int length) {
u_int proto;
const struct ip *ip;
proto = EXTRACT_16BITS(&p[2]);
if (eflag) {

View File

@ -15,7 +15,7 @@
#ifndef lint
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.26 2005-08-10 14:18:57 hannes Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.27 2005-08-23 10:24:59 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -358,6 +358,74 @@ juniper_pppoe_print(const struct pcap_pkthdr *h, register const u_char *p)
}
#endif
#ifdef DLT_JUNIPER_ETHER
u_int
juniper_ether_print(const struct pcap_pkthdr *h, register const u_char *p)
{
struct juniper_l2info_t l2info;
l2info.pictype = DLT_JUNIPER_ETHER;
if(juniper_parse_header(p, h, &l2info) == 0)
return l2info.header_len;
p+=l2info.header_len;
/* this DLT contains nothing but raw Ethernet frames */
ether_print(p, l2info.length, l2info.caplen);
return l2info.header_len;
}
#endif
#ifdef DLT_JUNIPER_PPP
u_int
juniper_ppp_print(const struct pcap_pkthdr *h, register const u_char *p)
{
struct juniper_l2info_t l2info;
l2info.pictype = DLT_JUNIPER_PPP;
if(juniper_parse_header(p, h, &l2info) == 0)
return l2info.header_len;
p+=l2info.header_len;
/* this DLT contains nothing but raw ppp frames */
ppp_print(p, l2info.length);
return l2info.header_len;
}
#endif
#ifdef DLT_JUNIPER_FRELAY
u_int
juniper_frelay_print(const struct pcap_pkthdr *h, register const u_char *p)
{
struct juniper_l2info_t l2info;
l2info.pictype = DLT_JUNIPER_FRELAY;
if(juniper_parse_header(p, h, &l2info) == 0)
return l2info.header_len;
p+=l2info.header_len;
/* this DLT contains nothing but raw frame-relay frames */
fr_print(p, l2info.length);
return l2info.header_len;
}
#endif
#ifdef DLT_JUNIPER_CHDLC
u_int
juniper_chdlc_print(const struct pcap_pkthdr *h, register const u_char *p)
{
struct juniper_l2info_t l2info;
l2info.pictype = DLT_JUNIPER_CHDLC;
if(juniper_parse_header(p, h, &l2info) == 0)
return l2info.header_len;
p+=l2info.header_len;
/* this DLT contains nothing but raw c-hdlc frames */
chdlc_print(p, l2info.length);
return l2info.header_len;
}
#endif
#ifdef DLT_JUNIPER_PPPOE_ATM
u_int
juniper_pppoe_atm_print(const struct pcap_pkthdr *h, register const u_char *p)

View File

@ -30,7 +30,7 @@ static const char copyright[] _U_ =
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.260 2005-07-07 01:22:21 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.261 2005-08-23 10:24:58 hannes Exp $ (LBL)";
#endif
/*
@ -252,6 +252,18 @@ static struct printer printers[] = {
#endif
#ifdef DLT_JUNIPER_SERVICES
{ juniper_services_print, DLT_JUNIPER_SERVICES },
#endif
#ifdef DLT_JUNIPER_ETHER
{ juniper_ether_print, DLT_JUNIPER_ETHER },
#endif
#ifdef DLT_JUNIPER_PPP
{ juniper_ppp_print, DLT_JUNIPER_PPP },
#endif
#ifdef DLT_JUNIPER_FRELAY
{ juniper_frelay_print, DLT_JUNIPER_FRELAY },
#endif
#ifdef DLT_JUNIPER_CHDLC
{ juniper_chdlc_print, DLT_JUNIPER_CHDLC },
#endif
{ NULL, 0 },
};