aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb.c
diff options
context:
space:
mode:
authorSean O. Stalley <sean.stalley@intel.com>2014-08-22 17:11:16 -0700
committerAnders Broman <a.broman58@gmail.com>2014-08-26 06:06:24 +0000
commit3439943d29684f25cd1a702a5c14112253940a15 (patch)
treef72c7918569f94fd0f5b162916473068123b83e3 /epan/dissectors/packet-usb.c
parent259e09e974cbceba19d5fd66df0a2cd682282704 (diff)
added try_dissect_linux_usb_pseudo_header_ext helper function
Change-Id: I05b0adaef2b979432e293bc26e2a122a0d3551fc Reviewed-on: https://code.wireshark.org/review/3848 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-usb.c')
-rw-r--r--epan/dissectors/packet-usb.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c
index 6e856cb996..89b21479b5 100644
--- a/epan/dissectors/packet-usb.c
+++ b/epan/dissectors/packet-usb.c
@@ -2928,6 +2928,23 @@ dissect_linux_usb_pseudo_header_ext(tvbuff_t *tvb, int offset,
return offset;
}
+static int
+try_dissect_linux_usb_pseudo_header_ext(tvbuff_t *tvb, int offset,
+ packet_info *pinfo _U_,
+ proto_tree *tree, guint8 header_info)
+{
+ /*
+ * If this has a 64-byte header, process the extra 16 bytes of
+ * pseudo-header information.
+ */
+ if ((header_info & USB_HEADER_IS_LINUX) &&
+ (header_info & USB_HEADER_IS_64_BYTES)) {
+ offset = dissect_linux_usb_pseudo_header_ext(tvb, offset, pinfo, tree);
+ }
+ return offset;
+}
+
+
/* dissect the usbpcap_buffer_packet_header and fill the conversation struct
this function does not handle the transfer-specific headers
return the number of bytes processed */
@@ -3397,14 +3414,7 @@ dissect_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
tvb_composite_append(setup_tvb, next_tvb);
}
- /*
- * If this has a 64-byte header, process the extra 16 bytes of
- * pseudo-header information.
- */
- if ((header_info & USB_HEADER_IS_LINUX) &&
- (header_info & USB_HEADER_IS_64_BYTES)) {
- offset = dissect_linux_usb_pseudo_header_ext(tvb, offset, pinfo, tree);
- }
+ offset = try_dissect_linux_usb_pseudo_header_ext(tvb, offset, pinfo, tree, header_info);
if (req_type != RQT_SETUP_TYPE_STANDARD) {
if (header_info & (USB_HEADER_IS_LINUX | USB_HEADER_IS_64_BYTES)) {
@@ -3433,16 +3443,10 @@ dissect_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
/* Skip setup/isochronous header - it's not applicable */
proto_tree_add_item(tree, hf_usb_urb_unused_setup_header, tvb, offset, 8, ENC_NA);
offset += 8;
-
- /*
- * If this has a 64-byte header, process the extra 16 bytes of
- * pseudo-header information.
- */
- if (header_info & USB_HEADER_IS_64_BYTES) {
- offset = dissect_linux_usb_pseudo_header_ext(tvb, offset, pinfo, tree);
- }
}
+ offset = try_dissect_linux_usb_pseudo_header_ext(tvb, offset, pinfo, tree, header_info);
+
}
} else {
/* this is a response */
@@ -3453,15 +3457,7 @@ dissect_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
offset += 8;
}
- /*
- * If this has a 64-byte header, process the extra 16 bytes of
- * pseudo-header information.
- */
- if ((header_info & USB_HEADER_IS_LINUX) &&
- (header_info & USB_HEADER_IS_64_BYTES)) {
- offset = dissect_linux_usb_pseudo_header_ext(tvb, offset, pinfo, tree);
- }
-
+ offset = try_dissect_linux_usb_pseudo_header_ext(tvb, offset, pinfo, tree, header_info);
/* Check if this is status stage */
if ((usb_conv_info->usb_trans_info) &&