3 * $Id: packet-rtcp.c,v 1.40 2004/02/25 09:31:06 guy Exp $
5 * Routines for RTCP dissection
6 * RTCP = Real-time Transport Control Protocol
8 * Copyright 2000, Philips Electronics N.V.
9 * Written by Andreas Sikkema <h323@ramdyne.nl>
11 * Ethereal - Network traffic analyzer
12 * By Gerald Combs <gerald@ethereal.com>
13 * Copyright 1998 Gerald Combs
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 * This dissector tries to dissect the RTCP protocol according to Annex A
32 * of ITU-T Recommendation H.225.0 (02/98) and RFC 1889
33 * H.225.0 literally copies RFC 1889, but omitting a few sections.
35 * RTCP traffic is handled by an uneven UDP portnumber. This can be any
36 * port number, but there is a registered port available, port 5005
37 * See Annex B of ITU-T Recommendation H.225.0, section B.7
47 #include <epan/packet.h>
52 #include "packet-rtcp.h"
54 #include "packet-ntp.h"
56 #include <epan/conversation.h>
58 /* Version is the first 2 bits of the first octet*/
59 #define RTCP_VERSION(octet) ((octet) >> 6)
61 /* Padding is the third bit; no need to shift, because true is any value
63 #define RTCP_PADDING(octet) ((octet) & 0x20)
65 /* Receiver/ Sender count is the 5 last bits */
66 #define RTCP_COUNT(octet) ((octet) & 0x1F)
68 static const value_string rtcp_version_vals[] =
70 { 0, "Old VAT Version" },
71 { 1, "First Draft Version" },
72 { 2, "RFC 1889 Version" },
76 /* RTCP packet types according to Section A.11.1 */
82 /* Supplemental H.261 specific RTCP packet types according to Section C.3.5 */
86 static const value_string rtcp_packet_type_vals[] =
88 { RTCP_SR, "Sender Report" },
89 { RTCP_RR, "Receiver Report" },
90 { RTCP_SDES, "Source description" },
91 { RTCP_BYE, "Goodbye" },
92 { RTCP_APP, "Application specific" },
93 { RTCP_FIR, "Full Intra-frame Request (H.261)" },
94 { RTCP_NACK, "Negative Acknowledgement (H.261)" },
98 /* RTCP SDES types (Section A.11.2) */
99 #define RTCP_SDES_END 0
100 #define RTCP_SDES_CNAME 1
101 #define RTCP_SDES_NAME 2
102 #define RTCP_SDES_EMAIL 3
103 #define RTCP_SDES_PHONE 4
104 #define RTCP_SDES_LOC 5
105 #define RTCP_SDES_TOOL 6
106 #define RTCP_SDES_NOTE 7
107 #define RTCP_SDES_PRIV 8
109 static const value_string rtcp_sdes_type_vals[] =
111 { RTCP_SDES_END, "END" },
112 { RTCP_SDES_CNAME, "CNAME (user and domain)" },
113 { RTCP_SDES_NAME, "NAME (common name)" },
114 { RTCP_SDES_EMAIL, "EMAIL (e-mail address)" },
115 { RTCP_SDES_PHONE, "PHONE (phone number)" },
116 { RTCP_SDES_LOC, "LOC (geographic location)" },
117 { RTCP_SDES_TOOL, "TOOL (name/version of source app)" },
118 { RTCP_SDES_NOTE, "NOTE (note about source)" },
119 { RTCP_SDES_PRIV, "PRIV (private extensions)" },
123 /* RTCP header fields */
124 static int proto_rtcp = -1;
125 static int hf_rtcp_version = -1;
126 static int hf_rtcp_padding = -1;
127 static int hf_rtcp_rc = -1;
128 static int hf_rtcp_sc = -1;
129 static int hf_rtcp_pt = -1;
130 static int hf_rtcp_length = -1;
131 static int hf_rtcp_ssrc_sender = -1;
132 static int hf_rtcp_ntp = -1;
133 static int hf_rtcp_rtp_timestamp = -1;
134 static int hf_rtcp_sender_pkt_cnt = -1;
135 static int hf_rtcp_sender_oct_cnt = -1;
136 static int hf_rtcp_ssrc_source = -1;
137 static int hf_rtcp_ssrc_fraction = -1;
138 static int hf_rtcp_ssrc_cum_nr = -1;
139 /* First the 32 bit number, then the split
140 * up 16 bit values */
141 /* These two are added to a subtree */
142 static int hf_rtcp_ssrc_ext_high_seq = -1;
143 static int hf_rtcp_ssrc_high_seq = -1;
144 static int hf_rtcp_ssrc_high_cycles = -1;
145 static int hf_rtcp_ssrc_jitter = -1;
146 static int hf_rtcp_ssrc_lsr = -1;
147 static int hf_rtcp_ssrc_dlsr = -1;
148 static int hf_rtcp_ssrc_csrc = -1;
149 static int hf_rtcp_ssrc_type = -1;
150 static int hf_rtcp_ssrc_length = -1;
151 static int hf_rtcp_ssrc_text = -1;
152 static int hf_rtcp_ssrc_prefix_len = -1;
153 static int hf_rtcp_ssrc_prefix_string= -1;
154 static int hf_rtcp_subtype = -1;
155 static int hf_rtcp_name_ascii = -1;
156 static int hf_rtcp_app_data = -1;
157 static int hf_rtcp_fsn = -1;
158 static int hf_rtcp_blp = -1;
159 static int hf_rtcp_padding_count = -1;
160 static int hf_rtcp_padding_data = -1;
162 /* RTCP fields defining a sub tree */
163 static gint ett_rtcp = -1;
164 static gint ett_ssrc = -1;
165 static gint ett_ssrc_item = -1;
166 static gint ett_ssrc_ext_high = -1;
167 static gint ett_sdes = -1;
168 static gint ett_sdes_item = -1;
170 static address fake_addr;
171 static int heur_init = FALSE;
173 static gboolean dissect_rtcp_heur( tvbuff_t *tvb, packet_info *pinfo,
175 static void dissect_rtcp( tvbuff_t *tvb, packet_info *pinfo,
178 void rtcp_add_address( packet_info *pinfo, const unsigned char* ip_addr,
182 conversation_t* pconv;
185 * If this isn't the first time this packet has been processed,
186 * we've already done this work, so we don't need to do it
189 if (pinfo->fd->flags.visited)
192 src_addr.type = AT_IPv4;
194 src_addr.data = ip_addr;
197 * The first time the function is called let the udp dissector
198 * know that we're interested in traffic
201 heur_dissector_add( "udp", dissect_rtcp_heur, proto_rtcp );
206 * Check if the ip address and port combination is not
209 pconv = find_conversation( &src_addr, &fake_addr, PT_UDP, prt, 0, 0 );
213 * XXX - use wildcard address and port B?
216 pconv = conversation_new( &src_addr, &fake_addr, PT_UDP,
217 (guint32) prt, (guint32) 0, 0 );
218 conversation_add_proto_data(pconv, proto_rtcp, NULL);
224 static void rtcp_init( void )
226 unsigned char* tmp_data;
229 /* Create a fake adddress... */
230 fake_addr.type = AT_IPv4;
233 tmp_data = g_malloc( fake_addr.len );
234 for ( i = 0; i < fake_addr.len; i++) {
237 fake_addr.data = tmp_data;
242 dissect_rtcp_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
244 conversation_t* pconv;
246 /* This is a heuristic dissector, which means we get all the UDP
247 * traffic not sent to a known dissector and not claimed by
248 * a heuristic dissector called before us!
249 * So we first check if the frame is really meant for us.
251 if ( ( pconv = find_conversation( &pinfo->src, &fake_addr, pinfo->ptype,
252 pinfo->srcport, 0, 0 ) ) == NULL ) {
254 * The source ip:port combination was not what we were
255 * looking for, check the destination
257 if ( ( pconv = find_conversation( &pinfo->dst, &fake_addr,
258 pinfo->ptype, pinfo->destport, 0, 0 ) ) == NULL ) {
265 * An RTCP conversation always has a data item for RTCP.
266 * (Its existence is sufficient to indicate that this is an RTCP
269 if (conversation_get_proto_data(pconv, proto_rtcp) == NULL)
273 * The message is a valid RTCP message!
275 dissect_rtcp( tvb, pinfo, tree );
282 dissect_rtcp_nack( tvbuff_t *tvb, int offset, proto_tree *tree )
284 /* Packet type = FIR (H261) */
285 proto_tree_add_uint( tree, hf_rtcp_rc, tvb, offset, 1, tvb_get_guint8( tvb, offset ) );
287 /* Packet type, 8 bits = APP */
288 proto_tree_add_item( tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
291 /* Packet length in 32 bit words minus one */
292 proto_tree_add_uint( tree, hf_rtcp_length, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
296 proto_tree_add_uint( tree, hf_rtcp_ssrc_source, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
300 proto_tree_add_uint( tree, hf_rtcp_fsn, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
304 proto_tree_add_uint( tree, hf_rtcp_blp, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
311 dissect_rtcp_fir( tvbuff_t *tvb, int offset, proto_tree *tree )
313 /* Packet type = FIR (H261) */
314 proto_tree_add_uint( tree, hf_rtcp_rc, tvb, offset, 1, tvb_get_guint8( tvb, offset ) );
316 /* Packet type, 8 bits = APP */
317 proto_tree_add_item( tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
320 /* Packet length in 32 bit words minus one */
321 proto_tree_add_uint( tree, hf_rtcp_length, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
325 proto_tree_add_uint( tree, hf_rtcp_ssrc_source, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
332 dissect_rtcp_app( tvbuff_t *tvb, int offset, proto_tree *tree,
333 unsigned int padding, unsigned int packet_len )
335 unsigned int counter = 0;
339 proto_tree_add_uint( tree, hf_rtcp_ssrc_source, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
344 for( counter = 0; counter < 4; counter++ )
345 ascii_name[ counter ] = tvb_get_guint8( tvb, offset + counter );
346 /* strncpy( ascii_name, pd + offset, 4 ); */
347 ascii_name[4] = '\0';
348 proto_tree_add_string( tree, hf_rtcp_name_ascii, tvb, offset, 4,
353 /* Applications specific data */
355 /* If there's padding present, we have to remove that from the data part
356 * The last octet of the packet contains the length of the padding
358 packet_len -= tvb_get_guint8( tvb, offset + packet_len - 1 );
360 proto_tree_add_item( tree, hf_rtcp_app_data, tvb, offset, packet_len, FALSE );
361 offset += packet_len;
367 dissect_rtcp_bye( tvbuff_t *tvb, int offset, proto_tree *tree,
370 unsigned int chunk = 1;
371 unsigned int reason_length = 0;
372 char* reason_text = NULL;
374 while ( chunk <= count ) {
375 /* source identifier, 32 bits */
376 proto_tree_add_item( tree, hf_rtcp_ssrc_source, tvb, offset, 4, FALSE);
381 if ( tvb_reported_length_remaining( tvb, offset ) > 0 ) {
382 /* Bye reason consists of an 8 bit length l and a string with length l */
383 reason_length = tvb_get_guint8( tvb, offset );
384 proto_tree_add_item( tree, hf_rtcp_ssrc_length, tvb, offset, 1, FALSE );
387 reason_text = tvb_get_string(tvb, offset, reason_length);
388 proto_tree_add_string( tree, hf_rtcp_ssrc_text, tvb, offset, reason_length, reason_text );
389 g_free( reason_text );
390 offset += reason_length;
398 dissect_rtcp_sdes( tvbuff_t *tvb, int offset, proto_tree *tree,
401 unsigned int chunk = 1;
402 proto_item *sdes_item;
403 proto_tree *sdes_tree;
404 proto_tree *sdes_item_tree;
407 int items_start_offset;
409 unsigned int item_len = 0;
410 unsigned int sdes_type = 0;
411 unsigned int counter = 0;
412 unsigned int prefix_len = 0;
413 char *prefix_string = NULL;
415 while ( chunk <= count ) {
416 /* Create a subtree for this chunk; we don't yet know
418 start_offset = offset;
420 ssrc = tvb_get_ntohl( tvb, offset );
421 sdes_item = proto_tree_add_text(tree, tvb, offset, -1,
422 "Chunk %u, SSRC/CSRC %u", chunk, ssrc);
423 sdes_tree = proto_item_add_subtree( sdes_item, ett_sdes );
425 /* SSRC_n source identifier, 32 bits */
426 proto_tree_add_uint( sdes_tree, hf_rtcp_ssrc_source, tvb, offset, 4, ssrc );
429 /* Create a subtree for the SDES items; we don't yet know
431 items_start_offset = offset;
432 ti = proto_tree_add_text(sdes_tree, tvb, offset, -1,
434 sdes_item_tree = proto_item_add_subtree( ti, ett_sdes_item );
437 * Not every message is ended with "null" bytes, so check for
438 * end of frame instead.
440 while ( ( tvb_reported_length_remaining( tvb, offset ) > 0 )
441 && ( tvb_get_guint8( tvb, offset ) != RTCP_SDES_END ) ) {
443 sdes_type = tvb_get_guint8( tvb, offset );
444 proto_tree_add_item( sdes_item_tree, hf_rtcp_ssrc_type, tvb, offset, 1, FALSE );
447 /* Item length, 8 bits */
448 item_len = tvb_get_guint8( tvb, offset );
449 proto_tree_add_item( sdes_item_tree, hf_rtcp_ssrc_length, tvb, offset, 1, FALSE );
452 if ( sdes_type == RTCP_SDES_PRIV ) {
453 /* PRIV adds two items between the SDES length
454 * and value - an 8 bit length giving the
455 * length of a "prefix string", and the string.
457 prefix_len = tvb_get_guint8( tvb, offset );
458 proto_tree_add_item( sdes_item_tree, hf_rtcp_ssrc_prefix_len, tvb, offset, 1, FALSE );
461 prefix_string = g_malloc( prefix_len + 1 );
462 for ( counter = 0; counter < prefix_len; counter++ )
463 prefix_string[ counter ] =
464 tvb_get_guint8( tvb, offset + counter );
465 /* strncpy( prefix_string, pd + offset, prefix_len ); */
466 prefix_string[ prefix_len ] = '\0';
467 proto_tree_add_string( sdes_item_tree, hf_rtcp_ssrc_prefix_string, tvb, offset, prefix_len, prefix_string );
468 g_free( prefix_string );
469 offset += prefix_len;
471 prefix_string = g_malloc( item_len + 1 );
472 for ( counter = 0; counter < item_len; counter++ )
473 prefix_string[ counter ] =
474 tvb_get_guint8( tvb, offset + counter );
475 /* strncpy( prefix_string, pd + offset, item_len ); */
476 prefix_string[ item_len] = 0;
477 proto_tree_add_string( sdes_item_tree, hf_rtcp_ssrc_text, tvb, offset, item_len, prefix_string );
478 g_free( prefix_string );
482 /* Set the length of the items subtree. */
483 proto_item_set_len(ti, offset - items_start_offset);
485 /* 32 bits = 4 bytes, so.....
486 * If offset % 4 != 0, we divide offset by 4, add one and then
487 * multiply by 4 again to reach the boundary
489 if ( offset % 4 != 0 )
490 offset = ((offset / 4) + 1 ) * 4;
492 /* Set the length of this chunk. */
493 proto_item_set_len(sdes_item, offset - start_offset);
500 dissect_rtcp_rr( tvbuff_t *tvb, int offset, proto_tree *tree,
503 unsigned int counter = 1;
504 proto_tree *ssrc_tree = (proto_tree*) NULL;
505 proto_tree *ssrc_sub_tree = (proto_tree*) NULL;
506 proto_tree *high_sec_tree = (proto_tree*) NULL;
507 proto_item *ti = (proto_item*) NULL;
509 unsigned int cum_nr = 0;
511 while ( counter <= count ) {
512 /* Create a new subtree for a length of 24 bytes */
513 ti = proto_tree_add_text(tree, tvb, offset, 24,
514 "Source %u", counter );
515 ssrc_tree = proto_item_add_subtree( ti, ett_ssrc );
517 /* SSRC_n source identifier, 32 bits */
518 proto_tree_add_uint( ssrc_tree, hf_rtcp_ssrc_source, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
521 ti = proto_tree_add_text(ssrc_tree, tvb, offset, 20, "SSRC contents" );
522 ssrc_sub_tree = proto_item_add_subtree( ti, ett_ssrc_item );
524 /* Fraction lost, 8bits */
525 rr_flt = tvb_get_guint8( tvb, offset );
526 proto_tree_add_uint_format( ssrc_sub_tree, hf_rtcp_ssrc_fraction, tvb,
527 offset, 1, rr_flt, "Fraction lost: %u / 256", rr_flt );
530 /* Cumulative number of packets lost, 24 bits */
531 cum_nr = tvb_get_ntohl( tvb, offset ) >> 8;
532 proto_tree_add_uint( ssrc_sub_tree, hf_rtcp_ssrc_cum_nr, tvb,
536 /* Extended highest sequence nr received, 32 bits
537 * Just for the sake of it, let's add another subtree
538 * because this might be a little clearer
540 ti = proto_tree_add_uint( ssrc_tree, hf_rtcp_ssrc_ext_high_seq,
541 tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
542 high_sec_tree = proto_item_add_subtree( ti, ett_ssrc_ext_high );
543 /* Sequence number cycles */
544 proto_tree_add_uint( high_sec_tree, hf_rtcp_ssrc_high_cycles,
545 tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
547 /* highest sequence number received */
548 proto_tree_add_uint( high_sec_tree, hf_rtcp_ssrc_high_seq,
549 tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
552 /* Interarrival jitter */
553 proto_tree_add_uint( ssrc_tree, hf_rtcp_ssrc_jitter, tvb,
554 offset, 4, tvb_get_ntohl( tvb, offset ) );
557 /* Last SR timestamp */
558 proto_tree_add_uint( ssrc_tree, hf_rtcp_ssrc_lsr, tvb,
559 offset, 4, tvb_get_ntohl( tvb, offset ) );
562 /* Delay since last SR timestamp */
563 proto_tree_add_uint( ssrc_tree, hf_rtcp_ssrc_dlsr, tvb,
564 offset, 4, tvb_get_ntohl( tvb, offset ) );
573 dissect_rtcp_sr( tvbuff_t *tvb, int offset, proto_tree *tree,
577 gchar buff[ NTP_TS_SIZE ];
578 char* ptime = tvb_get_ptr( tvb, offset, 8 );
580 /* Retreive the NTP timestamp. Using the NTP dissector for this */
581 ntp_fmt_ts( ptime, buff );
582 proto_tree_add_string_format( tree, hf_rtcp_ntp, tvb, offset, 8, ( const char* ) &buff, "NTP timestamp: %s", &buff );
583 free( ptime ); ??????????????????????????????????????????????????????????????????
587 * XXX - RFC 1889 says this is an NTP timestamp, but that appears
588 * not to be the case.
590 proto_tree_add_text(tree, tvb, offset, 4, "Timestamp, MSW: %u",
591 tvb_get_ntohl(tvb, offset));
593 proto_tree_add_text(tree, tvb, offset, 4, "Timestamp, LSW: %u",
594 tvb_get_ntohl(tvb, offset));
597 /* RTP timestamp, 32 bits */
598 proto_tree_add_uint( tree, hf_rtcp_rtp_timestamp, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
600 /* Sender's packet count, 32 bits */
601 proto_tree_add_uint( tree, hf_rtcp_sender_pkt_cnt, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
603 /* Sender's octet count, 32 bits */
604 proto_tree_add_uint( tree, hf_rtcp_sender_oct_cnt, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
607 /* The rest of the packet is equal to the RR packet */
609 offset = dissect_rtcp_rr( tvb, offset, tree, count );
615 dissect_rtcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
617 proto_item *ti = NULL;
618 proto_tree *rtcp_tree = NULL;
619 unsigned int temp_byte = 0;
620 unsigned int padding_set = 0;
621 unsigned int elem_count = 0;
622 unsigned int packet_type = 0;
623 unsigned int offset = 0;
624 guint16 packet_length = 0;
626 if ( check_col( pinfo->cinfo, COL_PROTOCOL ) ) {
627 col_set_str( pinfo->cinfo, COL_PROTOCOL, "RTCP" );
630 if ( check_col( pinfo->cinfo, COL_INFO) ) {
631 /* The second octet contains the packet type */
632 /* switch ( pd[ offset + 1 ] ) { */
633 switch ( tvb_get_guint8( tvb, 1 ) ) {
635 col_set_str( pinfo->cinfo, COL_INFO, "Sender Report");
638 col_set_str( pinfo->cinfo, COL_INFO, "Receiver Report");
641 col_set_str( pinfo->cinfo, COL_INFO, "Source Description");
644 col_set_str( pinfo->cinfo, COL_INFO, "Goodbye");
647 col_set_str( pinfo->cinfo, COL_INFO, "Application defined");
650 col_set_str( pinfo->cinfo, COL_INFO, "Full Intra-frame Request (H.261)");
653 col_set_str( pinfo->cinfo, COL_INFO, "Negative Acknowledgement (H.261)");
656 col_set_str( pinfo->cinfo, COL_INFO, "Unknown packet type");
664 * Check if there are at least 4 bytes left in the frame,
665 * the last 16 bits of those is the length of the current
666 * RTCP message. The last compound message contains padding,
667 * that enables us to break from the while loop.
669 while ( tvb_bytes_exist( tvb, offset, 4) ) {
671 * First retreive the packet_type
673 packet_type = tvb_get_guint8( tvb, offset + 1 );
676 * Check if it's a valid type
678 if ( ( packet_type < 192 ) || ( packet_type > 204 ) )
682 * get the packet-length for the complete RTCP packet
684 packet_length = ( tvb_get_ntohs( tvb, offset + 2 ) + 1 ) * 4;
686 ti = proto_tree_add_item(tree, proto_rtcp, tvb, offset, packet_length, FALSE );
687 rtcp_tree = proto_item_add_subtree( ti, ett_rtcp );
689 temp_byte = tvb_get_guint8( tvb, offset );
691 proto_tree_add_uint( rtcp_tree, hf_rtcp_version, tvb,
692 offset, 1, temp_byte);
693 padding_set = RTCP_PADDING( temp_byte );
694 proto_tree_add_boolean( rtcp_tree, hf_rtcp_padding, tvb,
695 offset, 1, temp_byte );
696 elem_count = RTCP_COUNT( temp_byte );
698 switch ( packet_type ) {
701 /* Receiver report count, 5 bits */
702 proto_tree_add_uint( rtcp_tree, hf_rtcp_rc, tvb, offset, 1, temp_byte );
704 /* Packet type, 8 bits */
705 proto_tree_add_item( rtcp_tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
707 /* Packet length in 32 bit words MINUS one, 16 bits */
708 proto_tree_add_uint( rtcp_tree, hf_rtcp_length, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
710 /* Sender Synchronization source, 32 bits */
711 proto_tree_add_uint( rtcp_tree, hf_rtcp_ssrc_sender, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
714 if ( packet_type == RTCP_SR ) offset = dissect_rtcp_sr( tvb, offset, rtcp_tree, elem_count );
715 else offset = dissect_rtcp_rr( tvb, offset, rtcp_tree, elem_count );
718 /* Source count, 5 bits */
719 proto_tree_add_uint( rtcp_tree, hf_rtcp_sc, tvb, offset, 1, temp_byte );
721 /* Packet type, 8 bits */
722 proto_tree_add_item( rtcp_tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
724 /* Packet length in 32 bit words MINUS one, 16 bits */
725 proto_tree_add_uint( rtcp_tree, hf_rtcp_length, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
727 dissect_rtcp_sdes( tvb, offset, rtcp_tree, elem_count );
728 offset += packet_length - 4;
731 /* Source count, 5 bits */
732 proto_tree_add_uint( rtcp_tree, hf_rtcp_sc, tvb, offset, 1, temp_byte );
734 /* Packet type, 8 bits */
735 proto_tree_add_item( rtcp_tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
737 /* Packet length in 32 bit words MINUS one, 16 bits */
738 proto_tree_add_uint( rtcp_tree, hf_rtcp_length, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
740 offset = dissect_rtcp_bye( tvb, offset, rtcp_tree, elem_count );
743 /* Subtype, 5 bits */
744 proto_tree_add_uint( rtcp_tree, hf_rtcp_subtype, tvb, offset, 1, elem_count );
746 /* Packet type, 8 bits */
747 proto_tree_add_item( rtcp_tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
749 /* Packet length in 32 bit words MINUS one, 16 bits */
750 proto_tree_add_uint( rtcp_tree, hf_rtcp_length, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
752 offset = dissect_rtcp_app( tvb, offset,
753 rtcp_tree, padding_set,
757 offset = dissect_rtcp_fir( tvb, offset, rtcp_tree );
760 offset = dissect_rtcp_nack( tvb, offset, rtcp_tree );
764 * To prevent endless loops in case of an unknown message type
765 * increase offset. Some time the while will end :-)
771 /* If the padding bit is set, the last octet of the
772 * packet contains the length of the padding
773 * We only have to check for this at the end of the LAST RTCP message
776 /* If everything went according to plan offset should now point to the
777 * first octet of the padding
779 proto_tree_add_item( rtcp_tree, hf_rtcp_padding_data, tvb, offset, tvb_length_remaining( tvb, offset) - 1, FALSE );
780 offset += tvb_length_remaining( tvb, offset) - 1;
781 proto_tree_add_item( rtcp_tree, hf_rtcp_padding_count, tvb, offset, 1, FALSE );
787 proto_register_rtcp(void)
789 static hf_register_info hf[] =
798 VALS(rtcp_version_vals),
818 "Reception report count",
846 VALS( rtcp_packet_type_vals ),
864 &hf_rtcp_ssrc_sender,
879 "rtcp.timestamp.ntp",
888 &hf_rtcp_rtp_timestamp,
891 "rtcp.timestamp.rtp",
900 &hf_rtcp_sender_pkt_cnt,
902 "Sender's packet count",
903 "rtcp.sender.packetcount",
912 &hf_rtcp_sender_oct_cnt,
914 "Sender's octet count",
915 "rtcp.sender.octetcount",
924 &hf_rtcp_ssrc_source,
927 "rtcp.ssrc.identifier",
936 &hf_rtcp_ssrc_fraction,
939 "rtcp.ssrc.fraction",
948 &hf_rtcp_ssrc_cum_nr,
950 "Cumulative number of packets lost",
960 &hf_rtcp_ssrc_ext_high_seq,
962 "Extended highest sequence number received",
963 "rtcp.ssrc.ext_high",
972 &hf_rtcp_ssrc_high_seq,
974 "Highest sequence number received",
975 "rtcp.ssrc.high_seq",
984 &hf_rtcp_ssrc_high_cycles,
986 "Sequence number cycles count",
987 "rtcp.ssrc.high_cycles",
996 &hf_rtcp_ssrc_jitter,
998 "Interarrival jitter",
1010 "Last SR timestamp",
1022 "Delay since last SR timestamp",
1034 "SSRC / CSRC identifier",
1035 "rtcp.sdes.ssrc_csrc",
1050 VALS( rtcp_sdes_type_vals ),
1056 &hf_rtcp_ssrc_length,
1080 &hf_rtcp_ssrc_prefix_len,
1083 "rtcp.sdes.prefix.length",
1092 &hf_rtcp_ssrc_prefix_string,
1095 "rtcp.sdes.prefix.string",
1116 &hf_rtcp_name_ascii,
1130 "Application specific data",
1142 "First sequence number",
1154 "Bitmask of following lost packets",
1164 &hf_rtcp_padding_count,
1167 "rtcp.padding.count",
1176 &hf_rtcp_padding_data,
1179 "rtcp.padding.data",
1189 static gint *ett[] =
1200 proto_rtcp = proto_register_protocol("Real-time Transport Control Protocol",
1202 proto_register_field_array(proto_rtcp, hf, array_length(hf));
1203 proto_register_subtree_array(ett, array_length(ett));
1205 register_dissector("rtcp", dissect_rtcp, proto_rtcp);
1208 register_init_routine( &rtcp_init );
1213 proto_reg_handoff_rtcp(void)
1215 dissector_handle_t rtcp_handle;
1218 * Register this dissector as one that can be selected by a
1221 rtcp_handle = find_dissector("rtcp");
1222 dissector_add_handle("udp.port", rtcp_handle);