diff options
-rw-r--r-- | epan/dissectors/packet-xml.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-xmpp.c | 10 |
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; |