From 6a75fbab650e4e4e2f125f06a4fd5a2ca0bfcc3e Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 18 Oct 2006 09:30:28 +0000 Subject: [PATCH] create a dissector table for the bulk input/output packet types svn path=/trunk/; revision=19588 --- epan/dissectors/packet-usb.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c index 71b5a967cf..f46ca3e453 100644 --- a/epan/dissectors/packet-usb.c +++ b/epan/dissectors/packet-usb.c @@ -99,6 +99,9 @@ static gint ett_usb_setup_bmrequesttype = -1; static gint ett_descriptor_device = -1; +static dissector_table_t usb_bulk_dissector_table; + + /* This is the endpoint number user for "no endpoint" or the fake endpoint * for the host side since we need two endpoints to manage conversations * properly. @@ -890,6 +893,15 @@ dissect_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent) item=proto_tree_add_uint(tree, hf_usb_bInterfaceClass, tvb, offset, 0, usb_conv_info->class); PROTO_ITEM_SET_GENERATED(item); + if(tvb_length_remaining(tvb, offset)){ + tvbuff_t *next_tvb; + + pinfo->usb_conv_info=usb_conv_info; + next_tvb=tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset)); + if(dissector_try_port(usb_bulk_dissector_table, usb_conv_info->class, next_tvb, pinfo, parent)){ + return; + } + } } break; case URB_BULK_OUTPUT: @@ -898,6 +910,15 @@ dissect_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent) item=proto_tree_add_uint(tree, hf_usb_bInterfaceClass, tvb, offset, 0, usb_conv_info->class); PROTO_ITEM_SET_GENERATED(item); + if(tvb_length_remaining(tvb, offset)){ + tvbuff_t *next_tvb; + + pinfo->usb_conv_info=usb_conv_info; + next_tvb=tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset)); + if(dissector_try_port(usb_bulk_dissector_table, usb_conv_info->class, next_tvb, pinfo, parent)){ + return; + } + } } break; case URB_CONTROL_INPUT: @@ -1243,6 +1264,10 @@ proto_register_usb(void) proto_register_subtree_array(usb_subtrees, array_length(usb_subtrees)); register_dissector("usb", dissect_usb, proto_usb); + + usb_bulk_dissector_table = register_dissector_table("usb.bulk", + "USB bulk endpoint", FT_UINT8, BASE_DEC); + } void