extern u_int ieee802_11_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int ieee802_11_radio_if_print(const struct pcap_pkthdr *,
const u_char *);
-extern u_int ap1394_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int ieee802_11_radio_avs_if_print(const struct pcap_pkthdr *,
const u_char *);
extern void gre_print(const u_char *, u_int);
extern u_int raw_if_print(const struct pcap_pkthdr *, const u_char *);
extern void rip_print(const u_char *, u_int);
extern u_int sl_if_print(const struct pcap_pkthdr *, const u_char *);
-extern void lane_print(const u_char *, u_int, u_int);
-extern u_int lane_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 void sip_print(const u_char *, u_int);
extern void syslog_print(const u_char *, u_int);
extern int mptcp_print(const u_char *, u_int, u_char);
-extern u_int bt_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int usb_linux_48_byte_print(const struct pcap_pkthdr *, const u_char *);
extern u_int usb_linux_64_byte_print(const struct pcap_pkthdr *, const u_char *);
extern void vxlan_print(const u_char *, u_int);
extern void ip6_opt_print(const u_char *, int);
extern int hbhopt_print(const u_char *);
extern int dstopt_print(const u_char *);
-extern int frag6_print(const u_char *, const u_char *);
extern int mobility_print(const u_char *, const u_char *);
extern void ripng_print(const u_char *, unsigned int);
extern int rt6_print(const u_char *, const u_char *);
extern void msdp_print(netdissect_options *, const u_char *, u_int);
extern u_int null_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
extern void mobile_print(netdissect_options *, const u_char *, u_int);
+extern u_int ap1394_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
+extern u_int bt_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
+extern void lane_print(netdissect_options *, const u_char *, u_int, u_int);
+extern u_int lane_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
/* stuff that has not yet been rototiled */
extern const u_char * ns_nprint (register const u_char *, register const u_char *);
#ifdef INET6
extern void ip6_print(netdissect_options *,const u_char *, u_int);
+extern int frag6_print(netdissect_options *, const u_char *, const u_char *);
#if 0
extern void ip6_opt_print(netdissect_options *,const u_char *, int);
extern int hbhopt_print(netdissect_options *,const u_char *);
extern int dstopt_print(netdissect_options *,const u_char *);
-extern int frag6_print(netdissect_options *,const u_char *,
- const u_char *);
extern void icmp6_print(netdissect_options *,const u_char *,
const u_char *);
extern void ripng_print(netdissect_options *,const u_char *, int);
#include <tcpdump-stdinc.h>
-#include <stdio.h>
-
-#include "interface.h"
+#include "netdissect.h"
#include "extract.h"
#include "addrtoname.h"
#include "ethertype.h"
#define FIREWIRE_HDRLEN 18
static inline void
-ap1394_hdr_print(register const u_char *bp, u_int length)
+ap1394_hdr_print(netdissect_options *ndo, register const u_char *bp, u_int length)
{
register const struct firewire_header *fp;
u_int16_t firewire_type;
fp = (const struct firewire_header *)bp;
- (void)printf("%s > %s",
+ ND_PRINT((ndo, "%s > %s",
linkaddr_string(fp->firewire_dhost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN),
- linkaddr_string(fp->firewire_shost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN));
+ linkaddr_string(fp->firewire_shost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN)));
firewire_type = EXTRACT_16BITS(&fp->firewire_type);
- if (!qflag) {
- (void)printf(", ethertype %s (0x%04x)",
+ if (!ndo->ndo_qflag) {
+ ND_PRINT((ndo, ", ethertype %s (0x%04x)",
tok2str(ethertype_values,"Unknown", firewire_type),
- firewire_type);
+ firewire_type));
} else {
- (void)printf(", %s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", firewire_type));
+ ND_PRINT((ndo, ", %s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", firewire_type)));
}
- (void)printf(", length %u: ", length);
+ ND_PRINT((ndo, ", length %u: ", length));
}
/*
* is the number of bytes actually captured.
*/
u_int
-ap1394_if_print(const struct pcap_pkthdr *h, const u_char *p)
+ap1394_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
{
u_int length = h->len;
u_int caplen = h->caplen;
u_short ether_type;
if (caplen < FIREWIRE_HDRLEN) {
- printf("[|ap1394]");
+ ND_PRINT((ndo, "[|ap1394]"));
return FIREWIRE_HDRLEN;
}
- if (eflag)
- ap1394_hdr_print(p, length);
+ if (ndo->ndo_eflag)
+ ap1394_hdr_print(ndo, p, length);
length -= FIREWIRE_HDRLEN;
caplen -= FIREWIRE_HDRLEN;
p += FIREWIRE_HDRLEN;
ether_type = EXTRACT_16BITS(&fp->firewire_type);
- if (ethertype_print(gndo, ether_type, p, length, caplen) == 0) {
+ if (ethertype_print(ndo, ether_type, p, length, caplen) == 0) {
/* ether_type not known, print raw packet */
- if (!eflag)
- ap1394_hdr_print((u_char *)fp, length + FIREWIRE_HDRLEN);
+ if (!ndo->ndo_eflag)
+ ap1394_hdr_print(ndo, (u_char *)fp, length + FIREWIRE_HDRLEN);
- if (!suppress_default_print)
- default_print(p, caplen);
+ if (!ndo->ndo_suppress_default_print)
+ ndo->ndo_default_print(ndo, p, caplen);
}
return FIREWIRE_HDRLEN;
break;
case ATM_LANE:
- lane_print(p, length, caplen);
+ lane_print(gndo, p, length, caplen);
break;
}
}
#include <tcpdump-stdinc.h>
-#include <stdio.h>
-#include <string.h>
-
#include "interface.h"
#include "extract.h"
* is the number of bytes actually captured.
*/
u_int
-bt_if_print(const struct pcap_pkthdr *h, const u_char *p)
+bt_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
{
u_int length = h->len;
u_int caplen = h->caplen;
const pcap_bluetooth_h4_header* hdr = (const pcap_bluetooth_h4_header*)p;
if (caplen < BT_HDRLEN) {
- printf("[|bt]");
+ ND_PRINT((ndo, "[|bt]"));
return (BT_HDRLEN);
}
caplen -= BT_HDRLEN;
length -= BT_HDRLEN;
p += BT_HDRLEN;
- if (eflag)
- (void)printf("hci length %d, direction %s, ", length, (EXTRACT_32BITS(&hdr->direction)&0x1)?"in":"out");
+ if (ndo->ndo_eflag)
+ ND_PRINT((ndo, "hci length %d, direction %s, ", length, (EXTRACT_32BITS(&hdr->direction)&0x1)?"in":"out"));
- if (!suppress_default_print)
- default_print(p, caplen);
+ if (!ndo->ndo_suppress_default_print)
+ ndo->ndo_default_print(ndo, p, caplen);
return (BT_HDRLEN);
}
#include <tcpdump-stdinc.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "interface.h"
-#include "extract.h"
+#include "netdissect.h"
#include "addrtoname.h"
/*
length -= 2;
bp += 2;
- printf("CALM FAST src:%s; ", etheraddr_string(eth+6));
- printf("SrcNwref:%d; ", srcNwref);
- printf("DstNwref:%d; ", dstNwref);
+ ND_PRINT((ndo, "CALM FAST src:%s; ", etheraddr_string(eth+6)));
+ ND_PRINT((ndo, "SrcNwref:%d; ", srcNwref));
+ ND_PRINT((ndo, "DstNwref:%d; ", dstNwref));
if (ndo->ndo_vflag)
- default_print(bp, length);
+ ndo->ndo_default_print(ndo, bp, length);
}
#include <tcpdump-stdinc.h>
-#include <stdio.h>
-
#include "ip6.h"
-
-#include "interface.h"
+#include "netdissect.h"
#include "extract.h"
int
-frag6_print(register const u_char *bp, register const u_char *bp2)
+frag6_print(netdissect_options *ndo, register const u_char *bp, register const u_char *bp2)
{
register const struct ip6_frag *dp;
register const struct ip6_hdr *ip6;
dp = (const struct ip6_frag *)bp;
ip6 = (const struct ip6_hdr *)bp2;
- TCHECK(dp->ip6f_offlg);
+ ND_TCHECK(dp->ip6f_offlg);
- if (vflag) {
- printf("frag (0x%08x:%d|%ld)",
+ if (ndo->ndo_vflag) {
+ ND_PRINT((ndo, "frag (0x%08x:%d|%ld)",
EXTRACT_32BITS(&dp->ip6f_ident),
EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,
sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) -
- (long)(bp - bp2) - sizeof(struct ip6_frag));
+ (long)(bp - bp2) - sizeof(struct ip6_frag)));
} else {
- printf("frag (%d|%ld)",
+ ND_PRINT((ndo, "frag (%d|%ld)",
EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,
sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) -
- (long)(bp - bp2) - sizeof(struct ip6_frag));
+ (long)(bp - bp2) - sizeof(struct ip6_frag)));
}
-#if 1
/* it is meaningless to decode non-first fragment */
if ((EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0)
return -1;
else
-#endif
{
- fputs(" ", stdout);
+ ND_PRINT((ndo, " "));
return sizeof(struct ip6_frag);
}
trunc:
- fputs("[|frag]", stdout);
+ ND_PRINT((ndo, "[|frag]"));
return -1;
-#undef TCHECK
}
#endif /* INET6 */
nh = *cp;
break;
case IPPROTO_FRAGMENT:
- advance = frag6_print(cp, (const u_char *)ip6);
+ advance = frag6_print(ndo, cp, (const u_char *)ip6);
if (ndo->ndo_snapend <= cp + advance)
return;
nh = *cp;
#include <tcpdump-stdinc.h>
-#include <stdio.h>
-
-#include "interface.h"
+#include "netdissect.h"
#include "extract.h"
#include "ether.h"
-#ifndef ETHER_ADDR_LEN
-#define ETHER_ADDR_LEN 6
-#endif
-
struct lecdatahdr_8023 {
u_int16_t le_header;
u_int8_t h_dest[ETHER_ADDR_LEN];
* This assumes 802.3, not 802.5, LAN emulation.
*/
void
-lane_print(const u_char *p, u_int length, u_int caplen)
+lane_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
{
struct lane_controlhdr *lec;
if (caplen < sizeof(struct lane_controlhdr)) {
- printf("[|lane]");
+ ND_PRINT((ndo, "[|lane]"));
return;
}
/*
* LE Control.
*/
- printf("lec: proto %x vers %x %s",
+ ND_PRINT((ndo, "lec: proto %x vers %x %s",
lec->lec_proto, lec->lec_vers,
- tok2str(lecop2str, "opcode-#%u", EXTRACT_16BITS(&lec->lec_opcode)));
+ tok2str(lecop2str, "opcode-#%u", EXTRACT_16BITS(&lec->lec_opcode))));
return;
}
* Now print the encapsulated frame, under the assumption
* that it's an Ethernet frame.
*/
- ether_print(gndo, p, length, caplen, lane_hdr_print, p - 2);
+ ether_print(ndo, p, length, caplen, lane_hdr_print, p - 2);
}
u_int
-lane_if_print(const struct pcap_pkthdr *h, const u_char *p)
+lane_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
{
- lane_print(p, h->len, h->caplen);
+ lane_print(ndo, p, h->len, h->caplen);
return (sizeof(struct lecdatahdr_8023));
}
{ arcnet_linux_if_print, DLT_ARCNET_LINUX },
#endif
{ token_if_print, DLT_IEEE802 },
-#ifdef DLT_LANE8023
- { lane_if_print, DLT_LANE8023 },
-#endif
{ sl_if_print, DLT_SLIP },
#ifdef DLT_SLIP_BSDOS
{ sl_bsdos_if_print, DLT_SLIP_BSDOS },
#ifdef DLT_SYMANTEC_FIREWALL
{ symantec_if_print, DLT_SYMANTEC_FIREWALL },
#endif
-#ifdef DLT_APPLE_IP_OVER_IEEE1394
- { ap1394_if_print, DLT_APPLE_IP_OVER_IEEE1394 },
-#endif
#ifdef DLT_IEEE802_11_RADIO_AVS
{ ieee802_11_radio_avs_if_print, DLT_IEEE802_11_RADIO_AVS },
#endif
#ifdef DLT_MFR
{ mfr_if_print, DLT_MFR },
#endif
-#if defined(DLT_BLUETOOTH_HCI_H4_WITH_PHDR) && defined(HAVE_PCAP_BLUETOOTH_H)
- { bt_if_print, DLT_BLUETOOTH_HCI_H4_WITH_PHDR},
-#endif
#ifdef HAVE_PCAP_USB_H
#ifdef DLT_USB_LINUX
{ usb_linux_48_byte_print, DLT_USB_LINUX},
{ null_if_print, DLT_NULL },
#ifdef DLT_LOOP
{ null_if_print, DLT_LOOP },
+#endif
+#ifdef DLT_APPLE_IP_OVER_IEEE1394
+ { ap1394_if_print, DLT_APPLE_IP_OVER_IEEE1394 },
+#endif
+#if defined(DLT_BLUETOOTH_HCI_H4_WITH_PHDR) && defined(HAVE_PCAP_BLUETOOTH_H)
+ { bt_if_print, DLT_BLUETOOTH_HCI_H4_WITH_PHDR},
+#endif
+#ifdef DLT_LANE8023
+ { lane_if_print, DLT_LANE8023 },
#endif
{ NULL, 0 },
};