* is the number of bytes actually captured.
*/
u_int
- ipnet_if_print(struct netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
-ipnet_if_print(const struct pcap_pkthdr *h, const u_char *p)
++ipnet_if_print(struct netdissect_options *ndo,
++ const struct pcap_pkthdr *h, const u_char *p)
{
- ipnet_print(gndo, p, h->len, h->caplen);
+ ipnet_print(ndo, p, h->len, h->caplen);
return (sizeof(ipnet_hdr_t));
}
{ juniper_services_print, DLT_JUNIPER_SERVICES },
#endif
#ifdef DLT_JUNIPER_ETHER
- { juniper_ether_print, DLT_JUNIPER_ETHER },
+ { juniper_ether_print, DLT_JUNIPER_ETHER },
#endif
#ifdef DLT_JUNIPER_PPP
- { juniper_ppp_print, DLT_JUNIPER_PPP },
+ { juniper_ppp_print, DLT_JUNIPER_PPP },
#endif
#ifdef DLT_JUNIPER_FRELAY
- { juniper_frelay_print, DLT_JUNIPER_FRELAY },
+ { juniper_frelay_print, DLT_JUNIPER_FRELAY },
#endif
#ifdef DLT_JUNIPER_CHDLC
- { juniper_chdlc_print, DLT_JUNIPER_CHDLC },
+ { juniper_chdlc_print, DLT_JUNIPER_CHDLC },
#endif
#ifdef DLT_MFR
- { mfr_if_print, 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},
+ { bt_if_print, DLT_BLUETOOTH_HCI_H4_WITH_PHDR},
#endif
#if defined(HAVE_PCAP_USB_H) && defined(DLT_USB_LINUX)
- { usb_linux_print, DLT_USB_LINUX},
+ { usb_linux_print, DLT_USB_LINUX},
#endif
#if defined(HAVE_PCAP_USB_H) && defined(DLT_USB_LINUX_MMAPPED)
- { usb_linux_print, DLT_USB_LINUX_MMAPPED},
+ { usb_linux_print, DLT_USB_LINUX_MMAPPED},
#endif
+ { NULL, 0 },
+};
+
+static struct ndo_printer ndo_printers[] = {
#ifdef DLT_IPNET
- { ipnet_if_print, DLT_IPNET },
+ { ipnet_if_print, DLT_IPNET },
+ #endif
+ #ifdef DLT_IPV4
+ { raw_if_print, DLT_IPV4 },
+ #endif
+ #ifdef DLT_IPV6
+ { raw_if_print, DLT_IPV6 },
#endif
{ NULL, 0 },
};
/* NOTREACHED */
}
+static if_ndo_printer
+lookup_ndo_printer(int type)
+{
+ struct ndo_printer *p;
+
+ for (p = ndo_printers; p->f; ++p)
+ if (type == p->type)
+ return p->f;
+
+ return NULL;
+ /* NOTREACHED */
+}
+
static pcap_t *pd;
+ static int supports_monitor_mode;
+
extern int optind;
extern int opterr;
extern char *optarg;