Ethereal-dev: [Ethereal-dev] [Patch] Show/skip profile-specific extensions in RTCP SR/RR repor

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Martin Mathieson <martin.mathieson@xxxxxxxxxxxx>
Date: Fri, 26 May 2006 16:03:41 +0100
Hi,

This patch:
- shows profile-specific extension data at the end of SR/RR reports (if packet length has not yet been reached after parsing normal data) and advances offset (further packets were not recognised+dissected as this data wasn't being skipped).

Regards,
Martin

P.S.  I see there have been no SVN commits all week - is there a problem?
Index: epan/dissectors/packet-rtcp.c
===================================================================
--- epan/dissectors/packet-rtcp.c	(revision 18189)
+++ epan/dissectors/packet-rtcp.c	(working copy)
@@ -300,6 +300,7 @@
 static int hf_rtcp_blp               = -1;
 static int hf_rtcp_padding_count     = -1;
 static int hf_rtcp_padding_data      = -1;
+static int hf_rtcp_profile_specific_extension = -1;
 static int hf_rtcp_app_poc1_subtype  = -1;
 static int hf_rtcp_app_poc1_sip_uri  = -1;
 static int hf_rtcp_app_poc1_disp_name = -1;
@@ -1375,7 +1376,7 @@
 
 static int
 dissect_rtcp_rr( packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree,
-    unsigned int count )
+    unsigned int count, unsigned int packet_length )
 {
 	unsigned int counter = 1;
 	proto_tree *ssrc_tree = (proto_tree*) NULL;
@@ -1384,6 +1385,7 @@
 	proto_item *ti = (proto_item*) NULL;
 	guint8 rr_flt;
 	unsigned int cum_nr = 0;
+	int rr_offset = offset; 
 
 	while ( counter <= count ) {
 		guint32 lsr, dlsr;
@@ -1455,16 +1457,25 @@
 		counter++;
 	}
 
+	/* If length remaining, assume profile-specific extension bytes */
+	if ((offset-rr_offset) < (int)packet_length)
+	{
+		proto_tree_add_item(tree, hf_rtcp_profile_specific_extension, tvb, offset,
+		                    packet_length - (offset - rr_offset), FALSE);
+		offset = rr_offset + packet_length;
+	}
+
 	return offset;
 }
 
 static int
 dissect_rtcp_sr( packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree,
-    unsigned int count )
+    unsigned int count, unsigned int packet_length )
 {
 	proto_item* item;
 	guint32 ts_msw, ts_lsw;
 	gchar *buff;
+	int sr_offset = offset;
 
 	/* NTP timestamp */
 	ts_msw = tvb_get_ntohl(tvb, offset);
@@ -1500,7 +1511,17 @@
 
 	/* The rest of the packet is equal to the RR packet */
 	if ( count != 0 )
-		offset = dissect_rtcp_rr( pinfo, tvb, offset, tree, count );
+		offset = dissect_rtcp_rr( pinfo, tvb, offset, tree, count, packet_length-(offset-sr_offset) );
+	else
+    {
+		/* If length remaining, assume profile-specific extension bytes */
+		if ((offset-sr_offset) < (int)packet_length)
+		{
+			proto_tree_add_item(tree, hf_rtcp_profile_specific_extension, tvb, offset,
+			                    packet_length - (offset - sr_offset), FALSE);
+			offset = sr_offset + packet_length;
+		}
+	}
 
 	return offset;
 }
@@ -1927,8 +1948,10 @@
                 proto_tree_add_uint( rtcp_tree, hf_rtcp_ssrc_sender, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
                 offset += 4;
 
-                if ( packet_type == RTCP_SR ) offset = dissect_rtcp_sr( pinfo, tvb, offset, rtcp_tree, elem_count );
-                else offset = dissect_rtcp_rr( pinfo, tvb, offset, rtcp_tree, elem_count );
+                if ( packet_type == RTCP_SR )
+                    offset = dissect_rtcp_sr( pinfo, tvb, offset, rtcp_tree, elem_count, packet_length-8 );
+                else
+                    offset = dissect_rtcp_rr( pinfo, tvb, offset, rtcp_tree, elem_count, packet_length-8 );
                 break;
             case RTCP_SDES:
                 /* Source count, 5 bits */
@@ -2771,6 +2794,18 @@
 			}
 		},
 		{
+			&hf_rtcp_profile_specific_extension,
+			{
+				"Profile-specific extension",
+				"rtcp.profile-specific-extension",
+				FT_BYTES,
+				BASE_NONE,
+				NULL,
+				0x0,
+				"Profile-specific extension", HFILL
+			}
+		},
+		{
 			&hf_rtcp_setup,
 			{
 				"Stream setup",
_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@xxxxxxxxxxxx
http://www.ethereal.com/mailman/listinfo/ethereal-dev