aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-11-22 13:13:22 -0500
committerMichael Mann <mmann78@netscape.net>2014-11-22 19:04:19 +0000
commit08cf40eb4a01ffe9820ec462ef8d32fc0e7dd08a (patch)
tree9128120c11f8bd89cee7246ea2d1ab3190a64e0c /epan/dissectors
parent534b5967c0cbedf1cf3fb50278d43f981d8b64ab (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')
-rw-r--r--epan/dissectors/packet-xml.c18
-rw-r--r--epan/dissectors/packet-xmpp.c8
2 files changed, 16 insertions, 10 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();
diff --git a/epan/dissectors/packet-xmpp.c b/epan/dissectors/packet-xmpp.c
index 35c7f2cecf..ba8c465305 100644
--- a/epan/dissectors/packet-xmpp.c
+++ b/epan/dissectors/packet-xmpp.c
@@ -377,6 +377,7 @@ static void
dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
xml_frame_t *xml_frame;
+ xml_frame_t *xml_dissector_frame = NULL;
gboolean out_packet;
conversation_t *conversation;
@@ -447,7 +448,8 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
xmpp_item = proto_tree_add_item(tree, proto_xmpp, tvb, 0, -1, ENC_NA);
xmpp_tree = proto_item_add_subtree(xmpp_item, ett_xmpp);
- call_dissector(xml_handle, tvb, pinfo, xmpp_tree);
+ /* Have XML dissector "return" it's xml_frame_t data */
+ call_dissector_with_data(xml_handle, tvb, pinfo, xmpp_tree, &xml_dissector_frame);
/* If XML dissector is disabled, we can't do much */
if (!proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(xml_handle))))
@@ -465,11 +467,11 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
return;
}
- if(!pinfo->private_data)
+ if(xml_dissector_frame == NULL)
return;
/*data from XML dissector*/
- xml_frame = ((xml_frame_t*)pinfo->private_data)->first_child;
+ xml_frame = xml_dissector_frame->first_child;
if(!xml_frame)
return;