2 * RTP streams summary addition for ethereal
6 * Copyright 2003, Alcatel Business Systems
7 * By Lars Ruoff <lars.ruoff@gmx.net>
9 * Ethereal - Network traffic analyzer
10 * By Gerald Combs <gerald@ethereal.com>
11 * Copyright 1998 Gerald Combs
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 #include "rtp_stream_dlg.h"
33 #include "rtp_stream.h"
34 #include "rtp_analysis.h"
37 #include "epan/filesystem.h"
40 #include "dlg_utils.h"
42 #include "compat_macros.h"
43 #include "gtkglobals.h"
45 #include "image/clist_ascend.xpm"
46 #include "image/clist_descend.xpm"
50 #include <epan/address.h>
55 static const gchar FWD_LABEL_TEXT[] = "Select a forward stream with left mouse button";
56 static const gchar REV_LABEL_TEXT[] = "Select a reverse stream with SHIFT + left mouse button";
58 /****************************************************************************/
59 /* pointer to the one and only dialog window */
60 static GtkWidget *rtp_stream_dlg = NULL;
62 /* save as dialog box */
63 static GtkWidget *rtpstream_save_dlg = NULL;
64 static GtkWidget *clist = NULL;
65 static GtkWidget *top_label = NULL;
66 static GtkWidget *label_fwd = NULL;
67 static GtkWidget *label_rev = NULL;
69 static rtp_stream_info_t* selected_stream_fwd = NULL; /* current selection */
70 static rtp_stream_info_t* selected_stream_rev = NULL; /* current selection for reversed */
71 static GList *last_list = NULL;
73 static guint32 streams_nb = 0; /* number of displayed streams */
75 /****************************************************************************/
76 /* append a line to clist */
77 static void add_to_clist(rtp_stream_info_t* strinfo)
79 gchar label_text[256];
93 g_snprintf(field[0], 20, "%s", address_to_str_w_none(&(strinfo->src_addr)));
94 g_snprintf(field[1], 20, "%u", strinfo->src_port);
95 g_snprintf(field[2], 20, "%s", address_to_str_w_none(&(strinfo->dest_addr)));
96 g_snprintf(field[3], 20, "%u", strinfo->dest_port);
97 g_snprintf(field[4], 20, "%u", strinfo->ssrc);
98 g_snprintf(field[5], 30, "%s", val_to_str(strinfo->pt, rtp_payload_type_vals,
100 g_snprintf(field[6], 20, "%u", strinfo->npackets);
101 /* XXX: Comment field is not used for the moment */
102 /* g_snprintf(field[7], 20, "%s", "");*/
104 added_row = gtk_clist_append(GTK_CLIST(clist), data);
106 /* set data pointer of last row to point to user data for that row */
107 gtk_clist_set_row_data(GTK_CLIST(clist), added_row, strinfo);
109 /* Update the top label with the number of detected streams */
111 "Detected %d RTP streams. Choose one for forward and reverse direction for analysis",
113 gtk_label_set(GTK_LABEL(top_label), label_text);
116 /****************************************************************************/
117 static void save_stream_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
119 /* Note that we no longer have a Save voice info dialog box. */
120 rtpstream_save_dlg = NULL;
123 /****************************************************************************/
125 static void save_stream_ok_cb(GtkWidget *ok_bt _U_, gpointer user_data _U_)
129 if (!selected_stream_fwd)
132 g_dest = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION (rtpstream_save_dlg)));
134 /* Perhaps the user specified a directory instead of a file.
135 Check whether they did. */
136 if (test_for_directory(g_dest) == EISDIR) {
137 /* It's a directory - set the file selection box to display it. */
138 set_last_open_dir(g_dest);
140 file_selection_set_current_folder(rtpstream_save_dlg, get_last_open_dir());
145 * Don't dismiss the dialog box if the save operation fails.
147 if (!rtpstream_save(selected_stream_fwd, g_dest))
150 window_destroy(GTK_WIDGET(rtpstream_save_dlg));
154 /****************************************************************************/
156 /****************************************************************************/
158 rtpstream_on_destroy (GtkObject *object _U_,
159 gpointer user_data _U_)
161 /* Remove the stream tap listener */
162 remove_tap_listener_rtp_stream();
164 /* Is there a save voice window open? */
165 if (rtpstream_save_dlg != NULL)
166 window_destroy(rtpstream_save_dlg);
168 /* Clean up memory used by stream tap */
169 rtpstream_reset((rtpstream_tapinfo_t*) rtpstream_get_info());
171 /* Note that we no longer have a "RTP Streams" dialog box. */
172 rtp_stream_dlg = NULL;
176 /****************************************************************************/
178 rtpstream_on_unselect (GtkButton *button _U_,
179 gpointer user_data _U_)
181 selected_stream_fwd = NULL;
182 selected_stream_rev = NULL;
183 gtk_clist_unselect_all(GTK_CLIST(clist));
184 gtk_label_set_text(GTK_LABEL(label_fwd), FWD_LABEL_TEXT);
185 gtk_label_set_text(GTK_LABEL(label_rev), REV_LABEL_TEXT);
189 /****************************************************************************/
190 gint rtp_stream_info_cmp_reverse(gconstpointer aa, gconstpointer bb)
192 const struct _rtp_stream_info* a = aa;
193 const struct _rtp_stream_info* b = bb;
195 if (a==NULL || b==NULL)
197 if ((ADDRESSES_EQUAL(&(a->src_addr), &(b->dest_addr)))
198 && (a->src_port == b->dest_port)
199 && (ADDRESSES_EQUAL(&(a->dest_addr), &(b->src_addr)))
200 && (a->dest_port == b->src_port))
206 /****************************************************************************/
208 rtpstream_on_findrev (GtkButton *button _U_,
209 gpointer user_data _U_)
213 rtp_stream_info_t* pstream = NULL;
215 if (selected_stream_fwd==NULL)
217 if (selected_stream_rev==NULL) {
218 pstream = selected_stream_fwd;
221 pstream = selected_stream_rev;
224 start_row = gtk_clist_find_row_from_data(GTK_CLIST(clist), pstream);
227 for (row=start_row+1;
228 (pstream = gtk_clist_get_row_data(GTK_CLIST(clist), row));
230 if (rtp_stream_info_cmp_reverse(selected_stream_fwd, pstream) == 0) {
231 gtk_clist_select_row(GTK_CLIST(clist), row, 0);
232 gtk_clist_moveto(GTK_CLIST(clist), row, 0, 0.5, 0);
239 (pstream = gtk_clist_get_row_data(GTK_CLIST(clist), row)) && row<start_row;
241 if (rtp_stream_info_cmp_reverse(selected_stream_fwd, pstream) == 0) {
242 gtk_clist_select_row(GTK_CLIST(clist), row, 0);
243 gtk_clist_moveto(GTK_CLIST(clist), row, 0, 0.5, 0);
248 /* if we didnt find another stream, highlight the current reverse stream */
249 if (selected_stream_rev!=NULL) {
250 gtk_clist_select_row(GTK_CLIST(clist), row, 0);
251 gtk_clist_moveto(GTK_CLIST(clist), row, 0, 0.5, 0);
256 /****************************************************************************/
259 rtpstream_on_goto (GtkButton *button _U_,
260 gpointer user_data _U_)
262 if (selected_stream_fwd)
264 cf_goto_frame(&cfile, selected_stream_fwd->first_frame_num);
270 /****************************************************************************/
272 rtpstream_on_save (GtkButton *button _U_,
275 rtpstream_tapinfo_t* tapinfo = data;
280 if (!selected_stream_fwd)
283 if (rtpstream_save_dlg != NULL) {
284 /* There's already a Save dialog box; reactivate it. */
285 reactivate_window(rtpstream_save_dlg);
289 /* XXX - use file_selection from dlg_utils instead! */
290 rtpstream_save_dlg = gtk_file_selection_new("Ethereal: Save selected stream in rtpdump ('-F dump') format");
292 /* Container for each row of widgets */
293 vertb = gtk_vbox_new(FALSE, 0);
294 gtk_container_border_width(GTK_CONTAINER(vertb), 5);
295 gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(rtpstream_save_dlg)->action_area),
296 vertb, FALSE, FALSE, 0);
297 gtk_widget_show (vertb);
299 ok_bt = GTK_FILE_SELECTION(rtpstream_save_dlg)->ok_button;
300 SIGNAL_CONNECT(ok_bt, "clicked", save_stream_ok_cb, tapinfo);
302 window_set_cancel_button(rtpstream_save_dlg,
303 GTK_FILE_SELECTION(rtpstream_save_dlg)->cancel_button, window_cancel_button_cb);
305 SIGNAL_CONNECT(rtpstream_save_dlg, "delete_event", window_delete_event_cb, NULL);
306 SIGNAL_CONNECT(rtpstream_save_dlg, "destroy", save_stream_destroy_cb,
309 gtk_widget_show(rtpstream_save_dlg);
310 window_present(rtpstream_save_dlg);
314 /****************************************************************************/
316 rtpstream_on_mark (GtkButton *button _U_,
317 gpointer user_data _U_)
319 if (selected_stream_fwd==NULL && selected_stream_rev==NULL)
321 rtpstream_mark(selected_stream_fwd, selected_stream_rev);
325 /****************************************************************************/
327 rtpstream_on_filter (GtkButton *button _U_,
328 gpointer user_data _U_)
330 gchar *filter_string = NULL;
331 gchar *filter_string_fwd = NULL;
332 gchar *filter_string_rev = NULL;
335 if (selected_stream_fwd==NULL && selected_stream_rev==NULL)
338 if (selected_stream_fwd)
340 if (selected_stream_fwd->src_addr.type==AT_IPv6){
341 strcpy(ip_version,"v6");
344 strcpy(ip_version,"");
346 filter_string_fwd = g_strdup_printf(
347 "(ip%s.src==%s && udp.srcport==%u && ip%s.dst==%s && udp.dstport==%u && rtp.ssrc==%u)",
349 address_to_str_w_none(&(selected_stream_fwd->src_addr)),
350 selected_stream_fwd->src_port,
352 address_to_str_w_none(&(selected_stream_fwd->dest_addr)),
353 selected_stream_fwd->dest_port,
354 selected_stream_fwd->ssrc);
355 filter_string = filter_string_fwd;
358 if (selected_stream_rev)
360 if (selected_stream_fwd->src_addr.type==AT_IPv6){
361 strcpy(ip_version,"v6");
364 strcpy(ip_version,"");
366 filter_string_rev = g_strdup_printf(
367 "(ip%s.src==%s && udp.srcport==%u && ip%s.dst==%s && udp.dstport==%u && rtp.ssrc==%u)",
369 address_to_str_w_none(&(selected_stream_rev->src_addr)),
370 selected_stream_rev->src_port,
372 address_to_str_w_none(&(selected_stream_rev->dest_addr)),
373 selected_stream_rev->dest_port,
374 selected_stream_rev->ssrc);
376 filter_string = filter_string_rev;
378 if (selected_stream_fwd)
380 filter_string = g_strdup_printf("%s || %s", filter_string, filter_string_rev);
381 g_free(filter_string_fwd);
382 g_free(filter_string_rev);
386 gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), filter_string);
387 g_free(filter_string);
390 main_filter_packets(&cfile, filter_string, FALSE);
391 rtpstream_dlg_update(rtpstream_get_info()->strinfo_list);
396 /****************************************************************************/
398 rtpstream_on_analyse (GtkButton *button _U_,
399 gpointer user_data _U_)
402 guint16 port_src_fwd = 0;
404 guint16 port_dst_fwd = 0;
405 guint32 ssrc_fwd = 0;
407 guint16 port_src_rev = 0;
409 guint16 port_dst_rev = 0;
410 guint32 ssrc_rev = 0;
412 SET_ADDRESS(&ip_src_fwd,AT_NONE,0,NULL);
413 SET_ADDRESS(&ip_dst_fwd,AT_NONE,0,NULL);
414 SET_ADDRESS(&ip_src_rev,AT_NONE,0,NULL);
415 SET_ADDRESS(&ip_dst_rev,AT_NONE,0,NULL);
417 if (selected_stream_fwd) {
418 COPY_ADDRESS(&(ip_src_fwd), &(selected_stream_fwd->src_addr));
419 port_src_fwd = selected_stream_fwd->src_port;
420 COPY_ADDRESS(&(ip_dst_fwd), &(selected_stream_fwd->dest_addr));
421 port_dst_fwd = selected_stream_fwd->dest_port;
422 ssrc_fwd = selected_stream_fwd->ssrc;
425 if (selected_stream_rev) {
426 COPY_ADDRESS(&(ip_src_rev), &(selected_stream_rev->src_addr));
427 port_src_rev = selected_stream_rev->src_port;
428 COPY_ADDRESS(&(ip_dst_rev), &(selected_stream_rev->dest_addr));
429 port_dst_rev = selected_stream_rev->dest_port;
430 ssrc_rev = selected_stream_rev->ssrc;
449 /****************************************************************************/
450 /* when the user selects a row in the stream list */
452 rtpstream_on_select_row(GtkCList *clist,
455 GdkEventButton *event _U_,
456 gpointer user_data _U_)
458 gchar label_text[80];
460 /* update the labels */
461 if (event==NULL || event->state & GDK_SHIFT_MASK) {
462 selected_stream_rev = gtk_clist_get_row_data(GTK_CLIST(clist), row);
463 g_snprintf(label_text, 80, "Reverse: %s:%u -> %s:%u, SSRC=%u",
464 address_to_str_w_none(&(selected_stream_rev->src_addr)),
465 selected_stream_rev->src_port,
466 address_to_str_w_none(&(selected_stream_rev->dest_addr)),
467 selected_stream_rev->dest_port,
468 selected_stream_rev->ssrc
470 gtk_label_set_text(GTK_LABEL(label_rev), label_text);
473 selected_stream_fwd = gtk_clist_get_row_data(GTK_CLIST(clist), row);
474 g_snprintf(label_text, 80, "Forward: %s:%u -> %s:%u, SSRC=%u",
475 address_to_str_w_none(&(selected_stream_fwd->src_addr)),
476 selected_stream_fwd->src_port,
477 address_to_str_w_none(&(selected_stream_fwd->dest_addr)),
478 selected_stream_fwd->dest_port,
479 selected_stream_fwd->ssrc
481 gtk_label_set_text(GTK_LABEL(label_fwd), label_text);
485 gtk_widget_set_sensitive(save_bt, TRUE);
486 gtk_widget_set_sensitive(filter_bt, TRUE);
487 gtk_widget_set_sensitive(mark_bt, TRUE);
489 /* TODO: activate other buttons when implemented */
493 /****************************************************************************/
496 typedef struct column_arrows {
498 GtkWidget *ascend_pm;
499 GtkWidget *descend_pm;
503 /****************************************************************************/
505 rtpstream_click_column_cb(GtkCList *clist, gint column, gpointer data)
507 column_arrows *col_arrows = (column_arrows *) data;
510 gtk_clist_freeze(clist);
512 for (i=0; i<NUM_COLS; i++) {
513 gtk_widget_hide(col_arrows[i].ascend_pm);
514 gtk_widget_hide(col_arrows[i].descend_pm);
517 if (column == clist->sort_column) {
518 if (clist->sort_type == GTK_SORT_ASCENDING) {
519 clist->sort_type = GTK_SORT_DESCENDING;
520 gtk_widget_show(col_arrows[column].descend_pm);
522 clist->sort_type = GTK_SORT_ASCENDING;
523 gtk_widget_show(col_arrows[column].ascend_pm);
526 clist->sort_type = GTK_SORT_ASCENDING;
527 gtk_widget_show(col_arrows[column].ascend_pm);
528 gtk_clist_set_sort_column(clist, column);
530 gtk_clist_thaw(clist);
532 gtk_clist_sort(clist);
536 /****************************************************************************/
538 rtpstream_sort_column(GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
544 const GtkCListRow *row1 = (const GtkCListRow *) ptr1;
545 const GtkCListRow *row2 = (const GtkCListRow *) ptr2;
547 text1 = GTK_CELL_TEXT (row1->cell[clist->sort_column])->text;
548 text2 = GTK_CELL_TEXT (row2->cell[clist->sort_column])->text;
550 switch(clist->sort_column){
555 return strcmp (text1, text2);
564 g_assert_not_reached();
569 /****************************************************************************/
571 /****************************************************************************/
573 static void rtpstream_dlg_create (void)
575 GtkWidget *rtpstream_dlg_w;
577 GtkWidget *scrolledwindow;
578 GtkWidget *hbuttonbox;
579 /* GtkWidget *bt_goto;*/
580 GtkWidget *bt_unselect;
581 GtkWidget *bt_findrev;
584 GtkWidget *bt_filter;
585 GtkWidget *bt_analyze;
587 GtkTooltips *tooltips = gtk_tooltips_new();
589 gchar *titles[8] = {"Src IP addr", "Src port", "Dest IP addr", "Dest port", "SSRC", "Payload", "Packets", "Comment"};
590 column_arrows *col_arrows;
591 GtkWidget *column_lb;
594 rtpstream_dlg_w = dlg_window_new("Ethereal: RTP Streams");
595 gtk_window_set_default_size(GTK_WINDOW(rtpstream_dlg_w), 620, 200);
597 main_vb = gtk_vbox_new (FALSE, 0);
598 gtk_container_add(GTK_CONTAINER(rtpstream_dlg_w), main_vb);
599 gtk_container_set_border_width (GTK_CONTAINER (main_vb), 12);
601 top_label = gtk_label_new ("Detected 0 RTP streams. Choose one for forward and reverse direction for analysis");
602 gtk_box_pack_start (GTK_BOX (main_vb), top_label, FALSE, FALSE, 8);
604 scrolledwindow = scrolled_window_new (NULL, NULL);
605 gtk_box_pack_start (GTK_BOX (main_vb), scrolledwindow, TRUE, TRUE, 0);
607 clist = gtk_clist_new (NUM_COLS);
608 gtk_container_add (GTK_CONTAINER (scrolledwindow), clist);
610 gtk_clist_set_column_width (GTK_CLIST (clist), 0, 100);
611 gtk_clist_set_column_width (GTK_CLIST (clist), 1, 50);
612 gtk_clist_set_column_width (GTK_CLIST (clist), 2, 100);
613 gtk_clist_set_column_width (GTK_CLIST (clist), 3, 50);
614 gtk_clist_set_column_width (GTK_CLIST (clist), 4, 80);
615 gtk_clist_set_column_width (GTK_CLIST (clist), 5, 118);
616 gtk_clist_set_column_width (GTK_CLIST (clist), 6, 40);
617 /* gtk_clist_set_column_width (GTK_CLIST (clist), 7, 51);*/
619 gtk_clist_set_column_justification(GTK_CLIST(clist), 0, GTK_JUSTIFY_CENTER);
620 gtk_clist_set_column_justification(GTK_CLIST(clist), 1, GTK_JUSTIFY_CENTER);
621 gtk_clist_set_column_justification(GTK_CLIST(clist), 2, GTK_JUSTIFY_CENTER);
622 gtk_clist_set_column_justification(GTK_CLIST(clist), 3, GTK_JUSTIFY_CENTER);
623 gtk_clist_set_column_justification(GTK_CLIST(clist), 4, GTK_JUSTIFY_CENTER);
624 gtk_clist_set_column_justification(GTK_CLIST(clist), 5, GTK_JUSTIFY_LEFT);
625 gtk_clist_set_column_justification(GTK_CLIST(clist), 6, GTK_JUSTIFY_RIGHT);
626 /* gtk_clist_set_column_justification(GTK_CLIST(clist), 7, GTK_JUSTIFY_CENTER);*/
628 gtk_clist_column_titles_show (GTK_CLIST (clist));
630 gtk_clist_set_compare_func(GTK_CLIST(clist), rtpstream_sort_column);
631 gtk_clist_set_sort_column(GTK_CLIST(clist), 0);
632 gtk_clist_set_sort_type(GTK_CLIST(clist), GTK_SORT_ASCENDING);
634 gtk_widget_show(rtpstream_dlg_w);
636 /* sort by column feature */
637 col_arrows = (column_arrows *) g_malloc(sizeof(column_arrows) * NUM_COLS);
639 for (i=0; i<NUM_COLS; i++) {
640 col_arrows[i].table = gtk_table_new(2, 2, FALSE);
641 gtk_table_set_col_spacings(GTK_TABLE(col_arrows[i].table), 5);
642 column_lb = gtk_label_new(titles[i]);
643 gtk_table_attach(GTK_TABLE(col_arrows[i].table), column_lb, 0, 1, 0, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
644 gtk_widget_show(column_lb);
646 col_arrows[i].ascend_pm = xpm_to_widget(clist_ascend_xpm);
647 gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].ascend_pm, 1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
648 col_arrows[i].descend_pm = xpm_to_widget(clist_descend_xpm);
649 gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
650 /* make src-ip be the default sort order */
652 gtk_widget_show(col_arrows[i].ascend_pm);
654 gtk_clist_set_column_widget(GTK_CLIST(clist), i, col_arrows[i].table);
655 gtk_widget_show(col_arrows[i].table);
658 SIGNAL_CONNECT(clist, "click-column", rtpstream_click_column_cb, col_arrows);
660 label_fwd = gtk_label_new (FWD_LABEL_TEXT);
661 gtk_box_pack_start (GTK_BOX (main_vb), label_fwd, FALSE, FALSE, 0);
663 label_rev = gtk_label_new (REV_LABEL_TEXT);
664 gtk_box_pack_start (GTK_BOX (main_vb), label_rev, FALSE, FALSE, 0);
667 hbuttonbox = gtk_hbutton_box_new ();
668 gtk_box_pack_start (GTK_BOX (main_vb), hbuttonbox, FALSE, FALSE, 0);
669 gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox), GTK_BUTTONBOX_END);
670 gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox), 0);
672 bt_unselect = gtk_button_new_with_label ("Unselect");
673 gtk_container_add (GTK_CONTAINER (hbuttonbox), bt_unselect);
674 gtk_tooltips_set_tip (tooltips, bt_unselect, "Undo stream selection", NULL);
676 bt_findrev = gtk_button_new_with_label ("Find Reverse");
677 gtk_container_add (GTK_CONTAINER (hbuttonbox), bt_findrev);
678 gtk_tooltips_set_tip (tooltips, bt_findrev, "Find the reverse stream matching the selected forward stream", NULL);
680 bt_goto = BUTTON_NEW_FROM_STOCK(GTK_STOCK_JUMP_TO);
681 gtk_container_add (GTK_CONTAINER (hbuttonbox), bt_goto);
683 bt_save = BUTTON_NEW_FROM_STOCK(GTK_STOCK_SAVE_AS);
684 gtk_container_add (GTK_CONTAINER (hbuttonbox), bt_save);
685 gtk_tooltips_set_tip (tooltips, bt_save, "Save stream payload in rtpdump format", NULL);
687 bt_mark = gtk_button_new_with_label ("Mark packets");
688 gtk_container_add (GTK_CONTAINER (hbuttonbox), bt_mark);
689 gtk_tooltips_set_tip (tooltips, bt_mark, "Mark packets of the selected stream(s)", NULL);
691 bt_filter = gtk_button_new_with_label ("Prepare filter");
692 gtk_container_add (GTK_CONTAINER (hbuttonbox), bt_filter);
693 gtk_tooltips_set_tip (tooltips, bt_filter, "Prepare a display filter of the selected stream(s)", NULL);
695 bt_analyze = gtk_button_new_with_label ("Analyze");
696 gtk_container_add (GTK_CONTAINER (hbuttonbox), bt_analyze);
697 gtk_tooltips_set_tip (tooltips, bt_analyze, "Open an analyze window of the selected stream(s)", NULL);
699 bt_close = BUTTON_NEW_FROM_STOCK(GTK_STOCK_CLOSE);
700 gtk_container_add (GTK_CONTAINER (hbuttonbox), bt_close);
701 gtk_tooltips_set_tip (tooltips, bt_close, "Close this dialog", NULL);
702 GTK_WIDGET_SET_FLAGS(bt_close, GTK_CAN_DEFAULT);
704 SIGNAL_CONNECT(clist, "select_row", rtpstream_on_select_row, NULL);
705 SIGNAL_CONNECT(bt_unselect, "clicked", rtpstream_on_unselect, NULL);
706 SIGNAL_CONNECT(bt_findrev, "clicked", rtpstream_on_findrev, NULL);
708 SIGNAL_CONNECT(bt_goto, "clicked", rtpstream_on_goto, NULL);
710 SIGNAL_CONNECT(bt_save, "clicked", rtpstream_on_save, NULL);
711 SIGNAL_CONNECT(bt_mark, "clicked", rtpstream_on_mark, NULL);
712 SIGNAL_CONNECT(bt_filter, "clicked", rtpstream_on_filter, NULL);
713 SIGNAL_CONNECT(bt_analyze, "clicked", rtpstream_on_analyse, NULL);
715 window_set_cancel_button(rtpstream_dlg_w, bt_close, window_cancel_button_cb);
717 SIGNAL_CONNECT(rtpstream_dlg_w, "delete_event", window_delete_event_cb, NULL);
718 SIGNAL_CONNECT(rtpstream_dlg_w, "destroy", rtpstream_on_destroy, NULL);
720 gtk_widget_show_all(rtpstream_dlg_w);
721 window_present(rtpstream_dlg_w);
723 rtpstream_on_unselect(NULL, NULL);
725 rtp_stream_dlg = rtpstream_dlg_w;
729 /****************************************************************************/
731 /****************************************************************************/
733 /****************************************************************************/
734 /* update the contents of the dialog box clist */
735 /* list: pointer to list of rtp_stream_info_t* */
736 void rtpstream_dlg_update(GList *list)
738 if (rtp_stream_dlg != NULL) {
739 gtk_clist_clear(GTK_CLIST(clist));
742 list = g_list_first(list);
745 add_to_clist((rtp_stream_info_t*)(list->data));
746 list = g_list_next(list);
749 rtpstream_on_unselect(NULL, NULL);
756 /****************************************************************************/
757 /* update the contents of the dialog box clist */
758 /* list: pointer to list of rtp_stream_info_t* */
759 void rtpstream_dlg_show(GList *list)
761 if (rtp_stream_dlg != NULL) {
762 /* There's already a dialog box; reactivate it. */
763 reactivate_window(rtp_stream_dlg);
764 /* Another list since last call? */
765 if (list != last_list) {
766 rtpstream_dlg_update(list);
770 /* Create and show the dialog box */
771 rtpstream_dlg_create();
772 rtpstream_dlg_update(list);
777 /****************************************************************************/
778 /* entry point when called via the GTK menu */
779 void rtpstream_launch(GtkWidget *w _U_, gpointer data _U_)
781 /* Register the tap listener */
782 register_tap_listener_rtp_stream();
784 /* Scan for RTP streams (redissect all packets) */
787 /* Show the dialog box with the list of streams */
788 rtpstream_dlg_show(rtpstream_get_info()->strinfo_list);
790 /* Tap listener will be removed and cleaned up in rtpstream_on_destroy */
793 /****************************************************************************/
795 register_tap_listener_rtp_stream_dlg(void)
797 register_tap_menu_item("RTP/Show All Streams...", REGISTER_TAP_GROUP_NONE,
798 rtpstream_launch, NULL, NULL, NULL);