summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-usb.c
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2011-05-10 14:22:17 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2011-05-10 14:22:17 +0000
commit261875b92463085dd7db66a90828830b35b5577b (patch)
treea5f50da5ba0e8ec5160a351036ab0ec8dcafe46f /epan/dissectors/packet-usb.c
parentd33f1c24cc17bb3a0313d0af6a0a7b29052b361b (diff)
downloadwireshark-261875b92463085dd7db66a90828830b35b5577b.tar.gz
Allow both PPP and ISO/IEC 13818-1 over USB to be dissected using heuristics.
Resolves bug 4814. svn path=/trunk/; revision=37039
Diffstat (limited to 'epan/dissectors/packet-usb.c')
-rw-r--r--epan/dissectors/packet-usb.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c
index 5b0e900a92..2b981e25b7 100644
--- a/epan/dissectors/packet-usb.c
+++ b/epan/dissectors/packet-usb.c
@@ -40,6 +40,7 @@
#include <epan/tap.h>
#include <epan/conversation.h>
#include <epan/expert.h>
+#include <epan/prefs.h>
#include "packet-usb.h"
#include "packet-usb-hid.h"
@@ -151,9 +152,11 @@ static const int *usb_endpoint_fields[] = {
};
static int usb_tap = -1;
+static gboolean try_heuristics = TRUE;
static dissector_table_t usb_bulk_dissector_table;
static dissector_table_t usb_control_dissector_table;
+static heur_dissector_list_t heur_subdissector_list;
/* http://www.usb.org/developers/docs/USB_LANGIDs.pdf */
static const value_string usb_langid_vals[] = {
@@ -2006,7 +2009,10 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
pinfo->usb_conv_info=usb_conv_info;
next_tvb=tvb_new_subset_remaining(tvb, offset);
- if(dissector_try_uint(usb_bulk_dissector_table, usb_conv_info->interfaceClass, next_tvb, pinfo, parent)){
+ if (try_heuristics && dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, parent)) {
+ return;
+ }
+ else if(dissector_try_uint(usb_bulk_dissector_table, usb_conv_info->interfaceClass, next_tvb, pinfo, parent)){
return;
}
}
@@ -2356,6 +2362,7 @@ dissect_linux_usb_mmapped(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent)
void
proto_register_usb(void)
{
+ module_t *usb_module;
static hf_register_info hf[] = {
/* USB packet pseudoheader members */
@@ -2730,10 +2737,17 @@ proto_register_usb(void)
usb_bulk_dissector_table = register_dissector_table("usb.bulk",
"USB bulk endpoint", FT_UINT8, BASE_DEC);
-
+ register_heur_dissector_list("usb.bulk", &heur_subdissector_list);
usb_control_dissector_table = register_dissector_table("usb.control",
"USB control endpoint", FT_UINT8, BASE_DEC);
+ usb_module = prefs_register_protocol(proto_usb, NULL);
+ prefs_register_bool_preference(usb_module, "try_heuristics",
+ "Try heuristic sub-dissectors",
+ "Try to decode a packet using a heuristic sub-dissector before "
+ "attempting to dissect the packet using the \"usb.bulk\" dissector "
+ "table.", &try_heuristics);
+
usb_tap=register_tap("usb");
}