diff options
author | Michael Mann <mmann78@netscape.net> | 2015-12-13 16:54:16 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-12-14 12:17:49 +0000 |
commit | 0960ac4dfdbfba5a81c56a49cfc6201ecd8f48e3 (patch) | |
tree | 3d88cd321da2fade206b9ccddff22b70ecdfae28 /epan/dissectors/packet-fddi.c | |
parent | 9319357f5e27c10f2d29e78fcdf9d323c2af36b0 (diff) |
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 <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-fddi.c')
-rw-r--r-- | epan/dissectors/packet-fddi.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/epan/dissectors/packet-fddi.c b/epan/dissectors/packet-fddi.c index afb6b92535..cd28e8ec1e 100644 --- a/epan/dissectors/packet-fddi.c +++ b/epan/dissectors/packet-fddi.c @@ -199,15 +199,14 @@ fddi_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, con return 1; } -static void +static gboolean capture_fddi(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_) { int fc; - if (!BYTES_ARE_IN_FRAME(0, len, FDDI_HEADER_SIZE + FDDI_PADDING)) { - ld->other++; - return; - } + if (!BYTES_ARE_IN_FRAME(0, len, FDDI_HEADER_SIZE + FDDI_PADDING)) + return FALSE; + offset = FDDI_PADDING + FDDI_HEADER_SIZE; fc = (int) pd[FDDI_P_FC+FDDI_PADDING]; @@ -232,14 +231,10 @@ capture_fddi(const guchar *pd, int offset, int len, packet_counts *ld, const uni case FDDI_FC_LLC_ASYNC + 13 : case FDDI_FC_LLC_ASYNC + 14 : case FDDI_FC_LLC_ASYNC + 15 : - capture_llc(pd, offset, len, ld, pseudo_header); - return; - default : - ld->other++; - return; - + return capture_llc(pd, offset, len, ld, pseudo_header); } /* fc */ + return FALSE; } /* capture_fddi */ static const gchar * @@ -519,9 +514,6 @@ proto_register_fddi(void) */ register_dissector("fddi", dissect_fddi_not_bitswapped, proto_fddi); - register_capture_dissector(WTAP_ENCAP_FDDI, capture_fddi, proto_fddi); - register_capture_dissector(WTAP_ENCAP_FDDI_BITSWAPPED, capture_fddi, proto_fddi); - fddi_module = prefs_register_protocol(proto_fddi, NULL); prefs_register_bool_preference(fddi_module, "padding", "Add 3-byte padding to all FDDI packets", @@ -552,6 +544,9 @@ proto_reg_handoff_fddi(void) create_dissector_handle(dissect_fddi_bitswapped, proto_fddi); dissector_add_uint("wtap_encap", WTAP_ENCAP_FDDI_BITSWAPPED, fddi_bitswapped_handle); + + register_capture_dissector("wtap_encap", WTAP_ENCAP_FDDI, capture_fddi, proto_fddi); + register_capture_dissector("wtap_encap", WTAP_ENCAP_FDDI_BITSWAPPED, capture_fddi, proto_fddi); } /* |