0f31d8a81c06b5954b10162dacb7792a347dd34b
[obnox/wireshark/wip.git] / epan / dissectors / packet-rtcp.c
1 /* packet-rtcp.c
2  *
3  * $Id$
4  *
5  * Routines for RTCP dissection
6  * RTCP = Real-time Transport Control Protocol
7  *
8  * Copyright 2000, Philips Electronics N.V.
9  * Written by Andreas Sikkema <h323@ramdyne.nl>
10  *
11  * Copyright 2004, Anders Broman <anders.broman@ericsson.com>
12  *
13  * Copyright 2005, Nagarjuna Venna <nvenna@brixnet.com>
14  *
15  * Ethereal - Network traffic analyzer
16  * By Gerald Combs <gerald@ethereal.com>
17  * Copyright 1998 Gerald Combs
18  *
19  * This program is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU General Public License
21  * as published by the Free Software Foundation; either version 2
22  * of the License, or (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program; if not, write to the Free Software
31  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
32  */
33
34 /*
35  * This dissector tries to dissect the RTCP protocol according to Annex A
36  * of ITU-T Recommendation H.225.0 (02/98) and RFC 1889
37  * H.225.0 literally copies RFC 1889, but omitting a few sections.
38  *
39  * RTCP traffic is handled by an uneven UDP portnumber. This can be any
40  * port number, but there is a registered port available, port 5005
41  * See Annex B of ITU-T Recommendation H.225.0, section B.7
42  *
43  * Information on PoC can be found from http://www.openmobilealliance.org/
44  *
45  * RTCP XR is specified in RFC 3611.
46  *
47  * See also http://www.iana.org/assignments/rtp-parameters
48  */
49
50
51 #ifdef HAVE_CONFIG_H
52 # include "config.h"
53 #endif
54
55 #include <glib.h>
56 #include <epan/packet.h>
57
58 #include <stdio.h>
59 #include <string.h>
60
61 #include "packet-rtcp.h"
62 #include "packet-ntp.h"
63 #include <epan/conversation.h>
64
65 #include <epan/prefs.h>
66 #include <epan/emem.h>
67
68
69 /* Version is the first 2 bits of the first octet*/
70 #define RTCP_VERSION(octet)     ((octet) >> 6)
71
72 /* Padding is the third bit; no need to shift, because true is any value
73    other than 0! */
74 #define RTCP_PADDING(octet)     ((octet) & 0x20)
75
76 /* Receiver/ Sender count is the 5 last bits  */
77 #define RTCP_COUNT(octet)       ((octet) & 0x1F)
78
79 static dissector_handle_t rtcp_handle;
80
81 static const value_string rtcp_version_vals[] =
82 {
83         { 0, "Old VAT Version" },
84         { 1, "First Draft Version" },
85         { 2, "RFC 1889 Version" },
86         { 0, NULL },
87 };
88
89 /* RTCP packet types according to Section A.11.1 */
90 /* And http://www.iana.org/assignments/rtp-parameters */
91 #define RTCP_SR   200
92 #define RTCP_RR   201
93 #define RTCP_SDES 202
94 #define RTCP_BYE  203
95 #define RTCP_APP  204
96 #define RTCP_RTPFB  205
97 #define RTCP_PSFB  206
98 #define RTCP_XR   207
99 /* Supplemental H.261 specific RTCP packet types according to Section C.3.5 */
100 #define RTCP_FIR  192
101 #define RTCP_NACK 193
102
103 static const value_string rtcp_packet_type_vals[] =
104 {
105         { RTCP_SR,   "Sender Report" },
106         { RTCP_RR,   "Receiver Report" },
107         { RTCP_SDES, "Source description" },
108         { RTCP_BYE,  "Goodbye" },
109         { RTCP_APP,  "Application specific" },
110         { RTCP_FIR,  "Full Intra-frame Request (H.261)" },
111         { RTCP_NACK, "Negative Acknowledgement (H.261)" },
112         { RTCP_RTPFB, "Generic RTP Feedback" },
113         { RTCP_PSFB, "Payload-specific" },
114         { RTCP_XR,   "Extended report (RFC 3611)"},
115         { 0,         NULL },
116 };
117
118 /* RTCP SDES types (Section A.11.2) */
119 #define RTCP_SDES_END    0
120 #define RTCP_SDES_CNAME  1
121 #define RTCP_SDES_NAME   2
122 #define RTCP_SDES_EMAIL  3
123 #define RTCP_SDES_PHONE  4
124 #define RTCP_SDES_LOC    5
125 #define RTCP_SDES_TOOL   6
126 #define RTCP_SDES_NOTE   7
127 #define RTCP_SDES_PRIV   8
128 #define RTCP_SDES_H323_CADDR   9
129
130 static const value_string rtcp_sdes_type_vals[] =
131 {
132         { RTCP_SDES_END,   "END" },
133         { RTCP_SDES_CNAME, "CNAME (user and domain)" },
134         { RTCP_SDES_NAME,  "NAME (common name)" },
135         { RTCP_SDES_EMAIL, "EMAIL (e-mail address)" },
136         { RTCP_SDES_PHONE, "PHONE (phone number)" },
137         { RTCP_SDES_LOC,   "LOC (geographic location)" },
138         { RTCP_SDES_TOOL,  "TOOL (name/version of source app)" },
139         { RTCP_SDES_NOTE,  "NOTE (note about source)" },
140         { RTCP_SDES_PRIV,  "PRIV (private extensions)" },
141         { RTCP_SDES_H323_CADDR,"H323-CADDR (H.323 callable address)"},
142         { 0,               NULL },
143 };
144
145 /* RTCP XR Blocks (Section 4, RTC 3611) */
146 #define RTCP_XR_LOSS_RLE    1
147 #define RTCP_XR_DUP_RLE     2
148 #define RTCP_XR_PKT_RXTIMES 3
149 #define RTCP_XR_REF_TIME    4
150 #define RTCP_XR_DLRR        5
151 #define RTCP_XR_STATS_SUMRY 6
152 #define RTCP_XR_VOIP_METRCS 7
153
154 static const value_string rtcp_xr_type_vals[] = 
155 {
156         { RTCP_XR_LOSS_RLE,     "Loss Run Length Encoding Report Block" },
157         { RTCP_XR_DUP_RLE,      "Duplicate Run Length Encoding Report Block" },
158         { RTCP_XR_PKT_RXTIMES,  "Packet Receipt Times Report Block" },
159         { RTCP_XR_REF_TIME,     "Receiver Reference Time Report Block" },
160         { RTCP_XR_DLRR,         "DLRR Report Block" },
161         { RTCP_XR_STATS_SUMRY,  "Statistics Summary Report Block" },
162         { RTCP_XR_VOIP_METRCS,  "VoIP Metrics Report Block" },
163         { 0, NULL}
164 };
165
166 /* XR VoIP Metrics Block - PLC Algorithms */
167 static const value_string rtcp_xr_plc_algo_vals[] = 
168 {
169         { 0, "Unspecified" },
170         { 1, "Disabled" },
171         { 2, "Enhanced" },
172         { 3, "Standard" },
173         { 0, NULL }
174 };
175
176 /* XR VoIP Metrics Block - JB Adaptive */
177 static const value_string rtcp_xr_jb_adaptive_vals[] = 
178 {
179         { 0, "Unknown" },
180         { 1, "Reserved" },
181         { 2, "Non-Adaptive" },
182         { 3, "Adaptive" },
183         { 0, NULL }
184 };
185
186 /* XR Stats Summary Block - IP TTL or Hop Limit */
187 static const value_string rtcp_xr_ip_ttl_vals[] = 
188 {
189         { 0, "No TTL Values" },
190         { 1, "IPv4" },
191         { 2, "IPv6" },
192         { 3, "Undefined" },
193         { 0, NULL }
194 };
195
196 /* RTCP Application PoC1 Value strings 
197  * OMA-TS-PoC-UserPlane-V1_0-20051006-C
198  */
199 static const value_string rtcp_app_poc1_floor_cnt_type_vals[] =
200 {
201         {  0,   "TBCP Talk Burst Request"},
202         {  1,   "TBCP Talk Burst Granted"},
203         {  2,   "TBCP Talk Burst Taken (no reply expected)"},
204         {  3,   "TBCP Talk Burst Deny"},
205         {  4,   "TBCP Talk Burst Release"},
206         {  5,   "TBCP Talk Burst Idle"},
207         {  6,   "TBCP Talk Burst Revoke"},
208         {  7,   "TBCP Talk Burst Acknowledgement"},
209         {  8,   "TBCP Queue Status Request"},
210         {  9,   "TBCP Queue Status Response"},
211         { 11,   "TBCP Disconnect"},
212         { 15,   "TBCP Connect"},
213         { 18,   "TBCP Talk Burst Taken (ack expected)"},
214         {  0,   NULL },
215 };
216
217 static const value_string rtcp_app_poc1_reason_code1_vals[] =
218 {
219         {  1,   "Floor already in use"},
220         {  2,   "Internal PoC server error"},
221         {  3,   "Only one participant in the group"},
222         {  4,   "Retry-after timer has not expired"},
223         {  5,   "Listen only"},
224         {  0,   NULL },
225 };
226
227 static const value_string rtcp_app_poc1_reason_code2_vals[] =
228 {
229         {  1,   "Only one user"},
230         {  2,   "Talk burst too long"},
231         {  3,   "No permission to send a Talk Burst"},
232         {  4,   "Talk burst pre-empted"},
233         {  0,   NULL },
234 };
235
236 static const value_string rtcp_app_poc1_reason_code_ack_vals[] =
237 {
238         {  0,   "Accepted"},
239         {  1,   "Busy"},
240         {  2,   "Not accepted"},
241         {  0,   NULL },
242 };
243 static const value_string rtcp_app_poc1_conn_sess_type_vals[] =
244 {
245         {  0,   "None"},
246         {  1,   "1-to-1"},
247         {  2,   "Ad-hoc"},
248         {  3,   "Pre-arranged"},
249         {  4,   "Chat"},
250         {  0,   NULL },
251 };
252
253 static const value_string rtcp_app_poc1_qsresp_priority_vals[] =
254 {
255         {  0,   "No priority (un-queued)"},
256         {  1,   "Normal priority"},
257         {  2,   "High priority"},
258         {  3,   "Pre-emptive priority"},
259         {  0,   NULL },
260 };
261
262 /* RTCP header fields                   */
263 static int proto_rtcp                = -1;
264 static int hf_rtcp_version           = -1;
265 static int hf_rtcp_padding           = -1;
266 static int hf_rtcp_rc                = -1;
267 static int hf_rtcp_sc                = -1;
268 static int hf_rtcp_pt                = -1;
269 static int hf_rtcp_length            = -1;
270 static int hf_rtcp_ssrc_sender       = -1;
271 static int hf_rtcp_ntp               = -1;
272 static int hf_rtcp_ntp_msw           = -1;
273 static int hf_rtcp_ntp_lsw           = -1;
274 static int hf_rtcp_rtp_timestamp     = -1;
275 static int hf_rtcp_sender_pkt_cnt    = -1;
276 static int hf_rtcp_sender_oct_cnt    = -1;
277 static int hf_rtcp_ssrc_source       = -1;
278 static int hf_rtcp_ssrc_fraction     = -1;
279 static int hf_rtcp_ssrc_cum_nr       = -1;
280 static int hf_rtcp_ssrc_discarded    = -1;
281 /* First the 32 bit number, then the split
282  * up 16 bit values */
283 /* These two are added to a subtree */
284 static int hf_rtcp_ssrc_ext_high_seq = -1;
285 static int hf_rtcp_ssrc_high_seq     = -1;
286 static int hf_rtcp_ssrc_high_cycles  = -1;
287 static int hf_rtcp_ssrc_jitter       = -1;
288 static int hf_rtcp_ssrc_lsr          = -1;
289 static int hf_rtcp_ssrc_dlsr         = -1;
290 static int hf_rtcp_ssrc_csrc         = -1;
291 static int hf_rtcp_sdes_type         = -1;
292 static int hf_rtcp_sdes_length       = -1;
293 static int hf_rtcp_sdes_text         = -1;
294 static int hf_rtcp_sdes_prefix_len   = -1;
295 static int hf_rtcp_sdes_prefix_string= -1;
296 static int hf_rtcp_subtype           = -1;
297 static int hf_rtcp_name_ascii        = -1;
298 static int hf_rtcp_app_data          = -1;
299 static int hf_rtcp_fsn               = -1;
300 static int hf_rtcp_blp               = -1;
301 static int hf_rtcp_padding_count     = -1;
302 static int hf_rtcp_padding_data      = -1;
303 static int hf_rtcp_app_poc1_subtype  = -1;
304 static int hf_rtcp_app_poc1_sip_uri  = -1;
305 static int hf_rtcp_app_poc1_disp_name = -1;
306 static int hf_rtcp_app_poc1_stt                 = -1;
307 static int hf_rtcp_app_poc1_partic              = -1;
308 static int hf_rtcp_app_poc1_ssrc_granted        = -1;
309 static int hf_rtcp_app_poc1_last_pkt_seq_no = -1;
310 static int hf_rtcp_app_poc1_reason_code1        = -1;
311 static int hf_rtcp_app_poc1_item_len            = -1;
312 static int hf_rtcp_app_poc1_reason1_phrase      = -1;
313 static int hf_rtcp_app_poc1_reason_code2        = -1;
314 static int hf_rtcp_app_poc1_additionalinfo      = -1;
315 static int hf_rtcp_app_poc1_ack_subtype         = -1;
316 static int hf_rtcp_app_poc1_ack_reason_code     = -1;
317 static int hf_rtcp_app_poc1_qsresp_priority     = -1;
318 static int hf_rtcp_app_poc1_qsresp_position     = -1;
319 static int hf_rtcp_app_poc1_conn_content_1st_byte[5] = { -1, -1, -1, -1, -1 };
320 static int hf_rtcp_app_poc1_conn_session_type   = -1;
321 static int hf_rtcp_app_poc1_conn_add_ind_mao    = -1;
322 static int hf_rtcp_app_poc1_conn_sdes_items[5] = { -1, -1, -1, -1, -1 };
323 static int hf_rtcp_xr_block_type     = -1;
324 static int hf_rtcp_xr_block_specific = -1;
325 static int hf_rtcp_xr_block_length   = -1;
326 static int hf_rtcp_xr_thinning       = -1;
327 static int hf_rtcp_xr_voip_metrics_burst_density = -1;
328 static int hf_rtcp_xr_voip_metrics_gap_density = -1;
329 static int hf_rtcp_xr_voip_metrics_burst_duration = -1;
330 static int hf_rtcp_xr_voip_metrics_gap_duration = -1;
331 static int hf_rtcp_xr_voip_metrics_rtdelay = -1;
332 static int hf_rtcp_xr_voip_metrics_esdelay = -1;
333 static int hf_rtcp_xr_voip_metrics_siglevel = -1;
334 static int hf_rtcp_xr_voip_metrics_noiselevel = -1;
335 static int hf_rtcp_xr_voip_metrics_rerl = -1;
336 static int hf_rtcp_xr_voip_metrics_gmin = -1;
337 static int hf_rtcp_xr_voip_metrics_rfactor = -1;
338 static int hf_rtcp_xr_voip_metrics_extrfactor = -1;
339 static int hf_rtcp_xr_voip_metrics_moslq = -1;
340 static int hf_rtcp_xr_voip_metrics_moscq = -1;
341 static int hf_rtcp_xr_voip_metrics_plc = -1;
342 static int hf_rtcp_xr_voip_metrics_jbadaptive = -1;
343 static int hf_rtcp_xr_voip_metrics_jbrate = -1;
344 static int hf_rtcp_xr_voip_metrics_jbnominal = -1;
345 static int hf_rtcp_xr_voip_metrics_jbmax = -1;
346 static int hf_rtcp_xr_voip_metrics_jbabsmax = -1;
347 static int hf_rtcp_xr_stats_loss_flag = -1;
348 static int hf_rtcp_xr_stats_dup_flag = -1;
349 static int hf_rtcp_xr_stats_jitter_flag = -1;
350 static int hf_rtcp_xr_stats_ttl = -1;
351 static int hf_rtcp_xr_beginseq = -1;
352 static int hf_rtcp_xr_endseq = -1;
353 static int hf_rtcp_xr_stats_lost = -1;
354 static int hf_rtcp_xr_stats_dups = -1;
355 static int hf_rtcp_xr_stats_minjitter = -1;
356 static int hf_rtcp_xr_stats_maxjitter = -1;
357 static int hf_rtcp_xr_stats_meanjitter = -1;
358 static int hf_rtcp_xr_stats_devjitter = -1;
359 static int hf_rtcp_xr_stats_minttl = -1;
360 static int hf_rtcp_xr_stats_maxttl = -1;
361 static int hf_rtcp_xr_stats_meanttl = -1;
362 static int hf_rtcp_xr_stats_devttl = -1;
363 static int hf_rtcp_xr_lrr = -1;
364 static int hf_rtcp_xr_dlrr = -1;
365
366 /* RTCP setup fields */
367 static int hf_rtcp_setup        = -1;
368 static int hf_rtcp_setup_frame  = -1;
369 static int hf_rtcp_setup_method = -1;
370
371 /* RTCP roundtrip delay fields */
372 static int hf_rtcp_last_sr_timestamp_frame  = -1;
373 static int hf_rtcp_roundtrip_delay  = -1;
374
375
376
377 /* RTCP fields defining a sub tree */
378 static gint ett_rtcp                    = -1;
379 static gint ett_ssrc                    = -1;
380 static gint ett_ssrc_item               = -1;
381 static gint ett_ssrc_ext_high           = -1;
382 static gint ett_sdes                    = -1;
383 static gint ett_sdes_item               = -1;
384 static gint ett_PoC1                    = -1;
385 static gint ett_rtcp_setup              = -1;
386 static gint ett_rtcp_roundtrip_delay    = -1;
387 static gint ett_xr_block                = -1;
388 static gint ett_xr_block_contents       = -1;
389 static gint ett_xr_ssrc                 = -1;
390 static gint  ett_xr_loss_chunk = -1;
391 static gint ett_poc1_conn_contents      = -1;
392
393 /* Main dissection function */
394 static void dissect_rtcp( tvbuff_t *tvb, packet_info *pinfo,
395      proto_tree *tree );
396
397 /* Heuristic dissection */
398 static gboolean global_rtcp_heur = FALSE;
399 static gboolean dissect_rtcp_heur( tvbuff_t *tvb, packet_info *pinfo,
400     proto_tree *tree );
401
402 /* Displaying set info */
403 static gboolean global_rtcp_show_setup_info = TRUE;
404 static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
405
406 /* Related to roundtrip calculation (using LSR and DLSR) */
407 static gboolean global_rtcp_show_roundtrip_calculation = FALSE;
408 #define MIN_ROUNDTRIP_TO_REPORT_DEFAULT 10
409 static guint global_rtcp_show_roundtrip_calculation_minimum = MIN_ROUNDTRIP_TO_REPORT_DEFAULT;
410 static void remember_outgoing_sr(packet_info *pinfo, long lsr);
411 static void calculate_roundtrip_delay(tvbuff_t *tvb, packet_info *pinfo,
412                                       proto_tree *tree, guint32 lsr, guint32 dlsr);
413 static void add_roundtrip_delay_info(tvbuff_t *tvb, packet_info *pinfo,
414                                      proto_tree *tree, guint frame, guint delay);
415
416
417 /* Set up an RTCP conversation using the info given */
418 void rtcp_add_address( packet_info *pinfo,
419                        address *addr, int port,
420                        int other_port,
421                        const gchar *setup_method, guint32 setup_frame_number)
422 {
423         address null_addr;
424         conversation_t* p_conv;
425         struct _rtcp_conversation_info *p_conv_data = NULL;
426
427         /*
428          * If this isn't the first time this packet has been processed,
429          * we've already done this work, so we don't need to do it
430          * again.
431          */
432         if (pinfo->fd->flags.visited)
433         {
434                 return;
435         }
436
437         SET_ADDRESS(&null_addr, AT_NONE, 0, NULL);
438
439         /*
440          * Check if the ip address and port combination is not
441          * already registered as a conversation.
442          */
443         p_conv = find_conversation( pinfo->fd->num, addr, &null_addr, PT_UDP, port, other_port,
444                                     NO_ADDR_B | (!other_port ? NO_PORT_B : 0));
445
446         /*
447          * If not, create a new conversation.
448          */
449         if ( ! p_conv ) {
450                 p_conv = conversation_new( pinfo->fd->num, addr, &null_addr, PT_UDP,
451                                            (guint32)port, (guint32)other_port,
452                                            NO_ADDR2 | (!other_port ? NO_PORT2 : 0));
453         }
454
455         /* Set dissector */
456         conversation_set_dissector(p_conv, rtcp_handle);
457
458         /*
459          * Check if the conversation has data associated with it.
460          */
461         p_conv_data = conversation_get_proto_data(p_conv, proto_rtcp);
462
463         /*
464          * If not, add a new data item.
465          */
466         if ( ! p_conv_data ) {
467                 /* Create conversation data */
468                 p_conv_data = se_alloc(sizeof(struct _rtcp_conversation_info));
469                 if (!p_conv_data)
470                 {
471                         return;
472                 }
473                 memset(p_conv_data, 0, sizeof(struct _rtcp_conversation_info));
474                 conversation_add_proto_data(p_conv, proto_rtcp, p_conv_data);
475         }
476
477         /*
478          * Update the conversation data.
479          */
480         p_conv_data->setup_method_set = TRUE;
481         strncpy(p_conv_data->setup_method, setup_method, MAX_RTCP_SETUP_METHOD_SIZE);
482         p_conv_data->setup_method[MAX_RTCP_SETUP_METHOD_SIZE] = '\0';
483         p_conv_data->setup_frame_number = setup_frame_number;
484 }
485
486 static gboolean
487 dissect_rtcp_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
488 {
489         unsigned int offset = 0;
490         unsigned int first_byte;
491         unsigned int packet_type;
492
493         /* This is a heuristic dissector, which means we get all the UDP
494          * traffic not sent to a known dissector and not claimed by
495          * a heuristic dissector called before us!
496          */
497
498         if (!global_rtcp_heur)
499         {
500                 return FALSE;
501         }
502
503         /* Was it sent between 2 odd-numbered ports? */
504         if (!(pinfo->srcport % 2) || !(pinfo->destport % 2))
505         {
506                 return FALSE;
507         }
508
509         /* Look at first byte */
510         first_byte = tvb_get_guint8(tvb, offset);
511
512         /* Are version bits set to 2? */
513         if (((first_byte & 0xC0) >> 6) != 2)
514         {
515                 return FALSE;
516         }
517
518         /* Look at packet type */
519         packet_type = tvb_get_guint8(tvb, offset + 1);
520
521         /* First packet within compound packet is supposed to be a sender
522            or receiver report.  Also see BYE so allow this...  */
523         if (!((packet_type == RTCP_SR)  || (packet_type == RTCP_RR) ||
524            packet_type == RTCP_BYE))
525         {
526                 return FALSE;
527         }
528
529         /* Overall length must be a multiple of 4 bytes */
530         if (tvb_length(tvb) % 4)
531         {
532                 return FALSE;
533         }
534
535         /* OK, dissect as RTCP */
536         dissect_rtcp(tvb, pinfo, tree);
537         return TRUE;
538 }
539
540
541 static int
542 dissect_rtcp_nack( tvbuff_t *tvb, int offset, proto_tree *tree )
543 {
544         /* Packet type = FIR (H261) */
545         proto_tree_add_uint( tree, hf_rtcp_rc, tvb, offset, 1, tvb_get_guint8( tvb, offset ) );
546         offset++;
547         /* Packet type, 8 bits  = APP */
548         proto_tree_add_item( tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
549         offset++;
550
551         /* Packet length in 32 bit words minus one */
552         proto_tree_add_uint( tree, hf_rtcp_length, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
553         offset += 2;
554
555         /* SSRC  */
556         proto_tree_add_uint( tree, hf_rtcp_ssrc_source, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
557         offset += 4;
558
559         /* FSN, 16 bits */
560         proto_tree_add_uint( tree, hf_rtcp_fsn, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
561         offset += 2;
562
563         /* BLP, 16 bits */
564         proto_tree_add_uint( tree, hf_rtcp_blp, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
565         offset += 2;
566
567         return offset;
568 }
569
570 static int
571 dissect_rtcp_fir( tvbuff_t *tvb, int offset, proto_tree *tree )
572 {
573         /* Packet type = FIR (H261) */
574         proto_tree_add_uint( tree, hf_rtcp_rc, tvb, offset, 1, tvb_get_guint8( tvb, offset ) );
575         offset++;
576         /* Packet type, 8 bits  = APP */
577         proto_tree_add_item( tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
578         offset++;
579
580         /* Packet length in 32 bit words minus one */
581         proto_tree_add_uint( tree, hf_rtcp_length, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
582         offset += 2;
583
584         /* SSRC  */
585         proto_tree_add_uint( tree, hf_rtcp_ssrc_source, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
586         offset += 4;
587
588         return offset;
589 }
590
591 static int
592 dissect_rtcp_app( tvbuff_t *tvb,packet_info *pinfo, int offset, proto_tree *tree,
593     unsigned int padding, unsigned int packet_len, guint rtcp_subtype, guint32 app_length )
594 {
595         unsigned int counter = 0;
596         char ascii_name[5];
597         guint sdes_type         = 0;
598         guint item_len          = 0;
599         guint items_start_offset;
600         proto_tree *PoC1_tree;
601         proto_item *PoC1_item;
602
603         /* XXX If more application types are to be dissected it may be useful to use a table like in packet-sip.c */
604         static const char app_name_str[] = "PoC1";
605
606
607         /* SSRC / CSRC */
608         proto_tree_add_uint( tree, hf_rtcp_ssrc_source, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
609         offset += 4;
610         packet_len -= 4;
611
612         /* Name (ASCII) */
613         for( counter = 0; counter < 4; counter++ )
614             ascii_name[ counter ] = tvb_get_guint8( tvb, offset + counter );
615         /* strncpy( ascii_name, pd + offset, 4 ); */
616         ascii_name[4] = '\0';
617         proto_tree_add_string( tree, hf_rtcp_name_ascii, tvb, offset, 4,
618             ascii_name );
619         if ( strncasecmp(ascii_name,app_name_str,4 ) != 0 ){ /* Not PoC1 */
620                 if (check_col(pinfo->cinfo, COL_INFO))
621                         col_append_fstr(pinfo->cinfo, COL_INFO,"( %s ) subtype=%u",ascii_name, rtcp_subtype);
622                 offset += 4;
623                 packet_len -= 4;
624                 /* Applications specific data */
625                 if ( padding ) {
626                         /* If there's padding present, we have to remove that from the data part
627                         * The last octet of the packet contains the length of the padding
628                         */
629                         packet_len -= tvb_get_guint8( tvb, offset + packet_len - 1 );
630                 }
631                 proto_tree_add_item( tree, hf_rtcp_app_data, tvb, offset, packet_len, FALSE );
632                 offset += packet_len;
633
634                 return offset;
635         }else{/* PoC1 Application */
636                 guint8 t2timer_code, participants_code;
637                 proto_item *item;
638                 item = proto_tree_add_uint( tree, hf_rtcp_app_poc1_subtype, tvb, offset - 8, 1, rtcp_subtype );
639                 PROTO_ITEM_SET_GENERATED(item);
640                 if (check_col(pinfo->cinfo, COL_INFO))
641                         col_append_fstr(pinfo->cinfo, COL_INFO,"(%s) subtype=%s",ascii_name,
642                                 val_to_str(rtcp_subtype,rtcp_app_poc1_floor_cnt_type_vals,"unknown (%u)") );
643                 offset += 4;
644                 packet_len -= 4;
645                 app_length = app_length -8;
646                 if ( packet_len == 0 )
647                         return offset; /* No more data */
648                 /* Applications specific data */
649                 if ( padding ) {
650                         /* If there's padding present, we have to remove that from the data part
651                         * The last octet of the packet contains the length of the padding
652                         */
653                         packet_len -= tvb_get_guint8( tvb, offset + packet_len - 1 );
654                 }
655                 /* Create a subtree for the PoC1 Application items; we don't yet know
656                    the length */
657                 items_start_offset = offset;
658
659                 PoC1_item = proto_tree_add_text(tree, tvb, offset, packet_len,
660                     "PoC1 Application specific data");
661                 PoC1_tree = proto_item_add_subtree( PoC1_item, ett_PoC1 );
662
663
664                 proto_tree_add_item( PoC1_tree, hf_rtcp_app_data, tvb, offset, packet_len, FALSE );
665                 switch ( rtcp_subtype ) {
666                         case 1: /* TBCP Granted */
667                                 t2timer_code = tvb_get_guint8(tvb, offset);
668                                 offset += 1;
669                                 packet_len -=1;
670                                 if (t2timer_code != 101) /* SHALL be 101 */
671                                         return offset;
672                                 
673                                 item_len = tvb_get_guint8(tvb, offset);
674                                 offset += 1;
675                                 packet_len -= 1;
676                                 if (item_len != 2) /* SHALL be 2 */
677                                         return offset;
678                                 
679                                 proto_tree_add_item(PoC1_tree, hf_rtcp_app_poc1_stt, tvb, offset, 2, FALSE );
680                                 offset += item_len;
681                                 packet_len -= item_len;
682
683                                 participants_code = tvb_get_guint8(tvb, offset);
684                                 offset += 1;
685                                 packet_len -=1;
686                                 if (participants_code != 100) /* SHALL be 100 */
687                                         return offset;
688                                 
689                                 item_len = tvb_get_guint8(tvb, offset);
690                                 offset += 1;
691                                 packet_len -= 1;
692                                 if (item_len != 2) /* SHALL be 2 */
693                                         return offset;
694                                 
695                                 proto_tree_add_item(PoC1_tree, hf_rtcp_app_poc1_partic, tvb, offset, 2, FALSE );
696                                 offset += item_len;
697                                 packet_len -= item_len;
698                                 break;
699                         case 2:         /* TBCP Talk Burst Taken (no reply expected) */
700                         case 18:        /* TBCP Talk Burst Taken (ack expected) */
701                                 proto_tree_add_item(PoC1_tree, hf_rtcp_app_poc1_ssrc_granted, tvb, offset, 4, FALSE );
702                                 offset += 4;
703                                 packet_len -= 4;
704                                 sdes_type = tvb_get_guint8( tvb, offset );
705                                 proto_tree_add_item( PoC1_tree, hf_rtcp_sdes_type, tvb, offset, 1, FALSE );
706                                 offset++;
707                                 packet_len--;
708                                 /* Item length, 8 bits */
709                                 item_len = tvb_get_guint8( tvb, offset );
710                                 proto_tree_add_item( PoC1_tree, hf_rtcp_sdes_length, tvb, offset, 1, FALSE );
711                                 offset++;
712                                 packet_len--;
713                                 proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_sip_uri, tvb, offset, item_len, FALSE );
714                                 offset = offset + item_len;
715                                 packet_len = packet_len - item_len;
716                                 
717                                 /* In the application dependent data, the TBCP Talk Burst Taken message SHALL carry
718                                  * a SSRC field and SDES items, CNAME and MAY carry SDES item NAME to identify the
719                                  * PoC Client that has been granted permission to send a Talk Burst. 
720                                  * The SDES item NAME SHALL be included if it is known by the PoC Server. 
721                                  * Therefore the length of the packet will vary depending on numbwe of SDES items 
722                                  * and the size of the SDES items.
723                                  */
724                                 if ( packet_len == 0 )
725                                         return offset;
726                                 
727                                 sdes_type = tvb_get_guint8( tvb, offset );
728                                 proto_tree_add_item( PoC1_tree, hf_rtcp_sdes_type, tvb, offset, 1, FALSE );
729                                 offset++;
730                                 packet_len--;
731                                 /* Item length, 8 bits */
732                                 item_len = tvb_get_guint8( tvb, offset );
733                                 proto_tree_add_item( PoC1_tree, hf_rtcp_sdes_length, tvb, offset, 1, FALSE );
734                                 offset++;
735                                 packet_len--;
736                                 if ( item_len != 0 )
737                                         proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_disp_name, tvb, offset, item_len, FALSE );
738                                 offset = offset + item_len;
739                                 packet_len = packet_len - item_len;
740                                 
741                                 if (packet_len == 0)
742                                         return offset;
743                                 participants_code = tvb_get_guint8(tvb, offset);
744                                 offset += 1;
745                                 packet_len -=1;
746                                 if (participants_code != 100) /* SHALL be 100 */
747                                         return offset;
748                                 item_len = tvb_get_guint8(tvb, offset);
749                                 offset += 1;
750                                 packet_len -= 1;
751                                 if (item_len != 2) /* SHALL be 2 */
752                                         return offset;
753                                 proto_tree_add_item(PoC1_tree, hf_rtcp_app_poc1_partic, tvb, offset, 2, FALSE );
754                                 offset += item_len;
755                                 packet_len -= item_len;
756                                 break;
757                         case 3:         /* TBCP Talk Burst Deny */
758                                 proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_reason_code1, tvb, offset, 1, FALSE );
759                                 offset++;
760                                 packet_len--;
761                                 /* Item length, 8 bits */
762                                 item_len = tvb_get_guint8( tvb, offset );
763                                 proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_item_len, tvb, offset, 1, FALSE );
764                                 offset++;
765                                 packet_len--;
766                                 if ( item_len != 0 )
767                                         proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_reason1_phrase, tvb, offset, item_len, FALSE );
768                                 offset = offset + item_len;
769                                 packet_len = packet_len - item_len;
770                                 break;
771                         case 4:         /* TBCP Talk Burst Release */
772                                 proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_last_pkt_seq_no, tvb, offset, 2, FALSE );
773                                 proto_tree_add_text(PoC1_tree, tvb, offset + 2, 2, "Padding 2 bytes");
774                                 offset += 4;
775                                 packet_len-=4;
776                                 break;
777                                                 /* 5 TBCP Talk Burst Idle */
778                         case 6:         /* TBCP Talk Burst Revoke */
779                                 proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_reason_code2, tvb, offset, 2, FALSE );
780                                 proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_additionalinfo, tvb, offset + 2, 2, FALSE );
781                                 offset += 4;
782                                 packet_len-=4;
783                                 break;
784
785                         case 7:         /* TBCP Talk Burst Acknowledgement */
786                             proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_ack_subtype, tvb, offset, 1, FALSE );
787                             proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_ack_reason_code, tvb, offset, 2, FALSE );
788                             proto_tree_add_text( PoC1_tree, tvb, offset + 2, 2, "Padding 2 bytes" );
789                             offset += 4;
790                             packet_len -= 4;
791                             break;
792
793                                 /* 8 TBCP Queue Status Request */
794
795                         case 9: /*TBCP Queue Status Response */
796                             proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_qsresp_priority, tvb, offset, 1, FALSE );
797                             proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_qsresp_position, tvb, offset + 1, 2, FALSE );
798                             proto_tree_add_text( PoC1_tree, tvb, offset + 3, 1, "Padding 1 byte" );
799                             offset += 4;
800                             packet_len -= 4;
801                             break;
802                                 
803                                 /* 11 TBCP Disconnect */
804
805                         case 15:                /* TBCP Connect */
806                                 {
807                             proto_item *content = proto_tree_add_text(PoC1_tree, tvb, offset, 2, "SDES item content");
808                             gboolean contents[5];
809                             unsigned int i;
810
811                             proto_tree *content_tree = proto_item_add_subtree(content, ett_poc1_conn_contents);
812                             guint temp_byte = tvb_get_guint8( tvb, offset );
813
814                             for ( i = 0; i < sizeof(contents) /
815                                       sizeof(contents[0]) &&
816                                       i < sizeof(hf_rtcp_app_poc1_conn_content_1st_byte) /
817                                       sizeof(hf_rtcp_app_poc1_conn_content_1st_byte[0]);
818                                   ++i ) {
819                                 proto_tree_add_item( content_tree, hf_rtcp_app_poc1_conn_content_1st_byte[i], tvb, offset, 1, FALSE );
820                                 contents[i] = temp_byte & (1 << (7-i));
821                             }
822
823                             proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_conn_session_type, tvb, offset + 2, 1, FALSE );
824
825                             proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_conn_add_ind_mao, tvb, offset + 3, 1, FALSE );
826                             
827                             offset += 4;
828                             packet_len -= 4;
829
830                             for ( i = 0; i < sizeof(contents) /
831                                       sizeof(contents[0]); ++i ) {
832                                 if ( contents[i] ) {
833                                     guint sdes_type, sdes_len;
834                                     sdes_type = tvb_get_guint8( tvb, offset++ );
835                                     sdes_len = tvb_get_guint8( tvb, offset );
836
837                                     proto_tree_add_item( PoC1_tree, hf_rtcp_app_poc1_conn_sdes_items[i], tvb, offset, 1, FALSE );
838
839                                     offset += sdes_len + 1;
840                                     packet_len -= (sdes_len + 2);
841                                 }
842                             }
843                             break;
844                         }    
845                         default:
846                                 break;
847                 }
848                 offset += packet_len;
849                 return offset;
850         }
851 }
852
853
854 static int
855 dissect_rtcp_bye( tvbuff_t *tvb, int offset, proto_tree *tree,
856     unsigned int count )
857 {
858         unsigned int chunk          = 1;
859         unsigned int reason_length  = 0;
860         char* reason_text = NULL;
861
862         while ( chunk <= count ) {
863                 /* source identifier, 32 bits */
864                 proto_tree_add_item( tree, hf_rtcp_ssrc_source, tvb, offset, 4, FALSE);
865                 offset += 4;
866                 chunk++;
867         }
868
869         if ( tvb_reported_length_remaining( tvb, offset ) > 0 ) {
870                 /* Bye reason consists of an 8 bit length l and a string with length l */
871                 reason_length = tvb_get_guint8( tvb, offset );
872                 proto_tree_add_item( tree, hf_rtcp_sdes_length, tvb, offset, 1, FALSE );
873                 offset++;
874
875                 reason_text = tvb_get_ephemeral_string(tvb, offset, reason_length);
876                 proto_tree_add_string( tree, hf_rtcp_sdes_text, tvb, offset, reason_length, reason_text );
877                 offset += reason_length;
878         }
879
880         return offset;
881
882 }
883
884 static void
885 dissect_rtcp_sdes( tvbuff_t *tvb, int offset, proto_tree *tree,
886     unsigned int count )
887 {
888         unsigned int chunk          = 1;
889         proto_item *sdes_item;
890         proto_tree *sdes_tree;
891         proto_tree *sdes_item_tree;
892         proto_item *ti;
893         int start_offset;
894         int items_start_offset;
895         guint32 ssrc;
896         unsigned int item_len       = 0;
897         unsigned int sdes_type      = 0;
898         unsigned int prefix_len     = 0;
899
900         while ( chunk <= count ) {
901                 /* Create a subtree for this chunk; we don't yet know
902                    the length. */
903                 start_offset = offset;
904
905                 ssrc = tvb_get_ntohl( tvb, offset );
906                 sdes_item = proto_tree_add_text(tree, tvb, offset, -1,
907                     "Chunk %u, SSRC/CSRC %u", chunk, ssrc);
908                 sdes_tree = proto_item_add_subtree( sdes_item, ett_sdes );
909
910                 /* SSRC_n source identifier, 32 bits */
911                 proto_tree_add_uint( sdes_tree, hf_rtcp_ssrc_source, tvb, offset, 4, ssrc );
912                 offset += 4;
913
914                 /* Create a subtree for the SDES items; we don't yet know
915                    the length */
916                 items_start_offset = offset;
917                 ti = proto_tree_add_text(sdes_tree, tvb, offset, -1,
918                     "SDES items" );
919                 sdes_item_tree = proto_item_add_subtree( ti, ett_sdes_item );
920
921                 /*
922                  * Not every message is ended with "null" bytes, so check for
923                  * end of frame as well.
924                  */
925                 while ( tvb_reported_length_remaining( tvb, offset ) > 0 ) {
926                         /* ID, 8 bits */
927                         sdes_type = tvb_get_guint8( tvb, offset );
928                         proto_tree_add_item( sdes_item_tree, hf_rtcp_sdes_type, tvb, offset, 1, FALSE );
929                         offset++;
930
931                         if ( sdes_type == RTCP_SDES_END ) {
932                                 /* End of list */
933                                 break;
934                         }
935
936                         /* Item length, 8 bits */
937                         item_len = tvb_get_guint8( tvb, offset );
938                         proto_tree_add_item( sdes_item_tree, hf_rtcp_sdes_length, tvb, offset, 1, FALSE );
939                         offset++;
940
941                         if ( item_len != 0 ) {
942                                 if ( sdes_type == RTCP_SDES_PRIV ) {
943                                         /* PRIV adds two items between the
944                                          * SDES length and value - an 8 bit
945                                          * length giving the length of a
946                                          * "prefix string", and the string.
947                                          */
948                                         prefix_len = tvb_get_guint8( tvb, offset );
949                                         if ( prefix_len + 1 > item_len ) {
950                                                 proto_tree_add_uint_format( sdes_item_tree,
951                                                     hf_rtcp_sdes_prefix_len, tvb,
952                                                     offset, 1, prefix_len,
953                                                     "Prefix length: %u (bogus, must be <= %u)",
954                                                     prefix_len, item_len - 1);
955                                                 offset += item_len;
956                                                 continue;
957                                         }
958                                         proto_tree_add_item( sdes_item_tree, hf_rtcp_sdes_prefix_len, tvb, offset, 1, FALSE );
959                                         offset++;
960
961                                         proto_tree_add_item( sdes_item_tree, hf_rtcp_sdes_prefix_string, tvb, offset, prefix_len, FALSE );
962                                         offset += prefix_len;
963                                         item_len -= prefix_len +1;
964                                         if ( item_len == 0 )
965                                                 continue;
966                                 }
967                                 proto_tree_add_item( sdes_item_tree, hf_rtcp_sdes_text, tvb, offset, item_len, FALSE );
968                                 offset += item_len;
969                         }
970                 }
971
972                 /* Set the length of the items subtree. */
973                 proto_item_set_len(ti, offset - items_start_offset);
974
975                 /* 32 bits = 4 bytes, so.....
976                  * If offset % 4 != 0, we divide offset by 4, add one and then
977                  * multiply by 4 again to reach the boundary
978                  */
979                 if ( offset % 4 != 0 )
980                         offset = ((offset / 4) + 1 ) * 4;
981
982                 /* Set the length of this chunk. */
983                 proto_item_set_len(sdes_item, offset - start_offset);
984
985                 chunk++;
986         }
987 }
988
989 static void parse_xr_type_specific_field(tvbuff_t *tvb, gint offset, guint block_type, proto_tree *tree)
990 {
991     guint8 flags = tvb_get_guint8(tvb, offset);
992
993     switch (block_type) {
994     case RTCP_XR_LOSS_RLE:
995     case RTCP_XR_DUP_RLE:
996     case RTCP_XR_PKT_RXTIMES:
997         proto_tree_add_uint(tree, hf_rtcp_xr_thinning, tvb, offset, 1, flags);
998         break;
999         
1000     case RTCP_XR_STATS_SUMRY:
1001         proto_tree_add_boolean(tree, hf_rtcp_xr_stats_loss_flag, tvb, offset, 1, flags);
1002         proto_tree_add_boolean(tree, hf_rtcp_xr_stats_dup_flag, tvb, offset, 1, flags);
1003         proto_tree_add_boolean(tree, hf_rtcp_xr_stats_jitter_flag, tvb, offset, 1, flags);
1004         proto_tree_add_uint(tree, hf_rtcp_xr_stats_ttl, tvb, offset, 1, flags);
1005         break;
1006
1007     default:
1008         proto_tree_add_uint(tree, hf_rtcp_xr_block_specific, tvb, offset, 1, flags);
1009         break;
1010     }
1011 }
1012
1013 static gboolean validate_xr_block_length(tvbuff_t *tvb, int offset, guint block_type, guint block_len, proto_tree *tree)
1014 {
1015     proto_tree_add_uint(tree, hf_rtcp_xr_block_length, tvb, offset, 2, block_len);
1016     switch (block_type) {
1017     case RTCP_XR_REF_TIME:
1018         if (block_len != 2)
1019             proto_tree_add_text(tree, tvb, offset, 2, "Invalid block length, should be 2");
1020         return FALSE;
1021
1022     case RTCP_XR_STATS_SUMRY:
1023         if (block_len != 9)
1024             proto_tree_add_text(tree, tvb, offset, 2, "Invalid block length, should be 9");
1025         return FALSE;
1026
1027     case RTCP_XR_VOIP_METRCS:
1028         if (block_len != 8)
1029             proto_tree_add_text(tree, tvb, offset, 2, "Invalid block length, should be 8");
1030         return FALSE;
1031
1032     default:
1033         break;
1034     }
1035     return TRUE;
1036 }
1037
1038 static int
1039 dissect_rtcp_xr(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, proto_tree *tree, gint packet_len)
1040 {
1041     guint block_num = 1;
1042     
1043     /* Packet length should at least be 4 */
1044     if (packet_len < 4) {
1045         proto_tree_add_text(tree, tvb, offset, packet_len, "Missing Sender SSRC");
1046         return offset + packet_len;
1047     }
1048         
1049     /* SSRC */
1050     proto_tree_add_item( tree, hf_rtcp_ssrc_sender, tvb, offset, 4, FALSE );
1051     offset += 4;
1052     packet_len -= 4;
1053     
1054     for(;packet_len > 0; block_num++) {
1055         guint block_type = tvb_get_guint8(tvb, offset), block_length = 0;
1056         gint content_length = 0;
1057         gboolean valid = TRUE;
1058         
1059         /* Create a subtree for this block, dont know the length yet*/
1060         proto_item *block = proto_tree_add_text(tree, tvb, offset, -1, "Block %u", block_num);
1061         proto_tree *xr_block_tree = proto_item_add_subtree(block, ett_xr_block);
1062         proto_item *contents = NULL;
1063         proto_item *content_tree = NULL;
1064
1065         proto_tree_add_item(xr_block_tree, hf_rtcp_xr_block_type, tvb, offset, 1, FALSE);
1066         
1067         if (packet_len >= 2) {
1068             parse_xr_type_specific_field(tvb, offset + 1, block_type, xr_block_tree);
1069             if (packet_len >= 4) {
1070                 block_length = tvb_get_ntohs(tvb, offset + 2);
1071                 valid = validate_xr_block_length(tvb, offset + 2, block_type, block_length, xr_block_tree);
1072             }
1073         } else {
1074             proto_tree_add_text(xr_block_tree, tvb, offset + 1, packet_len, "Missing Required Block Headers");
1075             return offset + packet_len;
1076         }
1077                 
1078         content_length = block_length * 4;
1079         proto_item_set_len(block, content_length + 4);
1080         
1081         if (content_length > packet_len) {
1082             proto_tree_add_text(xr_block_tree, tvb, offset + 2, 2, "Block length is greater than packet length");
1083         }
1084                 
1085         offset += 4;
1086         packet_len -= 4;
1087
1088         contents = proto_tree_add_text(xr_block_tree, tvb, offset, content_length, "Contents");
1089         content_tree = proto_item_add_subtree(contents, ett_xr_block_contents);
1090             
1091         switch (block_type) {
1092         case RTCP_XR_VOIP_METRCS: {
1093             guint fraction_rate, value;
1094             
1095             /* Identifier */
1096             proto_tree_add_item(content_tree, hf_rtcp_ssrc_source, tvb, offset, 4, FALSE);
1097             offset += 4;
1098             
1099             /* Loss Rate */
1100             fraction_rate = tvb_get_guint8(tvb, offset);
1101             proto_tree_add_uint_format(content_tree, hf_rtcp_ssrc_fraction, tvb, offset, 1, 
1102                                        fraction_rate, "Fraction lost: %u / 256", fraction_rate);
1103             offset++;
1104             
1105             /* Discard Rate */
1106             fraction_rate = tvb_get_guint8(tvb, offset);
1107             proto_tree_add_uint_format(content_tree, hf_rtcp_ssrc_discarded, tvb, offset, 1, 
1108                                        fraction_rate, "Fraction Discarded: %u / 256", fraction_rate);
1109             offset++;
1110             
1111             /* Burst Density */
1112             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_burst_density, tvb, offset, 1, FALSE);
1113             offset++;
1114             
1115             /* Gap Density */
1116             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_gap_density, tvb, offset, 1, FALSE);
1117             offset++;
1118             
1119             /* Burst Duration */
1120             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_burst_duration, tvb, offset, 2, FALSE);
1121             offset += 2;
1122             
1123             /* Gap Duration */
1124             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_gap_duration, tvb, offset, 2, FALSE);
1125             offset += 2;
1126             
1127             /* Round Trip Delay */
1128             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_rtdelay, tvb, offset, 2, FALSE);
1129             offset += 2;
1130             
1131             /* End System Delay */
1132             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_esdelay, tvb, offset, 2, FALSE);
1133             offset += 2;
1134             
1135             /* Signal Level */
1136             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_siglevel, tvb, offset, 1, FALSE);
1137             offset++;
1138             
1139             /* Noise Level */
1140             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_noiselevel, tvb, offset, 1, FALSE);
1141             offset++;
1142             
1143             /* RERL */
1144             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_rerl, tvb, offset, 1, FALSE);
1145             offset++;
1146             
1147             /* GMin */
1148             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_gmin, tvb, offset, 1, FALSE);
1149             offset++;
1150             
1151             /* R factor */
1152             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_rfactor, tvb, offset, 1, FALSE);
1153             offset++;
1154             
1155             /* external R Factor */
1156             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_extrfactor, tvb, offset, 1, FALSE);
1157             offset++;
1158             
1159             /* MOS LQ */
1160             proto_tree_add_float(content_tree, hf_rtcp_xr_voip_metrics_moslq, tvb, offset, 1, 
1161                                  (gfloat)tvb_get_guint8(tvb, offset) / 10);
1162             offset++;
1163             
1164             /* MOS CQ */
1165             proto_tree_add_float(content_tree, hf_rtcp_xr_voip_metrics_moscq, tvb, offset, 1, 
1166                                  (gfloat)tvb_get_guint8(tvb, offset) / 10);
1167             offset++;
1168             
1169             /* PLC, JB Adaptive, JB Rate */
1170             value = tvb_get_guint8(tvb, offset);
1171             proto_tree_add_uint(content_tree, hf_rtcp_xr_voip_metrics_plc, tvb, offset, 1, value);
1172             proto_tree_add_uint(content_tree, hf_rtcp_xr_voip_metrics_jbadaptive, tvb, offset, 1, value);
1173             proto_tree_add_uint(content_tree, hf_rtcp_xr_voip_metrics_jbrate, tvb, offset, 1, value);
1174             offset += 2; /* skip over reseved bit */
1175             
1176             /* JB Nominal */
1177             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_jbnominal, tvb, offset, 2, FALSE);
1178             offset += 2;
1179             
1180             /* JB Max */
1181             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_jbmax, tvb, offset, 2, FALSE);
1182             offset += 2;
1183             
1184             /* JB Abs max */
1185             proto_tree_add_item(content_tree, hf_rtcp_xr_voip_metrics_jbabsmax, tvb, offset, 2, FALSE);
1186             offset += 2;
1187
1188             break;
1189         }
1190             
1191         case RTCP_XR_STATS_SUMRY: {
1192             /* Identifier */
1193             proto_tree_add_item(content_tree, hf_rtcp_ssrc_source, tvb, offset, 4, FALSE);
1194             offset += 4;
1195
1196             /* Begin Seq */
1197             proto_tree_add_item(content_tree, hf_rtcp_xr_beginseq, tvb, offset, 2, FALSE);
1198             offset += 2;
1199
1200             /* End Seq */
1201             proto_tree_add_item(content_tree, hf_rtcp_xr_endseq, tvb, offset, 2, FALSE);
1202             offset += 2;
1203
1204             /* Lost Pkts */
1205             proto_tree_add_item(content_tree, hf_rtcp_xr_stats_lost, tvb, offset, 4, FALSE);
1206             offset += 4;
1207
1208             /* Dup Pkts */
1209             proto_tree_add_item(content_tree, hf_rtcp_xr_stats_dups, tvb, offset, 4, FALSE);
1210             offset += 4;
1211
1212             /* Min Jitter */
1213             proto_tree_add_item(content_tree, hf_rtcp_xr_stats_minjitter, tvb, offset, 4, FALSE);
1214             offset += 4;
1215
1216             /* Max Jitter */
1217             proto_tree_add_item(content_tree, hf_rtcp_xr_stats_maxjitter, tvb, offset, 4, FALSE);
1218             offset += 4;
1219
1220             /* Mean Jitter */
1221             proto_tree_add_item(content_tree, hf_rtcp_xr_stats_meanjitter, tvb, offset, 4, FALSE);
1222             offset += 4;
1223
1224             /* Dev Jitter */
1225             proto_tree_add_item(content_tree, hf_rtcp_xr_stats_devjitter, tvb, offset, 4, FALSE);
1226             offset += 4;
1227
1228             /* Min TTL */
1229             proto_tree_add_item(content_tree, hf_rtcp_xr_stats_minttl, tvb, offset, 1, FALSE);
1230             offset ++;
1231
1232             /* Max TTL */
1233             proto_tree_add_item(content_tree, hf_rtcp_xr_stats_maxttl, tvb, offset, 1, FALSE);
1234             offset ++;
1235
1236             /* Mean TTL */
1237             proto_tree_add_item(content_tree, hf_rtcp_xr_stats_meanttl, tvb, offset, 1, FALSE);
1238             offset ++;
1239
1240             /* Dev TTL */
1241             proto_tree_add_item(content_tree, hf_rtcp_xr_stats_devttl, tvb, offset, 1, FALSE);
1242             offset ++;
1243
1244             break;
1245         }
1246
1247         case RTCP_XR_REF_TIME: {
1248             guint32 ts_msw, ts_lsw;
1249
1250             ts_msw = tvb_get_ntohl(tvb, offset);
1251             proto_tree_add_text(content_tree, tvb, offset, 4, "Timestamp, MSW: %u", ts_msw);
1252             offset += 4;
1253             ts_lsw = tvb_get_ntohl(tvb, offset);
1254             proto_tree_add_text(content_tree, tvb, offset, 4, "Timestamp, LSW: %u", ts_lsw);
1255             offset += 4;
1256             
1257             break;
1258         }
1259
1260         case RTCP_XR_DLRR: {
1261             /* Each report block is 12 bytes */
1262             gint sources = content_length / 12;
1263             gint counter = 0;
1264             for(counter = 0; counter < sources; counter++) {
1265                 /* Create a new subtree for a length of 12 bytes */
1266                 proto_tree *ti = proto_tree_add_text(content_tree, tvb, offset, 12, "Source %u", counter + 1);
1267                 proto_tree *ssrc_tree = proto_item_add_subtree(ti, ett_xr_ssrc);
1268                 
1269                 /* SSRC_n source identifier, 32 bits */
1270                 proto_tree_add_item(ssrc_tree, hf_rtcp_ssrc_source, tvb, offset, 4, FALSE);
1271                 offset += 4;
1272                 
1273                 /* Last RR timestamp */
1274                 proto_tree_add_item(ssrc_tree, hf_rtcp_xr_lrr, tvb, offset, 4, FALSE);
1275                 offset += 4;
1276                 
1277                 /* Delay since last RR timestamp */
1278                 proto_tree_add_item(ssrc_tree, hf_rtcp_xr_dlrr, tvb, offset, 4, FALSE);
1279                 offset += 4;
1280             }
1281             
1282             if (content_length % 12 != 0)
1283                 offset += content_length % 12;
1284             break;
1285         }
1286
1287         case RTCP_XR_PKT_RXTIMES: {
1288             /* 8 bytes of fixed header */
1289             gint count = 0, skip = 8;
1290             guint16 begin = 0;
1291
1292             /* Identifier */
1293             proto_tree_add_item(content_tree, hf_rtcp_ssrc_source, tvb, offset, 4, FALSE);
1294             offset += 4;
1295
1296             /* Begin Seq */
1297             begin = tvb_get_ntohs(tvb, offset);
1298             proto_tree_add_uint(content_tree, hf_rtcp_xr_beginseq, tvb, offset, 2, begin);
1299             offset += 2;
1300
1301             /* End Seq */
1302             proto_tree_add_item(content_tree, hf_rtcp_xr_endseq, tvb, offset, 2, FALSE);
1303             offset += 2;
1304
1305             for(count = 0; skip < content_length; skip += 4, count++) { 
1306                 proto_tree_add_text(content_tree, tvb, offset, 4, "Seq: %u, Timestamp: %u", 
1307                                     (begin + count) % 65536, FALSE);
1308                 offset += 4;
1309             }
1310             break;
1311         }
1312
1313         case RTCP_XR_LOSS_RLE:
1314         case RTCP_XR_DUP_RLE: {
1315             /* 8 bytes of fixed header */
1316             gint count = 0, skip = 8;
1317             guint16 begin = 0;
1318             proto_item *chunks_item;
1319             proto_tree *chunks_tree;
1320             
1321             /* Identifier */
1322             proto_tree_add_item(content_tree, hf_rtcp_ssrc_source, tvb, offset, 4, FALSE);
1323             offset += 4;
1324
1325             /* Begin Seq */
1326             begin = tvb_get_ntohs(tvb, offset);
1327             proto_tree_add_uint(content_tree, hf_rtcp_xr_beginseq, tvb, offset, 2, begin);
1328             offset += 2;
1329
1330             /* End Seq */
1331             proto_tree_add_item(content_tree, hf_rtcp_xr_endseq, tvb, offset, 2, FALSE);
1332             offset += 2;
1333
1334             /* report Chunks */
1335             chunks_item = proto_tree_add_text(content_tree, tvb, offset, content_length,"Report Chunks");
1336             chunks_tree = proto_item_add_subtree(chunks_item, ett_xr_loss_chunk);
1337
1338             for(count = 1; skip < content_length; skip += 2, count++) {
1339                 guint value = tvb_get_ntohs(tvb, offset);
1340                 
1341                 if (value == 0) {
1342                     proto_tree_add_text(chunks_tree, tvb, offset, 2,
1343                                         "Chunk: %u -- Null Terminator ",
1344                                         count);
1345                 } else if ( ! ( value & 0x8000 )) {
1346                     const gchar* run_type = (value & 0x4000) ? "1s" : "0s";
1347                     value &= 0x7FFF;
1348                     proto_tree_add_text(chunks_tree, tvb, offset, 2,
1349                                         "Chunk: %u -- Length Run %s, length: %u",
1350                                         count, run_type, value);
1351                 } else {
1352                     char bits[20+1];
1353                     other_decode_bitfield_value(bits, value, 0x00007FFF, 16);
1354                     proto_tree_add_text(chunks_tree, tvb, offset, 2,
1355                                         "Chunk: %u -- Bit Vector, bits: %s",
1356                                         count, bits );
1357                 }
1358                 offset += 2;
1359             }
1360             
1361             break;
1362         }
1363
1364         default:
1365             /* skip over the unknown block */
1366             offset += content_length;
1367             break;
1368         }
1369         packet_len -= content_length;
1370     }
1371     return offset;
1372 }
1373
1374 static int
1375 dissect_rtcp_rr( packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree,
1376     unsigned int count )
1377 {
1378         unsigned int counter = 1;
1379         proto_tree *ssrc_tree = (proto_tree*) NULL;
1380         proto_tree *ssrc_sub_tree = (proto_tree*) NULL;
1381         proto_tree *high_sec_tree = (proto_tree*) NULL;
1382         proto_item *ti = (proto_item*) NULL;
1383         guint8 rr_flt;
1384         unsigned int cum_nr = 0;
1385
1386         while ( counter <= count ) {
1387                 guint32 lsr, dlsr;
1388
1389                 /* Create a new subtree for a length of 24 bytes */
1390                 ti = proto_tree_add_text(tree, tvb, offset, 24,
1391                     "Source %u", counter );
1392                 ssrc_tree = proto_item_add_subtree( ti, ett_ssrc );
1393
1394                 /* SSRC_n source identifier, 32 bits */
1395                 proto_tree_add_item( ssrc_tree, hf_rtcp_ssrc_source, tvb, offset, 4, FALSE );
1396                 offset += 4;
1397
1398                 ti = proto_tree_add_text(ssrc_tree, tvb, offset, 20, "SSRC contents" );
1399                 ssrc_sub_tree = proto_item_add_subtree( ti, ett_ssrc_item );
1400
1401                 /* Fraction lost, 8bits */
1402                 rr_flt = tvb_get_guint8( tvb, offset );
1403                 proto_tree_add_uint_format( ssrc_sub_tree, hf_rtcp_ssrc_fraction, tvb,
1404                     offset, 1, rr_flt, "Fraction lost: %u / 256", rr_flt );
1405                 offset++;
1406
1407                 /* Cumulative number of packets lost, 24 bits */
1408                 cum_nr = tvb_get_ntohl( tvb, offset ) >> 8;
1409                 proto_tree_add_uint( ssrc_sub_tree, hf_rtcp_ssrc_cum_nr, tvb,
1410                     offset, 3, cum_nr );
1411                 offset += 3;
1412
1413                 /* Extended highest sequence nr received, 32 bits
1414                  * Just for the sake of it, let's add another subtree
1415                  * because this might be a little clearer
1416                  */
1417                 ti = proto_tree_add_uint( ssrc_tree, hf_rtcp_ssrc_ext_high_seq,
1418                     tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
1419                 high_sec_tree = proto_item_add_subtree( ti, ett_ssrc_ext_high );
1420                 /* Sequence number cycles */
1421                 proto_tree_add_item( high_sec_tree, hf_rtcp_ssrc_high_cycles,
1422                     tvb, offset, 2, FALSE );
1423                 offset += 2;
1424                 /* highest sequence number received */
1425                 proto_tree_add_item( high_sec_tree, hf_rtcp_ssrc_high_seq,
1426                     tvb, offset, 2, FALSE );
1427                 offset += 2;
1428
1429                 /* Interarrival jitter */
1430                 proto_tree_add_item( ssrc_tree, hf_rtcp_ssrc_jitter, tvb,
1431                     offset, 4, FALSE );
1432                 offset += 4;
1433
1434                 /* Last SR timestamp */
1435                 lsr = tvb_get_ntohl( tvb, offset );
1436                 proto_tree_add_uint( ssrc_tree, hf_rtcp_ssrc_lsr, tvb,
1437                                      offset, 4, lsr );
1438                 offset += 4;
1439
1440                 /* Delay since last SR timestamp */
1441                 dlsr = tvb_get_ntohl( tvb, offset );
1442                 proto_tree_add_uint( ssrc_tree, hf_rtcp_ssrc_dlsr, tvb,
1443                                      offset, 4, dlsr );
1444                 offset += 4;
1445
1446                 /* Do roundtrip calculation */
1447                 if (global_rtcp_show_roundtrip_calculation)
1448                 {
1449                         /* Based on delay since SR was sent in other direction */
1450                         calculate_roundtrip_delay(tvb, pinfo, ssrc_tree, lsr, dlsr);
1451                 }
1452
1453                 counter++;
1454         }
1455
1456         return offset;
1457 }
1458
1459 static int
1460 dissect_rtcp_sr( packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree,
1461     unsigned int count )
1462 {
1463         proto_item* item;
1464         guint32 ts_msw, ts_lsw;
1465         gchar *buff;
1466
1467         /* NTP timestamp */
1468         ts_msw = tvb_get_ntohl(tvb, offset);
1469         proto_tree_add_item(tree, hf_rtcp_ntp_msw, tvb, offset, 4, FALSE);
1470
1471         ts_lsw = tvb_get_ntohl(tvb, offset+4);
1472         proto_tree_add_item(tree, hf_rtcp_ntp_lsw, tvb, offset, 4, FALSE);
1473
1474         buff=ntp_fmt_ts(tvb_get_ptr( tvb, offset, 8 ));
1475         item = proto_tree_add_string_format( tree, hf_rtcp_ntp, tvb, offset, 8, ( const char* ) buff, "MSW and LSW as NTP timestamp: %s", buff );
1476         PROTO_ITEM_SET_GENERATED(item);
1477         offset += 8;
1478
1479         /* RTP timestamp, 32 bits */
1480         proto_tree_add_uint( tree, hf_rtcp_rtp_timestamp, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
1481         offset += 4;
1482         /* Sender's packet count, 32 bits */
1483         proto_tree_add_uint( tree, hf_rtcp_sender_pkt_cnt, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
1484         offset += 4;
1485         /* Sender's octet count, 32 bits */
1486         proto_tree_add_uint( tree, hf_rtcp_sender_oct_cnt, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
1487         offset += 4;
1488
1489         /* Record the time of this packet in the sender's conversation */
1490         if (global_rtcp_show_roundtrip_calculation)
1491         {
1492                 /* Use middle 32 bits of 64-bit time value */
1493                 guint32 lsr = ((ts_msw & 0x0000ffff) << 16 | (ts_lsw & 0xffff0000) >> 16);
1494
1495                 /* Record the time that we sent this in appropriate conversation */
1496                 remember_outgoing_sr(pinfo, lsr);
1497         }
1498
1499         /* The rest of the packet is equal to the RR packet */
1500         if ( count != 0 )
1501                 offset = dissect_rtcp_rr( pinfo, tvb, offset, tree, count );
1502
1503         return offset;
1504 }
1505
1506 /* Look for conversation info and display any setup info found */
1507 void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1508 {
1509         /* Conversation and current data */
1510         conversation_t *p_conv = NULL;
1511         struct _rtcp_conversation_info *p_conv_data = NULL;
1512
1513         /* Use existing packet data if available */
1514         p_conv_data = p_get_proto_data(pinfo->fd, proto_rtcp);
1515
1516         if (!p_conv_data)
1517         {
1518                 /* First time, get info from conversation */
1519                 p_conv = find_conversation(pinfo->fd->num, &pinfo->net_dst, &pinfo->net_src,
1520                                            pinfo->ptype,
1521                                            pinfo->destport, pinfo->srcport, NO_ADDR_B);
1522
1523                 if (p_conv)
1524                 {
1525                         /* Look for data in conversation */
1526                         struct _rtcp_conversation_info *p_conv_packet_data;
1527                         p_conv_data = conversation_get_proto_data(p_conv, proto_rtcp);
1528
1529                         if (p_conv_data)
1530                         {
1531                                 /* Save this conversation info into packet info */
1532                                 p_conv_packet_data = se_alloc(sizeof(struct _rtcp_conversation_info));
1533                                 if (!p_conv_packet_data)
1534                                 {
1535                                         return;
1536                                 }
1537                                 memcpy(p_conv_packet_data, p_conv_data,
1538                                        sizeof(struct _rtcp_conversation_info));
1539
1540                                 p_add_proto_data(pinfo->fd, proto_rtcp, p_conv_packet_data);
1541                         }
1542                 }
1543         }
1544
1545         /* Create setup info subtree with summary info. */
1546         if (p_conv_data && p_conv_data->setup_method_set)
1547         {
1548                 proto_tree *rtcp_setup_tree;
1549                 proto_item *ti =  proto_tree_add_string_format(tree, hf_rtcp_setup, tvb, 0, 0,
1550                                                                "",
1551                                                                "Stream setup by %s (frame %u)",
1552                                                                p_conv_data->setup_method,
1553                                                                p_conv_data->setup_frame_number);
1554                 PROTO_ITEM_SET_GENERATED(ti);
1555                 rtcp_setup_tree = proto_item_add_subtree(ti, ett_rtcp_setup);
1556                 if (rtcp_setup_tree)
1557                 {
1558                         /* Add details into subtree */
1559                         proto_item* item = proto_tree_add_uint(rtcp_setup_tree, hf_rtcp_setup_frame,
1560                                                                tvb, 0, 0, p_conv_data->setup_frame_number);
1561                         PROTO_ITEM_SET_GENERATED(item);
1562                         item = proto_tree_add_string(rtcp_setup_tree, hf_rtcp_setup_method,
1563                                                      tvb, 0, 0, p_conv_data->setup_method);
1564                         PROTO_ITEM_SET_GENERATED(item);
1565                 }
1566         }
1567 }
1568
1569
1570 /* Update conversation data to record time that outgoing rr/sr was sent */
1571 static void remember_outgoing_sr(packet_info *pinfo, long lsr)
1572 {
1573         conversation_t *p_conv = NULL;
1574         struct _rtcp_conversation_info *p_conv_data = NULL;
1575         struct _rtcp_conversation_info *p_packet_data = NULL;
1576
1577         /* This information will be accessed when an incoming packet comes back to
1578            the side that sent this packet, so no use storing in the packet
1579            info.  However, do store the fact that we've already set this info
1580            before  */
1581
1582
1583         /**************************************************************************/
1584         /* First of all, see if we've already stored this information for this sr */
1585
1586         /* Look first in packet info */
1587         p_packet_data = p_get_proto_data(pinfo->fd, proto_rtcp);
1588         if (p_packet_data && p_packet_data->last_received_set &&
1589             p_packet_data->last_received_frame_number >= pinfo->fd->num)
1590         {
1591                 /* We already did this, OK */
1592                 return;
1593         }
1594
1595
1596         /**************************************************************************/
1597         /* Otherwise, we want to find/create the conversation and update it       */
1598
1599         /* First time, get info from conversation.
1600            Even though we think of this as an outgoing packet being sent,
1601            we store the time as being received by the destination. */
1602         p_conv = find_conversation(pinfo->fd->num, &pinfo->net_dst, &pinfo->net_src,
1603                                    pinfo->ptype,
1604                                    pinfo->destport, pinfo->srcport, NO_ADDR_B);
1605
1606         /* If the conversation doesn't exist, create it now. */
1607         if (!p_conv)
1608         {
1609                 p_conv = conversation_new(pinfo->fd->num, &pinfo->net_dst, &pinfo->net_src, PT_UDP,
1610                                           pinfo->destport, pinfo->srcport,
1611                                           NO_ADDR2);
1612                 if (!p_conv)
1613                 {
1614                         /* Give up if can't create it */
1615                         return;
1616                 }
1617         }
1618
1619
1620         /****************************************************/
1621         /* Now find/create conversation data                */
1622         p_conv_data = conversation_get_proto_data(p_conv, proto_rtcp);
1623         if (!p_conv_data)
1624         {
1625                 /* Allocate memory for data */
1626                 p_conv_data = se_alloc(sizeof(struct _rtcp_conversation_info));
1627                 if (!p_conv_data)
1628                 {
1629                         /* Give up if couldn't allocate space for memory */
1630                         return;
1631                 }
1632                 memset(p_conv_data, 0, sizeof(struct _rtcp_conversation_info));
1633
1634                 /* Add it to conversation. */
1635                 conversation_add_proto_data(p_conv, proto_rtcp, p_conv_data);
1636         }
1637
1638         /*******************************************************/
1639         /* Update conversation data                            */
1640         p_conv_data->last_received_set = TRUE;
1641         p_conv_data->last_received_frame_number = pinfo->fd->num;
1642         p_conv_data->last_received_timestamp = pinfo->fd->abs_ts;
1643         p_conv_data->last_received_ts = lsr;
1644
1645
1646         /****************************************************************/
1647         /* Update packet info to record conversation state              */
1648
1649         /* Will use/create packet info */
1650         if (!p_packet_data)
1651         {
1652                 p_packet_data = se_alloc(sizeof(struct _rtcp_conversation_info));
1653                 if (!p_packet_data)
1654                 {
1655                         /* Give up if allocation fails */
1656                         return;
1657                 }
1658                 memset(p_packet_data, 0, sizeof(struct _rtcp_conversation_info));
1659
1660                 p_add_proto_data(pinfo->fd, proto_rtcp, p_packet_data);
1661         }
1662
1663         /* Copy current conversation data into packet info */
1664         p_packet_data->last_received_set = TRUE;
1665         p_packet_data->last_received_frame_number = p_conv_data->last_received_frame_number;
1666         p_packet_data->last_received_timestamp = p_conv_data->last_received_timestamp;
1667 }
1668
1669
1670 /* Use received sr to work out what the roundtrip delay is
1671    (at least between capture point and the other endpoint involved in
1672     the conversation) */
1673 static void calculate_roundtrip_delay(tvbuff_t *tvb, packet_info *pinfo,
1674                                       proto_tree *tree, guint32 lsr, guint32 dlsr)
1675 {
1676         /*****************************************************/
1677         /* This is called dissecting an SR.  We need to:
1678            - look in the packet info for stored calculation.  If found, use.
1679            - look up the conversation of the sending side to see when the
1680              'last SR' was detected (received)
1681            - calculate the network delay using the that packet time,
1682              this packet time, and dlsr
1683         *****************************************************/
1684
1685         conversation_t *p_conv = NULL;
1686         struct _rtcp_conversation_info *p_conv_data = NULL;
1687         struct _rtcp_conversation_info *p_packet_data = NULL;
1688
1689
1690         /*************************************************/
1691         /* Look for previous result                      */
1692         p_packet_data = p_get_proto_data(pinfo->fd, proto_rtcp);
1693         if (p_packet_data && p_packet_data->lsr_matched)
1694         {
1695                 /* Show info. */
1696                 add_roundtrip_delay_info(tvb, pinfo, tree,
1697                                          p_packet_data->calculated_delay_used_frame,
1698                                          p_packet_data->calculated_delay);
1699                 return;
1700         }
1701
1702
1703         /********************************************************************/
1704         /* Look for captured timestamp of last SR in conversation of sender */
1705         /* of this packet                                                   */
1706         p_conv = find_conversation(pinfo->fd->num, &pinfo->net_src, &pinfo->net_dst,
1707                                    pinfo->ptype,
1708                                    pinfo->srcport, pinfo->destport, NO_ADDR_B);
1709         if (!p_conv)
1710         {
1711                 return;
1712         }
1713
1714         /* Look for conversation data  */
1715         p_conv_data = conversation_get_proto_data(p_conv, proto_rtcp);
1716         if (!p_conv_data)
1717         {
1718                 return;
1719         }
1720
1721         if (p_conv_data->last_received_set)
1722         {
1723                 /* Store result of calculation in packet info */
1724                 if (!p_packet_data)
1725                 {
1726                         /* Create packet info if it doesn't exist */
1727                         p_packet_data = se_alloc(sizeof(struct _rtcp_conversation_info));
1728                         if (!p_packet_data)
1729                         {
1730                                 /* Give up if allocation fails */
1731                                 return;
1732                         }
1733
1734                         memset(p_packet_data, 0, sizeof(struct _rtcp_conversation_info));
1735
1736                         /* Set as packet info */
1737                         p_add_proto_data(pinfo->fd, proto_rtcp, p_packet_data);
1738                 }
1739
1740                 /* Don't allow match seemingly calculated from same frame! */
1741                 if (pinfo->fd->num == p_conv_data->last_received_frame_number)
1742                 {
1743                         return;
1744                 }
1745         
1746                 /* Any previous report must match the lsr given here */
1747                 if (p_conv_data->last_received_ts == lsr)
1748                 {
1749                         /* Look at time of since original packet was sent */
1750                         gint seconds_between_packets =
1751                               pinfo->fd->abs_ts.secs - p_conv_data->last_received_timestamp.secs;
1752                         gint nseconds_between_packets =
1753                               pinfo->fd->abs_ts.nsecs - p_conv_data->last_received_timestamp.nsecs;
1754
1755                         gint total_gap = (seconds_between_packets*1000) +
1756                                          (nseconds_between_packets / 1000000);
1757                         gint delay = total_gap - (int)(((double)dlsr/(double)65536) * 1000.0);
1758
1759             /* Record that the LSR matches */
1760             p_packet_data->lsr_matched = TRUE;
1761
1762                         /* No useful calculation can be done if dlsr not set... */
1763                         if (dlsr)
1764                         {
1765                                 p_packet_data->calculated_delay = delay;
1766                                 p_packet_data->calculated_delay_used_frame = p_conv_data->last_received_frame_number;
1767                         }
1768
1769                         /* Show info. */
1770                         add_roundtrip_delay_info(tvb, pinfo, tree, p_conv_data->last_received_frame_number, delay);
1771                 }
1772         }
1773 }
1774
1775 /* Show the calcaulted roundtrip delay info by adding protocol tree items
1776    and appending text to the info column */
1777 static void add_roundtrip_delay_info(tvbuff_t *tvb, packet_info *pinfo,
1778                                      proto_tree *tree, guint frame, guint delay)
1779 {
1780         /* 'Last SR' frame used in calculation.  Show this even if no delay shown */
1781         proto_item* item = proto_tree_add_uint(tree,
1782                                                hf_rtcp_last_sr_timestamp_frame,
1783                                                tvb, 0, 0, frame);
1784         PROTO_ITEM_SET_GENERATED(item);
1785
1786         /* Don't report on calculated delays below the threshold.
1787            Won't report a delay of 0 (which also indicates no valid
1788            calculated value to report) */
1789         if (delay < global_rtcp_show_roundtrip_calculation_minimum)
1790         {
1791                 return;
1792         }
1793
1794         /* Calculated delay in ms */
1795         item = proto_tree_add_uint(tree, hf_rtcp_roundtrip_delay, tvb, 0, 0, delay);
1796         PROTO_ITEM_SET_GENERATED(item);
1797
1798         /* Report delay in INFO column */
1799         if (check_col(pinfo->cinfo, COL_INFO))
1800         {
1801                 if (delay > 0)
1802                 {
1803                         col_append_fstr(pinfo->cinfo, COL_INFO,
1804                                         " (roundtrip delay <-> %s = %ums, using frame %u)",
1805                                         address_to_str(&pinfo->net_src), delay, frame);
1806                 }
1807         }
1808 }
1809
1810
1811
1812 static void
1813 dissect_rtcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
1814 {
1815         proto_item *ti           = NULL;
1816         proto_tree *rtcp_tree    = NULL;
1817         unsigned int temp_byte   = 0;
1818         unsigned int padding_set = 0;
1819         unsigned int elem_count  = 0;
1820         unsigned int packet_type = 0;
1821         unsigned int offset      = 0;
1822         guint16 packet_length    = 0;
1823         guint rtcp_subtype               = 0;
1824         guint32 app_length               = 0;
1825
1826         if ( check_col( pinfo->cinfo, COL_PROTOCOL ) )   {
1827                 col_set_str( pinfo->cinfo, COL_PROTOCOL, "RTCP" );
1828         }
1829
1830         if ( check_col( pinfo->cinfo, COL_INFO) ) {
1831                 /* The second octet contains the packet type */
1832                 /* switch ( pd[ offset + 1 ] ) { */
1833                 switch ( tvb_get_guint8( tvb, 1 ) ) {
1834                         case RTCP_SR:
1835                                 col_set_str( pinfo->cinfo, COL_INFO, "Sender Report");
1836                                 break;
1837                         case RTCP_RR:
1838                                 col_set_str( pinfo->cinfo, COL_INFO, "Receiver Report");
1839                                 break;
1840                         case RTCP_SDES:
1841                                 col_set_str( pinfo->cinfo, COL_INFO, "Source Description");
1842                                 break;
1843                         case RTCP_BYE:
1844                                 col_set_str( pinfo->cinfo, COL_INFO, "Goodbye");
1845                                 break;
1846                         case RTCP_APP:
1847                                 col_set_str( pinfo->cinfo, COL_INFO, "Application defined");
1848                                 break;
1849                         case RTCP_XR:
1850                                 col_set_str( pinfo->cinfo, COL_INFO, "Extended report");
1851                                 break;
1852                         case RTCP_FIR:
1853                                 col_set_str( pinfo->cinfo, COL_INFO, "Full Intra-frame Request (H.261)");
1854                                 break;
1855                         case RTCP_NACK:
1856                                 col_set_str( pinfo->cinfo, COL_INFO, "Negative Acknowledgement (H.261)");
1857                                 break;
1858                         default:
1859                                 col_set_str( pinfo->cinfo, COL_INFO, "Unknown packet type");
1860                                 break;
1861                 }
1862         }
1863
1864     /*
1865      * Check if there are at least 4 bytes left in the frame,
1866      * the last 16 bits of those is the length of the current
1867      * RTCP message. The last compound message contains padding,
1868      * that enables us to break from the while loop.
1869      */
1870     while ( tvb_bytes_exist( tvb, offset, 4) ) {
1871         /*
1872          * First retreive the packet_type
1873          */
1874         packet_type = tvb_get_guint8( tvb, offset + 1 );
1875
1876         /*
1877          * Check if it's a valid type
1878          */
1879         if ( ( packet_type < 192 ) || ( packet_type >  207 ) )
1880             break;
1881
1882         /*
1883          * get the packet-length for the complete RTCP packet
1884          */
1885         packet_length = ( tvb_get_ntohs( tvb, offset + 2 ) + 1 ) * 4;
1886
1887                 ti = proto_tree_add_item(tree, proto_rtcp, tvb, offset, packet_length, FALSE );
1888                 proto_item_append_text(ti, " (%s)",
1889                                        val_to_str(packet_type,
1890                                                   rtcp_packet_type_vals,
1891                                                   "Unknown"));
1892
1893                 rtcp_tree = proto_item_add_subtree( ti, ett_rtcp );
1894
1895                 /* Conversation setup info */
1896                 if (global_rtcp_show_setup_info)
1897                 {
1898                         show_setup_info(tvb, pinfo, rtcp_tree);
1899                 }
1900
1901
1902         temp_byte = tvb_get_guint8( tvb, offset );
1903
1904                 proto_tree_add_uint( rtcp_tree, hf_rtcp_version, tvb,
1905                                                          offset, 1, temp_byte);
1906         padding_set = RTCP_PADDING( temp_byte );
1907
1908                 proto_tree_add_boolean( rtcp_tree, hf_rtcp_padding, tvb,
1909                                                                 offset, 1, temp_byte );
1910         elem_count = RTCP_COUNT( temp_byte );
1911
1912         switch ( packet_type ) {
1913             case RTCP_SR:
1914             case RTCP_RR:
1915                 /* Receiver report count, 5 bits */
1916                 proto_tree_add_uint( rtcp_tree, hf_rtcp_rc, tvb, offset, 1, temp_byte );
1917                 offset++;
1918                 /* Packet type, 8 bits */
1919                 proto_tree_add_item( rtcp_tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
1920                 offset++;
1921                 /* Packet length in 32 bit words MINUS one, 16 bits */
1922                 proto_tree_add_uint( rtcp_tree, hf_rtcp_length, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
1923                 offset += 2;
1924                 /* Sender Synchronization source, 32 bits */
1925                 proto_tree_add_uint( rtcp_tree, hf_rtcp_ssrc_sender, tvb, offset, 4, tvb_get_ntohl( tvb, offset ) );
1926                 offset += 4;
1927
1928                 if ( packet_type == RTCP_SR ) offset = dissect_rtcp_sr( pinfo, tvb, offset, rtcp_tree, elem_count );
1929                 else offset = dissect_rtcp_rr( pinfo, tvb, offset, rtcp_tree, elem_count );
1930                 break;
1931             case RTCP_SDES:
1932                 /* Source count, 5 bits */
1933                 proto_tree_add_uint( rtcp_tree, hf_rtcp_sc, tvb, offset, 1, temp_byte );
1934                 offset++;
1935                 /* Packet type, 8 bits */
1936                 proto_tree_add_item( rtcp_tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
1937                 offset++;
1938                 /* Packet length in 32 bit words MINUS one, 16 bits */
1939                 proto_tree_add_uint( rtcp_tree, hf_rtcp_length, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
1940                 offset += 2;
1941                 dissect_rtcp_sdes( tvb, offset, rtcp_tree, elem_count );
1942                 offset += packet_length - 4;
1943                 break;
1944             case RTCP_BYE:
1945                 /* Source count, 5 bits */
1946                 proto_tree_add_uint( rtcp_tree, hf_rtcp_sc, tvb, offset, 1, temp_byte );
1947                 offset++;
1948                 /* Packet type, 8 bits */
1949                 proto_tree_add_item( rtcp_tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
1950                 offset++;
1951                 /* Packet length in 32 bit words MINUS one, 16 bits */
1952                 proto_tree_add_uint( rtcp_tree, hf_rtcp_length, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
1953                 offset += 2;
1954                 offset = dissect_rtcp_bye( tvb, offset, rtcp_tree, elem_count );
1955                 break;
1956             case RTCP_APP:
1957                 /* Subtype, 5 bits */
1958                 rtcp_subtype = elem_count;
1959                 proto_tree_add_uint( rtcp_tree, hf_rtcp_subtype, tvb, offset, 1, elem_count );
1960                 offset++;
1961                 /* Packet type, 8 bits */
1962                 proto_tree_add_item( rtcp_tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
1963                 offset++;
1964                 /* Packet length in 32 bit words MINUS one, 16 bits */
1965                                 app_length = tvb_get_ntohs( tvb, offset ) <<2;
1966                 proto_tree_add_uint( rtcp_tree, hf_rtcp_length, tvb, offset, 2, app_length );
1967                 offset += 2;
1968                 offset = dissect_rtcp_app( tvb, pinfo, offset,rtcp_tree, padding_set, packet_length - 4, rtcp_subtype, app_length);
1969                 break;
1970             case RTCP_XR:
1971                 /* Reserved, 5 bits, Ignore */
1972                 offset++;
1973                 /* Packet type, 8 bits */
1974                 proto_tree_add_item( rtcp_tree, hf_rtcp_pt, tvb, offset, 1, FALSE );
1975                 offset++;
1976                 /* Packet length in 32 bit words MINUS one, 16 bits */
1977                 proto_tree_add_uint( rtcp_tree, hf_rtcp_length, tvb, offset, 2, tvb_get_ntohs( tvb, offset ) );
1978                 offset += 2;
1979                 offset = dissect_rtcp_xr( tvb, pinfo, offset, rtcp_tree, packet_length - 4 );
1980                 break;
1981             case RTCP_FIR:
1982                 offset = dissect_rtcp_fir( tvb, offset, rtcp_tree );
1983                 break;
1984             case RTCP_NACK:
1985                 offset = dissect_rtcp_nack( tvb, offset, rtcp_tree );
1986                 break;
1987             default:
1988                 /*
1989                  * To prevent endless loops in case of an unknown message type
1990                  * increase offset. Some time the while will end :-)
1991                  */
1992                 offset++;
1993                 break;
1994         }
1995     }
1996     /* If the padding bit is set, the last octet of the
1997      * packet contains the length of the padding
1998      * We only have to check for this at the end of the LAST RTCP message
1999      */
2000     if ( padding_set ) {
2001         /* If everything went according to plan offset should now point to the
2002          * first octet of the padding
2003          */
2004         proto_tree_add_item( rtcp_tree, hf_rtcp_padding_data, tvb, offset, tvb_length_remaining( tvb, offset) - 1, FALSE );
2005         offset += tvb_length_remaining( tvb, offset) - 1;
2006         proto_tree_add_item( rtcp_tree, hf_rtcp_padding_count, tvb, offset, 1, FALSE );
2007     }
2008 }
2009
2010 void
2011 proto_register_rtcp(void)
2012 {
2013         static hf_register_info hf[] =
2014         {
2015                 {
2016                         &hf_rtcp_version,
2017                         {
2018                                 "Version",
2019                                 "rtcp.version",
2020                                 FT_UINT8,
2021                                 BASE_DEC,
2022                                 VALS(rtcp_version_vals),
2023                                 0xC0,
2024                                 "", HFILL
2025                         }
2026                 },
2027                 {
2028                         &hf_rtcp_padding,
2029                         {
2030                                 "Padding",
2031                                 "rtcp.padding",
2032                                 FT_BOOLEAN,
2033                                 8,
2034                                 NULL,
2035                                 0x20,
2036                                 "", HFILL
2037                         }
2038                 },
2039                 {
2040                         &hf_rtcp_rc,
2041                         {
2042                                 "Reception report count",
2043                                 "rtcp.rc",
2044                                 FT_UINT8,
2045                                 BASE_DEC,
2046                                 NULL,
2047                                 0x1F,
2048                                 "", HFILL
2049                         }
2050                 },
2051                 {
2052                         &hf_rtcp_sc,
2053                         {
2054                                 "Source count",
2055                                 "rtcp.sc",
2056                                 FT_UINT8,
2057                                 BASE_DEC,
2058                                 NULL,
2059                                 0x1F,
2060                                 "", HFILL
2061                         }
2062                 },
2063                 {
2064                         &hf_rtcp_pt,
2065                         {
2066                                 "Packet type",
2067                                 "rtcp.pt",
2068                                 FT_UINT8,
2069                                 BASE_DEC,
2070                                 VALS( rtcp_packet_type_vals ),
2071                                 0x0,
2072                                 "", HFILL
2073                         }
2074                 },
2075                 {
2076                         &hf_rtcp_length,
2077                         {
2078                                 "Length",
2079                                 "rtcp.length",
2080                                 FT_UINT16,
2081                                 BASE_DEC,
2082                                 NULL,
2083                                 0x0,
2084                                 "", HFILL
2085                         }
2086                 },
2087                 {
2088                         &hf_rtcp_ssrc_sender,
2089                         {
2090                                 "Sender SSRC",
2091                                 "rtcp.senderssrc",
2092                                 FT_UINT32,
2093                                 BASE_DEC,
2094                                 NULL,
2095                                 0x0,
2096                                 "", HFILL
2097                         }
2098                 },
2099                 {
2100                         &hf_rtcp_ntp_msw,
2101                         {
2102                                 "Timestamp, MSW",
2103                                 "rtcp.timestamp.ntp.msw",
2104                                 FT_UINT32,
2105                                 BASE_DEC_HEX,
2106                                 NULL,
2107                                 0x0,
2108                                 "", HFILL
2109                         }
2110                 },
2111                 {
2112                         &hf_rtcp_ntp_lsw,
2113                         {
2114                                 "Timestamp, LSW",
2115                                 "rtcp.timestamp.ntp.lsw",
2116                                 FT_UINT32,
2117                                 BASE_DEC_HEX,
2118                                 NULL,
2119                                 0x0,
2120                                 "", HFILL
2121                         }
2122                 },
2123                 {
2124                         &hf_rtcp_ntp,
2125                         {
2126                                 "NTP timestamp",
2127                                 "rtcp.timestamp.ntp",
2128                                 FT_STRING,
2129                                 BASE_NONE,
2130                                 NULL,
2131                                 0x0,
2132                                 "", HFILL
2133                         }
2134                 },
2135                 {
2136                         &hf_rtcp_rtp_timestamp,
2137                         {
2138                                 "RTP timestamp",
2139                                 "rtcp.timestamp.rtp",
2140                                 FT_UINT32,
2141                                 BASE_DEC,
2142                                 NULL,
2143                                 0x0,
2144                                 "", HFILL
2145                         }
2146                 },
2147                 {
2148                         &hf_rtcp_sender_pkt_cnt,
2149                         {
2150                                 "Sender's packet count",
2151                                 "rtcp.sender.packetcount",
2152                                 FT_UINT32,
2153                                 BASE_DEC,
2154                                 NULL,
2155                                 0x0,
2156                                 "", HFILL
2157                         }
2158                 },
2159                 {
2160                         &hf_rtcp_sender_oct_cnt,
2161                         {
2162                                 "Sender's octet count",
2163                                 "rtcp.sender.octetcount",
2164                                 FT_UINT32,
2165                                 BASE_DEC,
2166                                 NULL,
2167                                 0x0,
2168                                 "", HFILL
2169                         }
2170                 },
2171                 {
2172                         &hf_rtcp_ssrc_source,
2173                         {
2174                                 "Identifier",
2175                                 "rtcp.ssrc.identifier",
2176                                 FT_UINT32,
2177                                 BASE_DEC,
2178                                 NULL,
2179                                 0x0,
2180                                 "", HFILL
2181                         }
2182                 },
2183                 {
2184                         &hf_rtcp_ssrc_fraction,
2185                         {
2186                                 "Fraction lost",
2187                                 "rtcp.ssrc.fraction",
2188                                 FT_UINT8,
2189                                 BASE_DEC,
2190                                 NULL,
2191                                 0x0,
2192                                 "", HFILL
2193                         }
2194                 },
2195                 {
2196                         &hf_rtcp_ssrc_cum_nr,
2197                         {
2198                                 "Cumulative number of packets lost",
2199                                 "rtcp.ssrc.cum_nr",
2200                                 FT_UINT32,
2201                                 BASE_DEC,
2202                                 NULL,
2203                                 0x0,
2204                                 "", HFILL
2205                         }
2206                 },
2207                 {
2208                         &hf_rtcp_ssrc_ext_high_seq,
2209                         {
2210                                 "Extended highest sequence number received",
2211                                 "rtcp.ssrc.ext_high",
2212                                 FT_UINT32,
2213                                 BASE_DEC,
2214                                 NULL,
2215                                 0x0,
2216                                 "", HFILL
2217                         }
2218                 },
2219                 {
2220                         &hf_rtcp_ssrc_high_seq,
2221                         {
2222                                 "Highest sequence number received",
2223                                 "rtcp.ssrc.high_seq",
2224                                 FT_UINT16,
2225                                 BASE_DEC,
2226                                 NULL,
2227                                 0x0,
2228                                 "", HFILL
2229                         }
2230                 },
2231                 {
2232                         &hf_rtcp_ssrc_high_cycles,
2233                         {
2234                                 "Sequence number cycles count",
2235                                 "rtcp.ssrc.high_cycles",
2236                                 FT_UINT16,
2237                                 BASE_DEC,
2238                                 NULL,
2239                                 0x0,
2240                                 "", HFILL
2241                         }
2242                 },
2243                 {
2244                         &hf_rtcp_ssrc_jitter,
2245                         {
2246                                 "Interarrival jitter",
2247                                 "rtcp.ssrc.jitter",
2248                                 FT_UINT32,
2249                                 BASE_DEC,
2250                                 NULL,
2251                                 0x0,
2252                                 "", HFILL
2253                         }
2254                 },
2255                 {
2256                         &hf_rtcp_ssrc_lsr,
2257                         {
2258                                 "Last SR timestamp",
2259                                 "rtcp.ssrc.lsr",
2260                                 FT_UINT32,
2261                                 BASE_DEC,
2262                                 NULL,
2263                                 0x0,
2264                                 "", HFILL
2265                         }
2266                 },
2267                 {
2268                         &hf_rtcp_ssrc_dlsr,
2269                         {
2270                                 "Delay since last SR timestamp",
2271                                 "rtcp.ssrc.dlsr",
2272                                 FT_UINT32,
2273                                 BASE_DEC,
2274                                 NULL,
2275                                 0x0,
2276                                 "", HFILL
2277                         }
2278                 },
2279                 {
2280                         &hf_rtcp_ssrc_csrc,
2281                         {
2282                                 "SSRC / CSRC identifier",
2283                                 "rtcp.sdes.ssrc_csrc",
2284                                 FT_UINT32,
2285                                 BASE_DEC,
2286                                 NULL,
2287                                 0x0,
2288                                 "", HFILL
2289                         }
2290                 },
2291                 {
2292                         &hf_rtcp_sdes_type,
2293                         {
2294                                 "Type",
2295                                 "rtcp.sdes.type",
2296                                 FT_UINT8,
2297                                 BASE_DEC,
2298                                 VALS( rtcp_sdes_type_vals ),
2299                                 0x0,
2300                                 "", HFILL
2301                         }
2302                 },
2303                 {
2304                         &hf_rtcp_sdes_length,
2305                         {
2306                                 "Length",
2307                                 "rtcp.sdes.length",
2308                                 FT_UINT32,
2309                                 BASE_DEC,
2310                                 NULL,
2311                                 0x0,
2312                                 "", HFILL
2313                         }
2314                 },
2315                 {
2316                         &hf_rtcp_sdes_text,
2317                         {
2318                                 "Text",
2319                                 "rtcp.sdes.text",
2320                                 FT_STRING,
2321                                 BASE_NONE,
2322                                 NULL,
2323                                 0x0,
2324                                 "", HFILL
2325                         }
2326                 },
2327                 {
2328                         &hf_rtcp_sdes_prefix_len,
2329                         {
2330                                 "Prefix length",
2331                                 "rtcp.sdes.prefix.length",
2332                                 FT_UINT8,
2333                                 BASE_DEC,
2334                                 NULL,
2335                                 0x0,
2336                                 "", HFILL
2337                         }
2338                 },
2339                 {
2340                         &hf_rtcp_sdes_prefix_string,
2341                         {
2342                                 "Prefix string",
2343                                 "rtcp.sdes.prefix.string",
2344                                 FT_STRING,
2345                                 BASE_NONE,
2346                                 NULL,
2347                                 0x0,
2348                                 "", HFILL
2349                         }
2350                 },
2351                 {
2352                         &hf_rtcp_subtype,
2353                         {
2354                                 "Subtype",
2355                                 "rtcp.app.subtype",
2356                                 FT_UINT8,
2357                                 BASE_DEC,
2358                                 NULL,
2359                                 0x0,
2360                                 "", HFILL
2361                         }
2362                 },
2363                 {
2364                         &hf_rtcp_name_ascii,
2365                         {
2366                                 "Name (ASCII)",
2367                                 "rtcp.app.name",
2368                                 FT_STRING,
2369                                 BASE_NONE,
2370                                 NULL,
2371                                 0x0,
2372                                 "", HFILL
2373                         }
2374                 },
2375                 {
2376                         &hf_rtcp_app_data,
2377                         {
2378                                 "Application specific data",
2379                                 "rtcp.app.data",
2380                                 FT_BYTES,
2381                                 BASE_NONE,
2382                                 NULL,
2383                                 0x0,
2384                                 "", HFILL
2385                         }
2386                 },
2387                 {
2388                         &hf_rtcp_app_poc1_subtype,
2389                         {
2390                                 "Subtype",
2391                                 "rtcp.app.PoC1.subtype",
2392                                 FT_UINT8,
2393                                 BASE_DEC,
2394                                 VALS(rtcp_app_poc1_floor_cnt_type_vals),
2395                                 0x0,
2396                                 "", HFILL
2397                         }
2398                 },
2399                 {
2400                         &hf_rtcp_app_poc1_sip_uri,
2401                         {
2402                                 "SIP URI",
2403                                 "rtcp.app.poc1.sip.uri",
2404                                 FT_STRING,
2405                                 BASE_NONE,
2406                                 NULL,
2407                                 0x0,
2408                                 "", HFILL
2409                         }
2410                 },
2411                 {
2412                         &hf_rtcp_app_poc1_disp_name,
2413                         {
2414                                 "Display Name",
2415                                 "rtcp.app.poc1.disp.name",
2416                                 FT_STRING,
2417                                 BASE_NONE,
2418                                 NULL,
2419                                 0x0,
2420                                 "", HFILL
2421                         }
2422                 },
2423                 {
2424                         &hf_rtcp_app_poc1_stt,
2425                         {
2426                                 "Stop talking timer",
2427                                 "rtcp.app.poc1.stt",
2428                                 FT_UINT16,
2429                                 BASE_DEC,
2430                                 NULL,
2431                                 0x0,
2432                                 "", HFILL
2433                         }
2434                 },
2435                 {
2436                         &hf_rtcp_app_poc1_partic,
2437                         {
2438                                 "Number of participants",
2439                                 "rtcp.app.poc1.participants",
2440                                 FT_UINT16,
2441                                 BASE_DEC,
2442                                 NULL,
2443                                 0x0,
2444                                 "", HFILL
2445                         }
2446                 },
2447                 {
2448                         &hf_rtcp_app_poc1_ssrc_granted,
2449                         {
2450                                 "SSRC of client granted permission to talk",
2451                                 "rtcp.app.poc1.ssrc.granted",
2452                                 FT_UINT32,
2453                                 BASE_DEC,
2454                                 NULL,
2455                                 0x0,
2456                                 "", HFILL
2457                         }
2458                 },
2459                 {
2460                         &hf_rtcp_app_poc1_last_pkt_seq_no,
2461                         {
2462                                 "Seq. no of last RTP packet",
2463                                 "rtcp.app.poc1.last.pkt.seq.no",
2464                                 FT_UINT16,
2465                                 BASE_DEC,
2466                                 NULL,
2467                                 0x0,
2468                                 "", HFILL
2469                         }
2470                 },
2471                 {
2472                         &hf_rtcp_app_poc1_reason_code1,
2473                         {
2474                                 "Reason code",
2475                                 "rtcp.app.poc1.reason.code",
2476                                 FT_UINT8,
2477                                 BASE_DEC,
2478                                 VALS(rtcp_app_poc1_reason_code1_vals),
2479                                 0x0,
2480                                 "", HFILL
2481                         }
2482                 },
2483                 {
2484                         &hf_rtcp_app_poc1_item_len,
2485                         {
2486                                 "Item length",
2487                                 "rtcp.app.poc1.item.len",
2488                                 FT_UINT8,
2489                                 BASE_DEC,
2490                                 NULL,
2491                                 0x0,
2492                                 "", HFILL
2493                         }
2494                 },
2495                 {
2496                         &hf_rtcp_app_poc1_reason1_phrase,
2497                         {
2498                                 "Reason Phrase",
2499                                 "rtcp.app.poc1.reason.phrase",
2500                                 FT_STRING,
2501                                 BASE_NONE,
2502                                 NULL,
2503                                 0x0,
2504                                 "", HFILL
2505                         }
2506                 },
2507                 {
2508                         &hf_rtcp_app_poc1_reason_code2,
2509                         {
2510                                 "Reason code",
2511                                 "rtcp.app.poc1.reason.code",
2512                                 FT_UINT16,
2513                                 BASE_DEC,
2514                                 VALS(rtcp_app_poc1_reason_code2_vals),
2515                                 0x0,
2516                                 "", HFILL
2517                         }
2518                 },
2519                 {
2520                         &hf_rtcp_app_poc1_additionalinfo,
2521                         {
2522                                 "additional information",
2523                                 "rtcp.app.poc1.add.info",
2524                                 FT_UINT16,
2525                                 BASE_DEC,
2526                                 NULL,
2527                                 0x0,
2528                                 "", HFILL
2529                         }
2530                 },
2531                 {
2532                         &hf_rtcp_app_poc1_ack_subtype,
2533                         {
2534                                 "Subtype",
2535                                 "rtcp.app.poc1.ack.subtype",
2536                                 FT_UINT8,
2537                                 BASE_DEC,
2538                                 VALS(rtcp_app_poc1_floor_cnt_type_vals),
2539                                 0xf8,
2540                                 "", HFILL
2541                         }
2542                 },
2543                 {
2544                         &hf_rtcp_app_poc1_ack_reason_code,
2545                         {
2546                                 "Reason code",
2547                                 "rtcp.app.poc1.ack.reason.code",
2548                                 FT_UINT16,
2549                                 BASE_DEC,
2550                                 VALS(rtcp_app_poc1_reason_code_ack_vals),
2551                                 0x07ff,
2552                                 "", HFILL
2553                         }
2554                 },
2555                 {
2556                         &hf_rtcp_app_poc1_qsresp_priority,
2557                         {
2558                                 "Priority",
2559                                 "rtcp.app.poc1.qsresp.priority",
2560                                 FT_UINT8,
2561                                 BASE_DEC,
2562                                 VALS(rtcp_app_poc1_qsresp_priority_vals),
2563                                 0x0,
2564                                 "", HFILL
2565                         }
2566                 },
2567                 {
2568                         &hf_rtcp_app_poc1_qsresp_position,
2569                         {
2570                                 "Position",
2571                                 "rtcp.app.poc1.qsresp.position",
2572                                 FT_UINT16,
2573                                 BASE_DEC,
2574                                 NULL,
2575                                 0x0,
2576                                 "", HFILL
2577                         }
2578                 },
2579                 {
2580                         &hf_rtcp_app_poc1_conn_content_1st_byte[0],
2581                         {
2582                                 "Identity of inviting client",
2583                                 "rtcp.app.poc1.conn.content.a.id",
2584                                 FT_BOOLEAN,
2585                                 8,
2586                                 NULL,
2587                                 0x80,
2588                                 "", HFILL
2589                         }
2590                 },
2591                 {
2592                         &hf_rtcp_app_poc1_conn_content_1st_byte[1],
2593                         {
2594                                 "Nick name of inviting client",
2595                                 "rtcp.app.poc1.conn.content.a.dn",
2596                                 FT_BOOLEAN,
2597                                 8,
2598                                 NULL,
2599                                 0x40,
2600                                 "", HFILL
2601                         }
2602                 },
2603                 {
2604                         &hf_rtcp_app_poc1_conn_content_1st_byte[2],
2605                         {
2606                                 "Session identity",
2607                                 "rtcp.app.poc1.conn.content.sess.id",
2608                                 FT_BOOLEAN,
2609                                 8,
2610                                 NULL,
2611                                 0x20,
2612                                 "", HFILL
2613                         }
2614                 },
2615                 {
2616                         &hf_rtcp_app_poc1_conn_content_1st_byte[3],
2617                         {
2618                                 "Group name",
2619                                 "rtcp.app.poc1.conn.content.grp.dn",
2620                                 FT_BOOLEAN,
2621                                 8,
2622                                 NULL,
2623                                 0x10,
2624                                 "", HFILL
2625                         }
2626                 },
2627                 {
2628                         &hf_rtcp_app_poc1_conn_content_1st_byte[4],
2629                         {
2630                                 "Group identity",
2631                                 "rtcp.app.poc1.conn.content.grp.id",
2632                                 FT_BOOLEAN,
2633                                 8,
2634                                 NULL,
2635                                 0x08,
2636                                 "", HFILL
2637                         }
2638                 },
2639                 {
2640                         &hf_rtcp_app_poc1_conn_session_type,
2641                         {
2642                                 "Session type",
2643                                 "rtcp.app.poc1.conn.session.type",
2644                                 FT_UINT8,
2645                                 BASE_DEC,
2646                                 VALS(rtcp_app_poc1_conn_sess_type_vals),
2647                                 0x0,
2648                                 "", HFILL
2649                         }
2650                 },
2651                 {
2652                         &hf_rtcp_app_poc1_conn_add_ind_mao,
2653                         {
2654                                 "Manual answer override",
2655                                 "rtcp.app.poc1.conn.add.ind.mao",
2656                                 FT_BOOLEAN,
2657                                 8,
2658                                 NULL,
2659                                 0x80,
2660                                 "", HFILL
2661                         }
2662                 },
2663                 {
2664                         &hf_rtcp_app_poc1_conn_sdes_items[0],
2665                         {
2666                                 "Identity of inviting client",
2667                                 "rtcp.app.poc1.conn.sdes.a.id",
2668                                 FT_UINT_STRING,
2669                                 BASE_NONE,
2670                                 NULL,
2671                                 0x0,
2672                                 "", HFILL
2673                         }
2674                 },
2675                 {
2676                         &hf_rtcp_app_poc1_conn_sdes_items[1],
2677                         {
2678                                 "Nick name of inviting client",
2679                                 "rtcp.app.poc1.conn.sdes.a.dn",
2680                                 FT_UINT_STRING,
2681                                 BASE_NONE,
2682                                 NULL,
2683                                 0x0,
2684                                 "", HFILL
2685                         }
2686                 },
2687                 {
2688                         &hf_rtcp_app_poc1_conn_sdes_items[2],
2689                         {
2690                                 "Session identity",
2691                                 "rtcp.app.poc1.conn.sdes.sess.id",
2692                                 FT_UINT_STRING,
2693                                 BASE_NONE,
2694                                 NULL,
2695                                 0x0,
2696                                 "", HFILL
2697                         }
2698                 },
2699                 {
2700                         &hf_rtcp_app_poc1_conn_sdes_items[3],
2701                         {
2702                                 "Group Name",
2703                                 "rtcp.app.poc1.conn.sdes.grp.dn",
2704                                 FT_UINT_STRING,
2705                                 BASE_NONE,
2706                                 NULL,
2707                                 0x0,
2708                                 "", HFILL
2709                         }
2710                 },
2711                 {
2712                         &hf_rtcp_app_poc1_conn_sdes_items[4],
2713                         {
2714                                 "Group identity",
2715                                 "rtcp.app.poc1.conn.sdes.grp.id",
2716                                 FT_UINT_STRING,
2717                                 BASE_NONE,
2718                                 NULL,
2719                                 0x0,
2720                                 "", HFILL
2721                         }
2722                 },
2723                 {
2724                         &hf_rtcp_fsn,
2725                         {
2726                                 "First sequence number",
2727                                 "rtcp.nack.fsn",
2728                                 FT_UINT16,
2729                                 BASE_DEC,
2730                                 NULL,
2731                                 0x0,
2732                                 "", HFILL
2733                         }
2734                 },
2735                 {
2736                         &hf_rtcp_blp,
2737                         {
2738                                 "Bitmask of following lost packets",
2739                                 "rtcp.nack.blp",
2740                                 FT_UINT16,
2741                                 BASE_DEC,
2742                                 NULL,
2743                                 0x0,
2744                                 "", HFILL
2745                         }
2746                 },
2747                 {
2748                         &hf_rtcp_padding_count,
2749                         {
2750                                 "Padding count",
2751                                 "rtcp.padding.count",
2752                                 FT_UINT8,
2753                                 BASE_DEC,
2754                                 NULL,
2755                                 0x0,
2756                                 "", HFILL
2757                         }
2758                 },
2759                 {
2760                         &hf_rtcp_padding_data,
2761                         {
2762                                 "Padding data",
2763                                 "rtcp.padding.data",
2764                                 FT_BYTES,
2765                                 BASE_NONE,
2766                                 NULL,
2767                                 0x0,
2768                                 "", HFILL
2769                         }
2770                 },
2771                 {
2772                         &hf_rtcp_setup,
2773                         {
2774                                 "Stream setup",
2775                                 "rtcp.setup",
2776                                 FT_STRING,
2777                                 BASE_NONE,
2778                                 NULL,
2779                                 0x0,
2780                                 "Stream setup, method and frame number", HFILL
2781                         }
2782                 },
2783                 {
2784                         &hf_rtcp_setup_frame,
2785                         {
2786                                 "Setup frame",
2787                                 "rtcp.setup-frame",
2788                                 FT_FRAMENUM,
2789                                 BASE_NONE,
2790                                 NULL,
2791                                 0x0,
2792                                 "Frame that set up this stream", HFILL
2793                         }
2794                 },
2795                 {
2796                         &hf_rtcp_setup_method,
2797                         {
2798                                 "Setup Method",
2799                                 "rtcp.setup-method",
2800                                 FT_STRING,
2801                                 BASE_NONE,
2802                                 NULL,
2803                                 0x0,
2804                                 "Method used to set up this stream", HFILL
2805                         }
2806                 },
2807                 {
2808                         &hf_rtcp_last_sr_timestamp_frame,
2809                         {
2810                                 "Frame matching Last SR timestamp",
2811                                 "rtcp.lsr-frame",
2812                                 FT_FRAMENUM,
2813                                 BASE_NONE,
2814                                 NULL,
2815                                 0x0,
2816                                 "Frame matching LSR field (used to calculate roundtrip delay)", HFILL
2817                         }
2818                 },
2819                 {
2820                         &hf_rtcp_roundtrip_delay,
2821                         {
2822                                 "Roundtrip Delay(ms)",
2823                                 "rtcp.roundtrip-delay",
2824                                 FT_UINT32,
2825                                 BASE_DEC,
2826                                 NULL,
2827                                 0x0,
2828                                 "Calculated roundtrip delay in ms", HFILL
2829                         }
2830                 },
2831                 {
2832                         &hf_rtcp_xr_block_type,
2833                         {
2834                                 "Type",
2835                                 "rtcp.xr.bt",
2836                                 FT_UINT8,
2837                                 BASE_DEC,
2838                                 VALS(rtcp_xr_type_vals),
2839                                 0x0,
2840                                 "Block Type", HFILL
2841                         }
2842                 },
2843                 {
2844                         &hf_rtcp_xr_block_specific,
2845                         {
2846                                 "Type Specific",
2847                                 "rtcp.xr.bs",
2848                                 FT_UINT8,
2849                                 BASE_DEC,
2850                                 NULL,
2851                                 0x0,
2852                                 "Reserved", HFILL
2853                         }
2854                 },
2855                 {
2856                         &hf_rtcp_xr_block_length,
2857                         {
2858                                 "Length",
2859                                 "rtcp.xr.bl",
2860                                 FT_UINT16,
2861                                 BASE_DEC,
2862                                 NULL,
2863                                 0x0,
2864                                 "Block Length", HFILL
2865                         }
2866                 },
2867                 {
2868                         &hf_rtcp_ssrc_discarded,
2869                         {
2870                                 "Fraction discarded",
2871                                 "rtcp.ssrc.discarded",
2872                                 FT_UINT8,
2873                                 BASE_DEC,
2874                                 NULL,
2875                                 0x0,
2876                                 "Discard Rate", HFILL
2877                         }
2878                 },
2879                 {
2880                         &hf_rtcp_xr_voip_metrics_burst_density,
2881                         {
2882                                 "Burst Density",
2883                                 "rtcp.xr.voipmetrics.burstdensity",
2884                                 FT_UINT8,
2885                                 BASE_DEC,
2886                                 NULL,
2887                                 0x0,
2888                                 "", HFILL
2889                         }
2890                 },
2891                 {
2892                         &hf_rtcp_xr_voip_metrics_gap_density,
2893                         {
2894                                 "Gap Density",
2895                                 "rtcp.xr.voipmetrics.gapdensity",
2896                                 FT_UINT8,
2897                                 BASE_DEC,
2898                                 NULL,
2899                                 0x0,
2900                                 "", HFILL
2901                         }
2902                 },
2903                 {
2904                         &hf_rtcp_xr_voip_metrics_burst_duration,
2905                         {
2906                                 "Burst Duration(ms)",
2907                                 "rtcp.xr.voipmetrics.burstduration",
2908                                 FT_UINT16,
2909                                 BASE_DEC,
2910                                 NULL,
2911                                 0x0,
2912                                 "", HFILL
2913                         }
2914                 },
2915                 {
2916                         &hf_rtcp_xr_voip_metrics_gap_duration,
2917                         {
2918                                 "Gap Duration(ms)",
2919                                 "rtcp.xr.voipmetrics.gapduration",
2920                                 FT_UINT16,
2921                                 BASE_DEC,
2922                                 NULL,
2923                                 0x0,
2924                                 "", HFILL
2925                         }
2926                 },
2927                 {
2928                         &hf_rtcp_xr_voip_metrics_rtdelay,
2929                         {
2930                                 "Round Trip Delay(ms)",
2931                                 "rtcp.xr.voipmetrics.rtdelay",
2932                                 FT_UINT16,
2933                                 BASE_DEC,
2934                                 NULL,
2935                                 0x0,
2936                                 "", HFILL
2937                         }
2938                 },
2939                 {
2940                         &hf_rtcp_xr_voip_metrics_esdelay,
2941                         {
2942                                 "End System Delay(ms)",
2943                                 "rtcp.xr.voipmetrics.esdelay",
2944                                 FT_UINT16,
2945                                 BASE_DEC,
2946                                 NULL,
2947                                 0x0,
2948                                 "", HFILL
2949                         }
2950                 },
2951                 {
2952                         &hf_rtcp_xr_voip_metrics_siglevel,
2953                         {
2954                                 "Signal Level",
2955                                 "rtcp.xr.voipmetrics.signallevel",
2956                                 FT_INT8,
2957                                 BASE_DEC,
2958                                 NULL,
2959                                 0x0,
2960                                 "Signal level of 127 indicates this parameter is unavailable", HFILL
2961                         }
2962                 },
2963                 {
2964                         &hf_rtcp_xr_voip_metrics_noiselevel,
2965                         {
2966                                 "Noise Level",
2967                                 "rtcp.xr.voipmetrics.noiselevel",
2968                                 FT_INT8,
2969                                 BASE_DEC,
2970                                 NULL,
2971                                 0x0,
2972                                 "Noise level of 127 indicates this parameter is unavailable", HFILL
2973                         }
2974                 },
2975                 {
2976                         &hf_rtcp_xr_voip_metrics_rerl,
2977                         {
2978                                 "Residual Echo Return Loss",
2979                                 "rtcp.xr.voipmetrics.rerl",
2980                                 FT_UINT8,
2981                                 BASE_DEC,
2982                                 NULL,
2983                                 0x0,
2984                                 "", HFILL
2985                         }
2986                 },
2987                 {
2988                         &hf_rtcp_xr_voip_metrics_gmin,
2989                         {
2990                                 "Gmin",
2991                                 "rtcp.xr.voipmetrics.gmin",
2992                                 FT_UINT8,
2993                                 BASE_DEC,
2994                                 NULL,
2995                                 0x0,
2996                                 "", HFILL
2997                         }
2998                 },
2999                 {
3000                         &hf_rtcp_xr_voip_metrics_rfactor,
3001                         {
3002                                 "R Factor",
3003                                 "rtcp.xr.voipmetrics.rfactor",
3004                                 FT_UINT8,
3005                                 BASE_DEC,
3006                                 NULL,
3007                                 0x0,
3008                                 "R Factor is in the range of 0 to 100; 127 indicates this parameter is unavailable", HFILL
3009                         }
3010                 },
3011                 {
3012                         &hf_rtcp_xr_voip_metrics_extrfactor,
3013                         {
3014                                 "External R Factor",
3015                                 "rtcp.xr.voipmetrics.extrfactor",
3016                                 FT_UINT8,
3017                                 BASE_DEC,
3018                                 NULL,
3019                                 0x0,
3020                                 "R Factor is in the range of 0 to 100; 127 indicates this parameter is unavailable", HFILL
3021                         }
3022                 },
3023                 {
3024                         &hf_rtcp_xr_voip_metrics_moslq,
3025                         {
3026                                 "MOS - Listening Quality",
3027                                 "rtcp.xr.voipmetrics.moslq",
3028                                 FT_FLOAT,
3029                                 BASE_DEC,
3030                                 NULL,
3031                                 0x0,
3032                                 "MOS is in the range of 1 to 5; 127 indicates this parameter is unavailable", HFILL
3033                         }
3034                 },
3035                 {
3036                         &hf_rtcp_xr_voip_metrics_moscq,
3037                         {
3038                                 "MOS - Conversational Quality",
3039                                 "rtcp.xr.voipmetrics.moscq",
3040                                 FT_FLOAT,
3041                                 BASE_DEC,
3042                                 NULL,
3043                                 0x0,
3044                                 "MOS is in the range of 1 to 5; 127 indicates this parameter is unavailable", HFILL
3045                         }
3046                 },
3047                 {
3048                         &hf_rtcp_xr_voip_metrics_plc,
3049                         {
3050                                 "Packet Loss Conealment Algorithm",
3051                                 "rtcp.xr.voipmetrics.plc",
3052                                 FT_UINT8,
3053                                 BASE_DEC,
3054                                 VALS(rtcp_xr_plc_algo_vals),
3055                                 0xC0,
3056                                 "", HFILL
3057                         }
3058                 },
3059                 {
3060                         &hf_rtcp_xr_voip_metrics_jbadaptive,
3061                         {
3062                                 "Adaptive Jitter Buffer Algorithm",
3063                                 "rtcp.xr.voipmetrics.jba",
3064                                 FT_UINT8,
3065                                 BASE_DEC,
3066                                 VALS(rtcp_xr_jb_adaptive_vals),
3067                                 0x30,
3068                                 "", HFILL
3069                         }
3070                 },
3071                 {
3072                         &hf_rtcp_xr_voip_metrics_jbrate,
3073                         {
3074                                 "Jitter Buffer Rate",
3075                                 "rtcp.xr.voipmetrics.jbrate",
3076                                 FT_UINT8,
3077                                 BASE_DEC,
3078                                 NULL,
3079                                 0x0F,
3080                                 "", HFILL
3081                         }
3082                 },
3083                 {
3084                         &hf_rtcp_xr_voip_metrics_jbnominal,
3085                         {
3086                                 "Nominal Jitter Buffer Size",
3087                                 "rtcp.xr.voipmetrics.jbnominal",
3088                                 FT_UINT16,
3089                                 BASE_DEC,
3090                                 NULL,
3091                                 0x0,
3092                                 "", HFILL
3093                         }
3094                 },
3095                 {
3096                         &hf_rtcp_xr_voip_metrics_jbmax,
3097                         {
3098                                 "Maximum Jitter Buffer Size",
3099                                 "rtcp.xr.voipmetrics.jbmax",
3100                                 FT_UINT16,
3101                                 BASE_DEC,
3102                                 NULL,
3103                                 0x0,
3104                                 "", HFILL
3105                         }
3106                 },
3107                 {
3108                         &hf_rtcp_xr_voip_metrics_jbabsmax,
3109                         {
3110                                 "Absolute Maximum Jitter Buffer Size",
3111                                 "rtcp.xr.voipmetrics.jbabsmax",
3112                                 FT_UINT16,
3113                                 BASE_DEC,
3114                                 NULL,
3115                                 0x0,
3116                                 "", HFILL
3117                         }
3118                 },
3119                 {
3120                         &hf_rtcp_xr_thinning,
3121                         {
3122                                 "Thinning factor",
3123                                 "rtcp.xr.tf",
3124