diff options
author | Michael Mann <mmann78@netscape.net> | 2014-11-22 13:13:22 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-11-22 19:04:19 +0000 |
commit | 08cf40eb4a01ffe9820ec462ef8d32fc0e7dd08a (patch) | |
tree | 9128120c11f8bd89cee7246ea2d1ab3190a64e0c /epan/dissectors/packet-xml.c | |
parent | 534b5967c0cbedf1cf3fb50278d43f981d8b64ab (diff) |
Use dissector data to "return" XML data to XMPP dissector.
Change-Id: I9abdc8c3deed35131af1537733d624d5cfced182
Reviewed-on: https://code.wireshark.org/review/5443
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-xml.c')
-rw-r--r-- | epan/dissectors/packet-xml.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c index e6a298dae5..d32494028c 100644 --- a/epan/dissectors/packet-xml.c +++ b/epan/dissectors/packet-xml.c @@ -182,12 +182,13 @@ static void insert_xml_frame(xml_frame_t *parent, xml_frame_t *new_child) parent->last_child = new_child; } -static void -dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tvbparse_t *tt; static GPtrArray *stack; xml_frame_t *current_frame; + xml_frame_t **ret_frame = (xml_frame_t**)data; const char *colinfo_str; if (stack != NULL) @@ -230,13 +231,16 @@ dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) while(tvbparse_get(tt, want)) ; - pinfo->private_data = current_frame; /* pass XML structure to the dissector calling XML */ + if (ret_frame != NULL) + *ret_frame = current_frame; /* pass XML structure to the dissector calling XML */ + + return tvb_captured_length(tvb); } -static gboolean dissect_xml_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +static gboolean dissect_xml_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { if (tvbparse_peek(tvbparse_init(tvb, 0, -1, NULL, want_ignore), want_heur)) { - dissect_xml(tvb, pinfo, tree); + dissect_xml(tvb, pinfo, tree, data); return TRUE; } else if (pref_heuristic_unicode) { /* XXX - UCS-2, or UTF-16? */ @@ -245,7 +249,7 @@ static gboolean dissect_xml_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree * tvb_set_free_cb(unicode_tvb, g_free); if (tvbparse_peek(tvbparse_init(unicode_tvb, 0, -1, NULL, want_ignore), want_heur)) { add_new_data_source(pinfo, unicode_tvb, "UTF8"); - dissect_xml(unicode_tvb, pinfo, tree); + dissect_xml(unicode_tvb, pinfo, tree, data); return TRUE; } } @@ -1481,7 +1485,7 @@ proto_register_xml(void) g_array_free(ett_arr, TRUE); - register_dissector("xml", dissect_xml, xml_ns.hf_tag); + new_register_dissector("xml", dissect_xml, xml_ns.hf_tag); init_xml_parser(); |