aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2014-04-13 18:49:16 +0200
committerMartin Kaiser <wireshark@kaiser.cx>2014-04-14 13:48:34 +0000
commitdc97682cca887fd91c33bde899382f366c1a6a7f (patch)
treee4338109bdec08fda7fe4ecb5eb654ed3a650d8a
parent01d2ca6a7411fb8ddd3edc7a7d1ecd076d46c934 (diff)
remove bus_id parameter from try_dissect_next_protocol()
read the transfer type from the usb conversation instead Change-Id: I246a64f72b8c38b98337f463ee137e30fc9b504d Reviewed-on: https://code.wireshark.org/review/1112 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
-rw-r--r--epan/dissectors/packet-usb.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c
index d9ab005e88..61314ea3b3 100644
--- a/epan/dissectors/packet-usb.c
+++ b/epan/dissectors/packet-usb.c
@@ -2376,7 +2376,7 @@ static const value_string bmrequesttype_recipient_vals[] = {
static gint
try_dissect_next_protocol(proto_tree *tree, proto_tree *parent, tvbuff_t *next_tvb, gint offset, packet_info *pinfo,
- usb_conv_info_t *usb_conv_info, gint type_2, guint8 urb_type, guint16 bus_id, guint16 device_address,
+ usb_conv_info_t *usb_conv_info, gint type_2, guint8 urb_type, guint16 device_address,
device_product_data_t *device_product_data, device_protocol_data_t *device_protocol_data)
{
wmem_tree_key_t key[4];
@@ -2385,10 +2385,11 @@ try_dissect_next_protocol(proto_tree *tree, proto_tree *parent, tvbuff_t *next_t
guint32 k_bus_id;
/* try dissect by "usb.device" */
- if (tvb_length(next_tvb) > 0 && !dissector_try_uint_new(device_to_dissector, (guint32) (bus_id << 8 | device_address), next_tvb, pinfo, parent, FALSE, usb_conv_info)) {
+ if (tvb_length(next_tvb) > 0 &&
+ !dissector_try_uint_new(device_to_dissector, (guint32) (usb_conv_info->bus_id << 8 | device_address), next_tvb, pinfo, parent, FALSE, usb_conv_info)) {
k_frame_number = pinfo->fd->num;
k_device_address = device_address;
- k_bus_id = bus_id;
+ k_bus_id = usb_conv_info->bus_id;
key[0].length = 1;
key[0].key = &k_device_address;
@@ -2402,14 +2403,14 @@ try_dissect_next_protocol(proto_tree *tree, proto_tree *parent, tvbuff_t *next_t
/* try dissect by "usb.protocol" */
if (!device_protocol_data)
device_protocol_data = (device_protocol_data_t *)wmem_tree_lookup32_array_le(device_to_protocol_table, key);
- if (device_protocol_data && device_protocol_data->bus_id == bus_id &&
+ if (device_protocol_data && device_protocol_data->bus_id == usb_conv_info->bus_id &&
device_protocol_data->device_address == device_address &&
dissector_try_uint_new(protocol_to_dissector, (guint32) device_protocol_data->protocol, next_tvb, pinfo, parent, FALSE, usb_conv_info)) {
offset += tvb_length(next_tvb);
} else { /* try dissect by "usb.product" */
if (!device_product_data)
device_product_data = (device_product_data_t *)wmem_tree_lookup32_array_le(device_to_product_table, key);
- if (device_product_data && device_product_data->bus_id == bus_id &&
+ if (device_product_data && device_product_data->bus_id == usb_conv_info->bus_id &&
device_product_data->device_address == device_address &&
dissector_try_uint_new(product_to_dissector, (guint32) (device_product_data->vendor << 16 | device_product_data->product),
next_tvb, pinfo, parent, FALSE, usb_conv_info)) {
@@ -2974,7 +2975,7 @@ dissect_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
else
next_tvb = tvb_new_subset_remaining(tvb, offset - 7);
- offset = try_dissect_next_protocol(tree, parent, next_tvb, offset, pinfo, usb_conv_info, type_2, urb_type, bus_id, device_address, NULL, NULL);
+ offset = try_dissect_next_protocol(tree, parent, next_tvb, offset, pinfo, usb_conv_info, type_2, urb_type, device_address, NULL, NULL);
}
} else {
/* this is a response */
@@ -3039,7 +3040,7 @@ dissect_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
/* Try to find a non-standard specific dissector */
if (tvb_reported_length_remaining(tvb, offset) != 0) {
next_tvb = tvb_new_subset_remaining(tvb, offset);
- new_offset = try_dissect_next_protocol(tree, parent, next_tvb, offset, pinfo, usb_conv_info, type_2, urb_type, bus_id, device_address, NULL, NULL);
+ new_offset = try_dissect_next_protocol(tree, parent, next_tvb, offset, pinfo, usb_conv_info, type_2, urb_type, device_address, NULL, NULL);
if (new_offset > offset)
offset = new_offset;
}
@@ -3343,7 +3344,7 @@ dissect_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
if (tvb_length_remaining(tvb, offset) > 0) {
next_tvb = tvb_new_subset_remaining(tvb, offset);
- offset = try_dissect_next_protocol(tree, parent, next_tvb, offset, pinfo, usb_conv_info, type_2, urb_type, bus_id, device_address, device_product_data, device_protocol_data);
+ offset = try_dissect_next_protocol(tree, parent, next_tvb, offset, pinfo, usb_conv_info, type_2, urb_type, device_address, device_product_data, device_protocol_data);
}
if (tvb_length_remaining(tvb, offset) > 0) {