aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2014-11-26 23:01:48 +0100
committerMichael Mann <mmann78@netscape.net>2014-11-26 23:12:08 +0000
commitcc893abb25cc568d17ae1afcb4822f521d1f9e30 (patch)
treecf0dea1c9b29d58563f6162b27b0cba9ca0faa6b
parentc2913d25a92dfc3e3c5c0020338018f895ff2b23 (diff)
XML: pass XML structure to caller through p_(add|get)_proto_data functions
Since ge3a04bb data parameter is used for the media-type string Bug: 10729 Change-Id: I3df640079a8bf57f4bd86a1baa08cbf9a3a7e1b3 Reviewed-on: https://code.wireshark.org/review/5511 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/dissectors/packet-xml.c7
-rw-r--r--epan/dissectors/packet-xmpp.c10
2 files changed, 9 insertions, 8 deletions
diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c
index d32494028c..77d8f01bcf 100644
--- a/epan/dissectors/packet-xml.c
+++ b/epan/dissectors/packet-xml.c
@@ -183,12 +183,11 @@ static void insert_xml_frame(xml_frame_t *parent, xml_frame_t *new_child)
}
static int
-dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
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)
@@ -231,8 +230,8 @@ dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
while(tvbparse_get(tt, want)) ;
- if (ret_frame != NULL)
- *ret_frame = current_frame; /* pass XML structure to the dissector calling XML */
+ /* Save XML structure in case it is useful for the caller (only XMPP for now) */
+ p_add_proto_data(pinfo->pool, pinfo, xml_ns.hf_tag, 0, current_frame);
return tvb_captured_length(tvb);
}
diff --git a/epan/dissectors/packet-xmpp.c b/epan/dissectors/packet-xmpp.c
index ba8c465305..2fa73ec49f 100644
--- a/epan/dissectors/packet-xmpp.c
+++ b/epan/dissectors/packet-xmpp.c
@@ -377,7 +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;
+ xml_frame_t *xml_dissector_frame;
gboolean out_packet;
conversation_t *conversation;
@@ -389,6 +389,8 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
xmpp_element_t *packet = NULL;
+ int proto_xml = dissector_handle_get_protocol_index(xml_handle);
+
/*check if desegment
* now it checks that last char is '>',
* TODO checks that first element in packet is closed*/
@@ -448,11 +450,10 @@ 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);
- /* Have XML dissector "return" it's xml_frame_t data */
- call_dissector_with_data(xml_handle, tvb, pinfo, xmpp_tree, &xml_dissector_frame);
+ call_dissector_with_data(xml_handle, tvb, pinfo, xmpp_tree, NULL);
/* 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))))
+ if (!proto_is_protocol_enabled(find_protocol_by_id(proto_xml)))
{
col_append_str(pinfo->cinfo, COL_INFO, "(XML dissector disabled, can't dissect XMPP)");
expert_add_info(pinfo, xmpp_item, &ei_xmpp_xml_disabled);
@@ -467,6 +468,7 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
return;
}
+ xml_dissector_frame = (xml_frame_t *)p_get_proto_data(pinfo->pool, pinfo, proto_xml, 0);
if(xml_dissector_frame == NULL)
return;