diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-08-21 23:33:23 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-08-22 06:34:06 +0000 |
commit | 5825f59ddccb8af2b4a06356f61195dd26c977d7 (patch) | |
tree | 5250e297808ccc0dd7dd36c688dbba8d53368c75 /epan/dissectors/packet-media.c | |
parent | efdcb25360621e5ac14f276b37964f27f4ce0ba4 (diff) |
Pass an HTTP message type to all HTTP subdissectors.
This gets complicated, because those subdissectors might be called by
other dissectors as well. We need a better way of passing that sort of
out-of-bound information.
Pull some routines used for processing Content-Type parameters into
common code; we can't guarantee that the media parameters passed in
would be writable (passing it as *the* data hid that; passing a
structure with that *and* the HTTP message type revealed it), so don't
convert it to lower-case in place.
Use that information, if available, to determine whether an IPP message
is a requet or a response.
Change-Id: I4bccc9f05cd0b14ad445be7ab37b3d884d841325
Reviewed-on: https://code.wireshark.org/review/17216
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-media.c')
-rw-r--r-- | epan/dissectors/packet-media.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/epan/dissectors/packet-media.c b/epan/dissectors/packet-media.c index 5e6355f060..351e460773 100644 --- a/epan/dissectors/packet-media.c +++ b/epan/dissectors/packet-media.c @@ -32,6 +32,8 @@ #include <wsutil/str_util.h> +#include "packet-http.h" + void proto_register_media(void); /* proto_media cannot be static because it's referenced in the @@ -48,6 +50,7 @@ dissect_media(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree, void* data) int bytes; proto_item *ti; proto_tree *media_tree = 0; + http_message_info_t *message_info = (http_message_info_t *)data; heur_dtbl_entry_t *hdtbl_entry; if (dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, tree, &hdtbl_entry, data)) { @@ -63,11 +66,12 @@ dissect_media(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree, void* data) ti = proto_tree_add_item(tree, proto_media, tvb, 0, -1, ENC_NA); media_tree = proto_item_add_subtree(ti, ett_media); - if (data) { + if (message_info != NULL && message_info->media_str != NULL) { /* The media type has parameters */ + proto_tree_add_bytes_format_value(media_tree, hf_media_type, tvb, 0, bytes, NULL, "%s; %s (%d byte%s)", - pinfo->match_string, (char *)data, + pinfo->match_string, message_info->media_str, bytes, plurality(bytes, "", "s")); } else { /* The media type has no parameters */ |