From 0960ac4dfdbfba5a81c56a49cfc6201ecd8f48e3 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sun, 13 Dec 2015 16:54:16 -0500 Subject: Create capture dissector tables. They are modeled after dissection dissector tables, but for the moment, don't have/need the flexibility. They are intended to be much simpler/faster than full dissection. The two most used/needed are "wtap_encap" and "ethertype", so they were the basis of starting to use and test capture dissector table API. Others may be added in the future. The "capture dissector" function signature needed a bit of tweeking to handling "claiming" of a packet. The current application of this is capture functions returning TRUE if they affected a "type" of packet count. Returning FALSE ends up considering the packet an "other" type. Change-Id: I81d06a6ccb2c03665f087258a46b9d78d513d6cd Reviewed-on: https://code.wireshark.org/review/12607 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-ethertype.c | 51 ++------------------------------------ 1 file changed, 2 insertions(+), 49 deletions(-) (limited to 'epan/dissectors/packet-ethertype.c') diff --git a/epan/dissectors/packet-ethertype.c b/epan/dissectors/packet-ethertype.c index 72ddce9ea6..88bbcaceee 100644 --- a/epan/dissectors/packet-ethertype.c +++ b/epan/dissectors/packet-ethertype.c @@ -32,16 +32,8 @@ #include #include #include -#include "packet-bpq.h" +#include #include "packet-eth.h" -#include "packet-ip.h" -#include "packet-ipv6.h" -#include "packet-ipx.h" -#include "packet-vlan.h" -#include "packet-ieee8021ah.h" -#include "packet-vines.h" -#include "packet-llc.h" - void proto_register_ethertype(void); void proto_reg_handoff_ethertype(void); @@ -204,46 +196,6 @@ static void add_dix_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh int trailer_id, tvbuff_t *tvb, tvbuff_t *next_tvb, int offset_after_etype, guint length_before, gint fcs_len); -void -capture_ethertype(guint16 etype, const guchar *pd, int offset, int len, - packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_) -{ - switch (etype) { - case ETHERTYPE_ARP: - ld->arp++; - break; - case ETHERTYPE_IP: - capture_ip(pd, offset, len, ld, pseudo_header); - break; - case ETHERTYPE_IPv6: - capture_ipv6(pd, offset, len, ld, pseudo_header); - break; - case ETHERTYPE_IPX: - capture_ipx(pd, offset, len, ld, pseudo_header); - break; - case ETHERTYPE_VLAN: - capture_vlan(pd, offset, len, ld, pseudo_header); - break; - case ETHERTYPE_IEEE_802_1AD: - case ETHERTYPE_IEEE_802_1AH: - capture_ieee8021ah(pd, offset, len, ld, pseudo_header); - break; - case ETHERTYPE_VINES_IP: - case ETHERTYPE_VINES_ECHO: - capture_vines(pd, offset, len, ld, pseudo_header); - break; - case ETHERTYPE_BPQ: - capture_bpq(pd, offset, len, ld, pseudo_header); - break; - case ETHERTYPE_JUMBO_LLC: - capture_llc(pd, offset, len, ld, pseudo_header); - break; - default: - ld->other++; - break; - } -} - /* void ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype, @@ -400,6 +352,7 @@ proto_register_ethertype(void) /* subdissector code */ ethertype_dissector_table = register_dissector_table("ethertype", "Ethertype", FT_UINT16, BASE_HEX, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE); + register_capture_dissector_table("ethertype", "Ethertype"); register_decode_as(ðertype_da); } -- cgit v1.2.3