From Alejandro Vaquero:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 23 Feb 2006 20:02:23 +0000 (20:02 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 23 Feb 2006 20:02:23 +0000 (20:02 +0000)
a patch for the VoipCalls to fix a couple of issues:
- a problem with the RTP Events (RFC2833) not been handle correctly
- Display the RTP stream in time order when the setup frame is after the
RTP stream.
- fix a init issue that caused the H245 packet to not been displayed
correctly.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17383 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-rtp-events.c
epan/dissectors/packet-rtp-events.h
gtk/graph_analysis.c
gtk/voip_calls.c

index 1da08ccffa9321dd04fbc2f940f0147d7a0a263d..eb198fa4bccbf5d9ed40fb80b25c8562c3033d0c 100644 (file)
@@ -115,27 +115,33 @@ dissect_rtp_events( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
                    val_to_str( rtp_evt, rtp_event_type_values, "Unknown (%u)" ));
          }
 
-       if ( tree )
-         {
-           ti = proto_tree_add_item( tree, proto_rtp_events, tvb, offset, -1, FALSE );
-           rtp_events_tree = proto_item_add_subtree( ti, ett_rtp_events );
+    ti = proto_tree_add_item( tree, proto_rtp_events, tvb, offset, -1, FALSE );
+    rtp_events_tree = proto_item_add_subtree( ti, ett_rtp_events );
+
+    proto_tree_add_uint ( rtp_events_tree, hf_rtp_events_event, tvb, offset, 1, rtp_evt);
 
-           proto_tree_add_uint ( rtp_events_tree, hf_rtp_events_event, tvb, offset, 1, rtp_evt);
+    octet = tvb_get_guint8(tvb, offset +1 );
+    proto_tree_add_boolean (rtp_events_tree, hf_rtp_events_end, tvb, offset+1, 1, octet);
+    proto_tree_add_boolean (rtp_events_tree, hf_rtp_events_reserved, tvb, offset+1, 1, octet);
+    proto_tree_add_uint ( rtp_events_tree, hf_rtp_events_volume, tvb, offset+1, 1, octet);
 
-           octet = tvb_get_guint8(tvb, offset +1 );
-           proto_tree_add_boolean (rtp_events_tree, hf_rtp_events_end, tvb, offset+1, 1, octet);
-           proto_tree_add_boolean (rtp_events_tree, hf_rtp_events_reserved, tvb, offset+1, 1, octet);
-           proto_tree_add_uint ( rtp_events_tree, hf_rtp_events_volume, tvb, offset+1, 1, octet);
+    proto_tree_add_item ( rtp_events_tree, hf_rtp_events_duration, tvb, offset+2, 2, FALSE);
 
-           proto_tree_add_item ( rtp_events_tree, hf_rtp_events_duration, tvb, offset+2, 2, FALSE);
+       /* set the end info for the tap */
+       if (octet & 0x80)
+       {
+               rtp_event_info.info_end = TRUE;
+       } else
+       {
+               rtp_event_info.info_end = FALSE;
+       }
 
-           /* Make end-of-event packets obvious in the info column */
-           if ((octet & 0x80) && check_col(pinfo->cinfo, COL_INFO))
-           {
-                   col_append_str(pinfo->cinfo, COL_INFO, " (end)");
-           }
+    /* Make end-of-event packets obvious in the info column */
+    if ((octet & 0x80) && check_col(pinfo->cinfo, COL_INFO))
+    {
+           col_append_str(pinfo->cinfo, COL_INFO, " (end)");
+    }
 
-         }
        tap_queue_packet(rtp_event_tap, pinfo, &rtp_event_info);
 }
 
index 5b5c89c59e15aff4a75d4e0d3565cf758126be2e..ea8c6d4fb4506ee492a2af561db5972a90889d8e 100644 (file)
@@ -255,5 +255,6 @@ static const value_string rtp_event_type_values[] =
 struct _rtp_event_info {
        guint8      info_rtp_evt;
        guint32         info_setup_frame_num; /* the frame num of the packet that set this RTP connection */
+       gboolean        info_end;
 };
 
index 80fbc6fb8e9930340d0d989f65df99eb74d80162..ff4716a56ff0b8b0f071b5fb1101560ca5103d7c 100644 (file)
@@ -975,8 +975,6 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
 #else
                pango_layout_set_text(big_layout, label_string, -1);
                pango_layout_get_pixel_size(big_layout, &label_width, &label_height);
-        
-        label_width = label_height = 0;
 #endif
                if (start_arrow<end_arrow){
                        arrow_width = end_arrow-start_arrow;
index 8eaf8cd99247634285100a7f5ba0c18ff7ff740c..73aa105fc0cf03f04d9d641f575fb8e5a78c1ac5 100644 (file)
@@ -376,36 +376,26 @@ void insert_to_graph(voip_calls_tapinfo_t *tapinfo _U_, packet_info *pinfo, cons
 /* ***************************TAP for RTP Events*****************************/
 /****************************************************************************/
 
+static guint32 rtp_evt_frame_num = 0;
+static guint8 rtp_evt = 0;
+static gboolean rtp_evt_end = FALSE;
+/*static guint32 rtp_evt_setup_frame_num = 0;*/
+
 /****************************************************************************/
 /* whenever a rtp event packet is seen by the tap listener */
 static int 
 rtp_event_packet(void *ptr _U_, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *rtp_event_info)
 {
        const struct _rtp_event_info *pi = rtp_event_info;
-       voip_rtp_tapinfo_t *tapinfo = &the_tapinfo_rtp_struct;
-       voip_rtp_stream_info_t *tmp_listinfo;
-       voip_rtp_stream_info_t *strinfo = NULL;
-       GList* list;
 
        /* do not consider RTP events packets without a setup frame */
        if (pi->info_setup_frame_num == 0){
                return 0;
        }
 
-       /* check wether we already have a RTP stream with this setup frame in the list */
-       list = g_list_first(tapinfo->list);
-       while (list)
-       {
-               tmp_listinfo=list->data;
-               if ( (tmp_listinfo->setup_frame_number == pi->info_setup_frame_num) 
-                       && (tmp_listinfo->end_stream == FALSE) && (tmp_listinfo->rtp_event == -1)){
-                               strinfo = (voip_rtp_stream_info_t*)(list->data);
-                               strinfo->rtp_event = pi->info_rtp_evt;
-                               break;
-               }
-               list = g_list_next (list);
-       }
-
+       rtp_evt_frame_num = pinfo->fd->num;
+       rtp_evt = pi->info_rtp_evt;
+       rtp_evt_end = pi->info_end;
 
        return 0;
 }
@@ -500,9 +490,9 @@ RTP_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
                        && (tmp_listinfo->ssrc == pi->info_sync_src) && (tmp_listinfo->end_stream == FALSE)){
                        /* if the payload type has changed, we mark the stream as finished to create a new one
                           this is to show multiple payload changes in the Graph for example for DTMF RFC2833 */           
-                       if ( tmp_listinfo->pt != pi->info_payload_type ) 
+                       if ( tmp_listinfo->pt != pi->info_payload_type ) {
                                tmp_listinfo->end_stream = TRUE;
-                       else {
+                       else {
                                strinfo = (voip_rtp_stream_info_t*)(list->data);
                                break;
                        }
@@ -510,6 +500,11 @@ RTP_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
                list = g_list_next (list);
        }
 
+       /* if this is a duplicated RTP Event End, just return */
+       if ((rtp_evt_frame_num == pinfo->fd->num) && !strinfo && (rtp_evt_end == TRUE)) {
+               return 0;
+       }
+
        /* not in the list? then create a new entry */
        if (strinfo==NULL){
                strinfo = g_malloc(sizeof(voip_rtp_stream_info_t));
@@ -543,6 +538,14 @@ RTP_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
                strinfo->npackets++;
                strinfo->stop_rel_sec = pinfo->fd->rel_ts.secs;
                strinfo->stop_rel_usec = pinfo->fd->rel_ts.nsecs/1000;
+
+               /* process RTP Event */
+               if (rtp_evt_frame_num == pinfo->fd->num) {
+                       strinfo->rtp_event = rtp_evt;
+                       if (rtp_evt_end == TRUE) {
+                               strinfo->end_stream = TRUE;
+                       }
+               }
        }
 
        the_tapinfo_struct.redraw = TRUE;
@@ -572,13 +575,15 @@ static void RTP_packet_draw(void *prs _U_)
 
                /* using the setup frame number of the RTP stream, we get the call number that it belongs */
                voip_calls_graph_list = g_list_first(the_tapinfo_struct.graph_analysis->list);
-               item = 0;
                while (voip_calls_graph_list)
                {                       
                        gai = voip_calls_graph_list->data;
                        conv_num = gai->conv_num;
                        /* if we get the setup frame number, then get the time position to graph the RTP arrow */
                        if (rtp_listinfo->setup_frame_number == gai->frame_num){
+                               /* look again from the begining because there are cases where the Setup frame is after the RTP */
+                               voip_calls_graph_list = g_list_first(the_tapinfo_struct.graph_analysis->list);
+                               item = 0;
                                while(voip_calls_graph_list){
                                        gai = voip_calls_graph_list->data;
                                        /* if RTP was already in the Graph, just update the comment information */
@@ -613,7 +618,6 @@ static void RTP_packet_draw(void *prs _U_)
                                break;
                        }
                        voip_calls_graph_list = g_list_next(voip_calls_graph_list);
-                       item++;
                }
                rtp_streams_list = g_list_next(rtp_streams_list);
        }