Skip to content

Commit

Permalink
From ENDOH Akira:
Browse files Browse the repository at this point in the history
  Add heuristic dissection of XML to SIP bodies with unknown media_type.


svn path=/trunk/; revision=17247
  • Loading branch information
Luis Ontanon committed Feb 11, 2006
1 parent f535b4c commit 009b5f7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
28 changes: 17 additions & 11 deletions epan/dissectors/packet-sip.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ static guint sip_is_packet_resend(packet_info *pinfo,
* http://www.iana.org/assignments/media-types/index.html */
static dissector_table_t media_type_dissector_table;

static heur_dissector_list_t heur_subdissector_list;

#define SIP2_HDR "SIP/2.0"
#define SIP2_HDR_LEN (strlen (SIP2_HDR))

Expand Down Expand Up @@ -1686,16 +1688,20 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
}
if ( found_match != TRUE )
{
int tmp_offset = 0;
while (tvb_offset_exists(next_tvb, tmp_offset)) {
tvb_find_line_end(next_tvb, tmp_offset, -1, &next_offset, FALSE);
linelen = next_offset - tmp_offset;
if(message_body_tree) {
proto_tree_add_text(message_body_tree, next_tvb, tmp_offset, linelen,
"%s", tvb_format_text(next_tvb, tmp_offset, linelen));
}
tmp_offset = next_offset;
}/* end while */
if (!(dissector_try_heuristic(heur_subdissector_list,
next_tvb, pinfo, message_body_tree))) {
int tmp_offset = 0;
while (tvb_offset_exists(next_tvb, tmp_offset)) {
tvb_find_line_end(next_tvb, tmp_offset, -1, &next_offset, FALSE);
linelen = next_offset - tmp_offset;
if(message_body_tree) {
proto_tree_add_text(message_body_tree, next_tvb,
tmp_offset, linelen, "%s",
tvb_format_text(next_tvb, tmp_offset, linelen));
}
tmp_offset = next_offset;
}/* end while */
}
}
offset += datalen;
}
Expand Down Expand Up @@ -2734,7 +2740,7 @@ void proto_register_sip(void)
&sip_desegment_body);

register_init_routine(&sip_init_protocol);

register_heur_dissector_list("sip", &heur_subdissector_list);
/* Register for tapping */
sip_tap = register_tap("sip");
}
Expand Down
3 changes: 2 additions & 1 deletion epan/dissectors/packet-xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,8 @@ static void init_xml_names(void) {

static void apply_prefs(void) {
if (pref_heuristic) {
heur_dissector_add("http", dissect_xml_heur, xml_ns.hf_tag);
heur_dissector_add("http", dissect_xml_heur, xml_ns.hf_tag);
heur_dissector_add("sip", dissect_xml_heur, xml_ns.hf_tag);
heur_dissector_add("media", dissect_xml_heur, xml_ns.hf_tag);
}
}
Expand Down

0 comments on commit 009b5f7

Please sign in to comment.