From 56aa05227f6bc18211d9ddec669af77ba5cd78e9 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sat, 12 Dec 2015 23:38:21 -0500 Subject: Create a way to register "capture" dissectors. Capture dissectors could be architected like dissection dissectors, with tables and subtables and possibly using tvbs to pass there data instead of raw byte arrays. This is a first step towards that by refactoring capture_info_packet() to work off of a "capture dissector table" Registering the capture dissection functions instead of calling them directly also clears up a bunch of dissector header files who sole purpose was providing the capture dissection function definition. Change-Id: I10e9b79e061f32d2572f009823601d4f048d37aa Reviewed-on: https://code.wireshark.org/review/12581 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-eth.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'epan/dissectors/packet-eth.c') diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c index a8ca40162c..c04995ca22 100644 --- a/epan/dissectors/packet-eth.c +++ b/epan/dissectors/packet-eth.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "packet-eth.h" #include "packet-ieee8023.h" @@ -191,7 +192,7 @@ eth_build_filter(packet_info *pinfo) #define ETHERNET_SNAP 3 void -capture_eth(const guchar *pd, int offset, int len, packet_counts *ld) +capture_eth(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_) { guint16 etype, length; int ethhdr_type; /* the type of ethernet frame */ @@ -211,7 +212,7 @@ capture_eth(const guchar *pd, int offset, int len, packet_counts *ld) if ((pd[offset] == 0x01 || pd[offset] == 0x0C) && pd[offset+1] == 0x00 && pd[offset+2] == 0x0C && pd[offset+3] == 0x00 && pd[offset+4] == 0x00) { - capture_isl(pd, offset, len, ld); + capture_isl(pd, offset, len, ld, pseudo_header); return; } } @@ -274,7 +275,7 @@ capture_eth(const guchar *pd, int offset, int len, packet_counts *ld) capture_ipx(ld); break; case ETHERNET_802_2: - capture_llc(pd, offset, len, ld); + capture_llc(pd, offset, len, ld, pseudo_header); break; case ETHERNET_II: capture_ethertype(etype, pd, offset, len, ld); @@ -1013,6 +1014,7 @@ proto_register_eth(void) register_dissector("eth_withoutfcs", dissect_eth_withoutfcs, proto_eth); register_dissector("eth_withfcs", dissect_eth_withfcs, proto_eth); register_dissector("eth", dissect_eth_maybefcs, proto_eth); + register_capture_dissector(WTAP_ENCAP_ETHERNET, capture_eth, proto_eth); eth_tap = register_tap("eth"); register_conversation_table(proto_eth, TRUE, eth_conversation_packet, eth_hostlist_packet); -- cgit v1.2.3