aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/file-pcapng.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-11-20 18:52:02 -0800
committerGuy Harris <guy@alum.mit.edu>2015-11-21 02:52:57 +0000
commit91f4e3b73d6929591d6b0790c7e1a4c1810f045d (patch)
treee46395c93860ba78d20177254f0fb539ddcb2cd4 /epan/dissectors/file-pcapng.c
parentfef4714e7255572ec40a877ccf7fb7ca76eb90dc (diff)
Have a separate dissector for pcap/pcapng-format packet data.
Put that dissector into its own file, and get handles for it from the pcap and pcapng file dissectors. Put the value_string of pcap/pcapng LINKTYPE_ values there, and have the pcap and pcapng file dissectors import it. Expand that table to include all LINKTYPE_ values in the current libpcap. Change-Id: I9397035efa5711e8a18a26e056d3b54494fd3148 Reviewed-on: https://code.wireshark.org/review/12000 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/file-pcapng.c')
-rw-r--r--epan/dissectors/file-pcapng.c154
1 files changed, 7 insertions, 147 deletions
diff --git a/epan/dissectors/file-pcapng.c b/epan/dissectors/file-pcapng.c
index 2152130052..f1710bfb75 100644
--- a/epan/dissectors/file-pcapng.c
+++ b/epan/dissectors/file-pcapng.c
@@ -33,12 +33,11 @@
#include <epan/addr_resolv.h>
#include <epan/wmem/wmem.h>
-#include <wiretap/wtap.h>
+#include <epan/dissectors/packet-pcap_pktdata.h>
static int proto_pcapng = -1;
-static dissector_handle_t pcapng_handle;
-extern dissector_handle_t pcap_pseudoheader_handle;
+static dissector_handle_t pcap_pktdata_handle;
static int hf_pcapng_block = -1;
@@ -339,146 +338,6 @@ static const value_string flags_reception_type_vals[] = {
{ 0, NULL }
};
-/* Mostly PCAP, but add also link type found in wiretap code */
-static const value_string link_type_vals[] = {
- { 0, "NULL" },
- { 1, "ETHERNET" },
- { 3, "AX25" },
- { 6, "IEEE802_5" },
- { 7, "ARCNET_BSD" },
- { 8, "SLIP" },
- { 9, "PPP" },
- { 10, "FDDI/FDDI_BITSWAPPED" },
- { 32, "REDBACK" },
- { 50, "PPP_HDLC" },
- { 51, "PPP_ETHER" },
- { 99, "SYMANTEC" },
- { 100, "ATM_RFC1483" },
- { 101, "RAW" },
- { 104, "C_HDLC" },
- { 105, "IEEE802_11" },
- { 106, "LINUX_ATM_CLIP" },
- { 107, "FRELAY" },
- { 108, "LOOP" },
- { 109, "ENC" },
- { 112, "CHDLC" },
- { 113, "LINUX_SLL" },
- { 114, "LTALK" },
- { 117, "PFLOG" },
- { 118, "CISCO_IOS" },
- { 119, "IEEE802_11_PRISM" },
- { 121, "HHDLC" },
- { 122, "IP_OVER_FC" },
- { 123, "SUNATM" },
- { 127, "IEEE802_11_RADIOTAP" },
- { 128, "TZSP" },
- { 129, "ARCNET_LINUX" },
- { 130, "JUNIPER_MLPPP" },
- { 131, "JUNIPER_MLFR" },
- { 133, "JUNIPER_GGSN" },
- { 135, "JUNIPER_ATM2" },
- { 136, "JUNIPER_SVCS" },
- { 137, "JUNIPER_ATM1" },
- { 138, "APPLE_IP_OVER_IEEE1394" },
- { 139, "MTP2_WITH_PHDR" },
- { 140, "MTP2" },
- { 141, "MTP3" },
- { 142, "SCCP" },
- { 143, "DOCSIS" },
- { 144, "LINUX_IRDA" },
- { 147, "USER_0" },
- { 148, "USER_1" },
- { 149, "USER_2" },
- { 150, "USER_3" },
- { 151, "USER_4" },
- { 152, "USER_5" },
- { 153, "USER_6" },
- { 154, "USER_7" },
- { 155, "USER_8" },
- { 156, "USER_9" },
- { 157, "USER_10" },
- { 158, "USER_11" },
- { 159, "USER_12" },
- { 160, "USER_13" },
- { 161, "USER_14" },
- { 162, "USER_15" },
- { 163, "IEEE802_11_AVS" },
- { 165, "BACNET_MS_TP" },
- { 166, "PPP_PPPD" },
- { 167, "JUNIPER_PPPOE" },
- { 169, "GPRS_LLC" },
- { 172, "GCOM_TIE1" },
- { 173, "GCOM_SERIAL" },
- { 177, "LINUX_LAPD" },
- { 178, "JUNIPER_ETHER" },
- { 179, "JUNIPER_PPP" },
- { 180, "JUNIPER_FRELAY" },
- { 181, "JUNIPER_CHDLC" },
- { 183, "JUNIPER_VP" },
- { 186, "USB" },
- { 187, "BLUETOOTH_HCI_H4" },
- { 188, "IEEE802_16_MAC_CPS" },
- { 189, "USB_LINUX" },
- { 190, "CAN20B" },
- { 192, "PPI" },
- { 195, "IEEE802_15_4" },
- { 196, "SITA" },
- { 197, "ERF" },
- { 199, "IPMB" },
- { 201, "BLUETOOTH_HCI_H4_WITH_PHDR" },
- { 202, "AX25_KISS" },
- { 203, "LAPD" },
- { 204, "PPP_WITH_DIR" },
- { 205, "C_HDLC_WITH_DIR" },
- { 206, "FRELAY_WITH_DIR" },
- { 209, "IPMB_LINUX" },
- { 210, "FLEXRAY" },
- { 211, "MOST" },
- { 212, "LIN" },
- { 213, "X2E_SERIAL" },
- { 214, "X2E_XORAYA" },
- { 215, "IEEE802_15_4_NONASK_PHY" },
- { 220, "USB_LINUX_MMAPPED" },
- { 224, "FC_2" },
- { 225, "FC_2_WITH_FRAME_DELIMS" },
- { 226, "IPNET" },
- { 227, "CAN_SOCKETCAN" },
- { 228, "IPV4" },
- { 229, "IPV6" },
- { 230, "IEEE802_15_4_NOFCS" },
- { 231, "DBUS" },
- { 235, "DVB_CI" },
- { 236, "MUX27010" },
- { 237, "STANAG_5066_D_PDU" },
- { 239, "NFLOG" },
- { 240, "NETANALYZER" },
- { 241, "NETANALYZER_TRANSPARENT" },
- { 242, "IPOIB" },
- { 243, "MPEG_2_TS" },
- { 244, "NG40" },
- { 245, "NFC_LLCP" },
- { 247, "INFINIBAND" },
- { 248, "SCTP" },
- { 249, "USBPCAP" },
- { 250, "RTAC_SERIAL" },
- { 251, "BLUETOOTH_LE_LL" },
- { 252, "WIRESHARK_UPPER_PDU" },
- { 253, "NETLINK" },
- { 254, "BLUETOOTH_LINUX_MONITOR" },
- { 255, "BLUETOOTH_BREDR_BB" },
- { 256, "BLUETOOTH_LE_LL_WITH_PHDR" },
- { 257, "PROFIBUS_DL" },
- { 258, "PKTAP" },
- { 259, "EPON" },
- { 260, "IPMI_HPM_2" },
- { 261, "ZWAVE_R1_R2" },
- { 262, "ZWAVE_R3" },
- { 263, "WATTSTOPPER_DLM" },
- { 264, "ISO_14443" },
- { 0, NULL }
-};
-
-
void proto_register_pcapng(void);
void proto_reg_handoff_pcapng(void);
@@ -1171,7 +1030,7 @@ static gint dissect_block(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
interface_description = (struct interface_description *) wmem_array_index(info->interfaces, interface_id);
TRY {
- call_dissector_with_data(pcap_pseudoheader_handle, tvb_new_subset(tvb, offset, captured_length, reported_length),
+ call_dissector_with_data(pcap_pktdata_handle, tvb_new_subset(tvb, offset, captured_length, reported_length),
pinfo, packet_data_tree, &interface_description->link_type);
}
CATCH_BOUNDS_ERRORS {
@@ -1209,7 +1068,7 @@ static gint dissect_block(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
interface_description = (struct interface_description *) wmem_array_index(info->interfaces, interface_id);
TRY {
- call_dissector_with_data(pcap_pseudoheader_handle, tvb_new_subset_length(tvb, offset, captured_length),
+ call_dissector_with_data(pcap_pktdata_handle, tvb_new_subset_length(tvb, offset, captured_length),
pinfo, packet_data_tree, &interface_description->link_type);
}
CATCH_BOUNDS_ERRORS {
@@ -1374,7 +1233,7 @@ static gint dissect_block(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
interface_description = (struct interface_description *) wmem_array_index(info->interfaces, interface_id);
TRY {
- call_dissector_with_data(pcap_pseudoheader_handle, tvb_new_subset(tvb, offset, captured_length, reported_length),
+ call_dissector_with_data(pcap_pktdata_handle, tvb_new_subset(tvb, offset, captured_length, reported_length),
pinfo, packet_data_tree, &interface_description->link_type);
}
CATCH_BOUNDS_ERRORS {
@@ -1950,7 +1809,7 @@ proto_register_pcapng(void)
proto_register_field_array(proto_pcapng, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- pcapng_handle = new_register_dissector("file-pcapng", dissect_pcapng, proto_pcapng);
+ new_register_dissector("file-pcapng", dissect_pcapng, proto_pcapng);
module = prefs_register_protocol(proto_pcapng, NULL);
prefs_register_static_text_preference(module, "version",
@@ -1970,6 +1829,7 @@ void
proto_reg_handoff_pcapng(void)
{
heur_dissector_add("wtap_file", dissect_pcapng_heur, "PCAPNG File", "pcapng_wtap", proto_pcapng, HEURISTIC_ENABLE);
+ pcap_pktdata_handle = find_dissector("pcap_pktdata");
}
/*