change try_dissect_next_protocol() such that its parameter is the

top-most tree on which it operates

this gives callers more control over where things are displayed

Change-Id: I8cdc07b4f3569bca728781fb709e2a2bb37c433b
Reviewed-on: https://code.wireshark.org/review/7004
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
This commit is contained in:
Martin Kaiser 2015-02-01 18:08:15 +01:00
parent 1648d6e283
commit a09765955c
1 changed files with 9 additions and 15 deletions

View File

@ -2690,11 +2690,9 @@ try_dissect_next_protocol(proto_tree *tree, tvbuff_t *next_tvb, packet_info *pin
heur_dtbl_entry_t *hdtbl_entry;
heur_dissector_list_t heur_subdissector_list = NULL;
dissector_table_t usb_dissector_table = NULL;
proto_item *sub_item;
device_product_data_t *device_product_data;
device_protocol_data_t *device_protocol_data;
guint8 ctrl_recip;
proto_tree *parent;
/* if we select the next dissector based on a class,
this is the (device or interface) class we're using */
guint32 usb_class;
@ -2702,21 +2700,19 @@ try_dissect_next_protocol(proto_tree *tree, tvbuff_t *next_tvb, packet_info *pin
if (tvb_captured_length(next_tvb) == 0)
return 0;
parent = proto_tree_get_parent_tree(tree);
if (!usb_conv_info) {
/*
* Not enough information to choose the next protocol.
* XXX - is there something we can still do here?
*/
call_dissector(data_handle, next_tvb, pinfo, parent);
call_dissector(data_handle, next_tvb, pinfo, tree);
return tvb_captured_length(next_tvb);
}
/* try dissect by "usb.device" */
ret = dissector_try_uint_new(device_to_dissector,
(guint32)(usb_conv_info->bus_id<<16 | usb_conv_info->device_address),
next_tvb, pinfo, parent, TRUE, usb_conv_info);
next_tvb, pinfo, tree, TRUE, usb_conv_info);
if (ret)
return tvb_captured_length(next_tvb);
@ -2741,7 +2737,7 @@ try_dissect_next_protocol(proto_tree *tree, tvbuff_t *next_tvb, packet_info *pin
device_protocol_data->device_address == usb_conv_info->device_address) {
ret = dissector_try_uint_new(protocol_to_dissector,
(guint32)device_protocol_data->protocol,
next_tvb, pinfo, parent, TRUE, usb_conv_info);
next_tvb, pinfo, tree, TRUE, usb_conv_info);
if (ret)
return tvb_captured_length(next_tvb);
}
@ -2752,7 +2748,7 @@ try_dissect_next_protocol(proto_tree *tree, tvbuff_t *next_tvb, packet_info *pin
device_product_data->device_address == usb_conv_info->device_address) {
ret = dissector_try_uint_new(product_to_dissector,
(guint32)(device_product_data->vendor<<16 | device_product_data->product),
next_tvb, pinfo, parent, TRUE, usb_conv_info);
next_tvb, pinfo, tree, TRUE, usb_conv_info);
if (ret)
return tvb_captured_length(next_tvb);
}
@ -2839,8 +2835,6 @@ try_dissect_next_protocol(proto_tree *tree, tvbuff_t *next_tvb, packet_info *pin
}
usb_tap_queue_packet(pinfo, urb_type, usb_conv_info);
sub_item = proto_tree_add_uint(tree, hf_usb_bInterfaceClass, next_tvb, 0, 0, usb_conv_info->interfaceClass);
PROTO_ITEM_SET_GENERATED(sub_item);
break;
default:
@ -2849,7 +2843,7 @@ try_dissect_next_protocol(proto_tree *tree, tvbuff_t *next_tvb, packet_info *pin
if (try_heuristics && heur_subdissector_list) {
ret = dissector_try_heuristic(heur_subdissector_list,
next_tvb, pinfo, parent, &hdtbl_entry, usb_conv_info);
next_tvb, pinfo, tree, &hdtbl_entry, usb_conv_info);
if (ret)
return tvb_captured_length(next_tvb);
}
@ -2866,7 +2860,7 @@ try_dissect_next_protocol(proto_tree *tree, tvbuff_t *next_tvb, packet_info *pin
}
ret = dissector_try_uint_new(usb_dissector_table, usb_class,
next_tvb, pinfo, parent, TRUE, usb_conv_info);
next_tvb, pinfo, tree, TRUE, usb_conv_info);
if (ret)
return tvb_captured_length(next_tvb);
}
@ -2894,7 +2888,7 @@ dissect_usb_setup_response(packet_info *pinfo, proto_tree *tree,
/* Try to find a non-standard specific dissector */
if (tvb_reported_length_remaining(tvb, offset) > 0) {
next_tvb = tvb_new_subset_remaining(tvb, offset);
offset += try_dissect_next_protocol(tree, next_tvb, pinfo, usb_conv_info, urb_type);
offset += try_dissect_next_protocol(parent, next_tvb, pinfo, usb_conv_info, urb_type);
}
length_remaining = tvb_reported_length_remaining(tvb, offset);
@ -3021,7 +3015,7 @@ dissect_usb_setup_request(packet_info *pinfo, proto_tree *tree,
tvb_composite_finalize(next_tvb);
offset += try_dissect_next_protocol(tree, next_tvb, pinfo, usb_conv_info, urb_type);
offset += try_dissect_next_protocol(parent, next_tvb, pinfo, usb_conv_info, urb_type);
return offset;
}
@ -3733,7 +3727,7 @@ dissect_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
if (tvb_captured_length_remaining(tvb, offset) > 0) {
next_tvb = tvb_new_subset_remaining(tvb, offset);
offset += try_dissect_next_protocol(tree, next_tvb, pinfo, usb_conv_info, urb_type);
offset += try_dissect_next_protocol(parent, next_tvb, pinfo, usb_conv_info, urb_type);
}
if (tvb_captured_length_remaining(tvb, offset) > 0) {