diff options
author | Dario Lombardo <lomato@gmail.com> | 2016-10-28 23:00:24 +0200 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2016-10-30 08:47:43 +0000 |
commit | c9b5b6c13b7ad8e3172023507797202ea96134c2 (patch) | |
tree | 09121160cc1794245387e9b8cb60163c9ed4f5a8 /epan/dissectors/packet-hpfeeds.c | |
parent | b86d72a0d18a32dd18d45cdf4a4b738e64780507 (diff) |
hpfeeds: restore channel name in tree.
The channel name is also set in pinfo->match_string to be printed
by the json subdissector.
Change-Id: I9a1c4576ce6d253ef415bda7392b37f2c063c2db
Reviewed-on: https://code.wireshark.org/review/18560
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-hpfeeds.c')
-rw-r--r-- | epan/dissectors/packet-hpfeeds.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/epan/dissectors/packet-hpfeeds.c b/epan/dissectors/packet-hpfeeds.c index 2291ba4dd1..ffea69a707 100644 --- a/epan/dissectors/packet-hpfeeds.c +++ b/epan/dissectors/packet-hpfeeds.c @@ -179,6 +179,8 @@ dissect_hpfeeds_publish_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 len = 0; heur_dtbl_entry_t *hdtbl_entry; tvbuff_t *next_tvb; + const guint8 *channelname = NULL; + const char* save_match_string = NULL; len = tvb_get_guint8(tvb, offset); proto_tree_add_item(tree, hf_hpfeeds_ident_len, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -187,15 +189,27 @@ dissect_hpfeeds_publish_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += len; len = tvb_get_guint8(tvb, offset); proto_tree_add_item(tree, hf_hpfeeds_chan_len, tvb, offset, 1, ENC_BIG_ENDIAN); - offset += len + 1; + offset += 1; - next_tvb = tvb_new_subset_remaining(tvb, offset); + /* get the channel name as ephemeral string to pass it to the heuristic decoders */ + proto_tree_add_item_ret_string(tree, hf_hpfeeds_channel, tvb, offset, len, ENC_ASCII|ENC_NA, + wmem_packet_scope(), &channelname); + offset += len; /* try the heuristic dissectors */ if (try_heuristic) { + /* save the current match_string before calling the subdissectors */ + if (pinfo->match_string) + save_match_string = pinfo->match_string; + pinfo->match_string = channelname; + + next_tvb = tvb_new_subset_remaining(tvb, offset); + if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, NULL)) { return; } + + pinfo->match_string = save_match_string; } /* heuristic failed. Print remaining bytes as flat payload */ |