2 * RTP streams summary addition for ethereal
4 * $Id: rtp_stream_dlg.c,v 1.7 2003/12/17 22:13:08 guy Exp $
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"
43 #include "compat_macros.h"
49 extern GtkWidget *main_display_filter_widget;
51 static const value_string rtp_payload_type_vals[] =
53 { PT_PCMU, "ITU-T G.711 PCMU" },
54 { PT_1016, "USA Federal Standard FS-1016" },
55 { PT_G721, "ITU-T G.721" },
56 { PT_GSM, "GSM 06.10" },
57 { PT_G723, "ITU-T G.723" },
58 { PT_DVI4_8000, "DVI4 8000 samples/s" },
59 { PT_DVI4_16000, "DVI4 16000 samples/s" },
60 { PT_LPC, "Experimental linear predictive encoding from Xerox PARC" },
61 { PT_PCMA, "ITU-T G.711 PCMA" },
62 { PT_G722, "ITU-T G.722" },
63 { PT_L16_STEREO, "16-bit uncompressed audio, stereo" },
64 { PT_L16_MONO, "16-bit uncompressed audio, monaural" },
65 { PT_QCELP, "Qualcomm Code Excited Linear Predictive coding" },
66 { PT_CN, "Comfort noise" },
67 { PT_MPA, "MPEG-I/II Audio"},
68 { PT_G728, "ITU-T G.728" },
69 { PT_DVI4_11025, "DVI4 11025 samples/s" },
70 { PT_DVI4_22050, "DVI4 22050 samples/s" },
71 { PT_G729, "ITU-T G.729" },
72 { PT_CELB, "Sun CellB video encoding" },
73 { PT_JPEG, "JPEG-compressed video" },
74 { PT_NV, "'nv' program" },
75 { PT_H261, "ITU-T H.261" },
76 { PT_MPV, "MPEG-I/II Video"},
77 { PT_MP2T, "MPEG-II transport streams"},
78 { PT_H263, "ITU-T H.263" },
83 typedef const guint8 * ip_addr_p;
85 static const gchar FWD_LABEL_TEXT[] = "Select a forward stream with left mouse button";
86 static const gchar REV_LABEL_TEXT[] = "Select a reverse stream with SHIFT + left mouse button";
88 /****************************************************************************/
89 /* pointer to the one and only dialog window */
90 static GtkWidget *rtp_stream_dlg = NULL;
92 /* save as dialog box */
93 static GtkWidget *rtpstream_save_dlg = NULL;
94 static GtkWidget *clist = NULL;
95 static GtkWidget *label_fwd = NULL;
96 static GtkWidget *label_rev = NULL;
98 static rtp_stream_info_t* selected_stream_fwd = NULL; /* current selection */
99 static rtp_stream_info_t* selected_stream_rev = NULL; /* current selection for reversed */
100 static GList *last_list = NULL;
103 /****************************************************************************/
104 /* append a line to clist */
105 static void add_to_clist(rtp_stream_info_t* strinfo)
111 data[0]=&field[0][0];
112 data[1]=&field[1][0];
113 data[2]=&field[2][0];
114 data[3]=&field[3][0];
115 data[4]=&field[4][0];
116 data[5]=&field[5][0];
117 data[6]=&field[6][0];
118 data[7]=&field[7][0];
120 g_snprintf(field[0], 20, "%s", ip_to_str((const guint8*)&(strinfo->src_addr)));
121 g_snprintf(field[1], 20, "%u", strinfo->src_port);
122 g_snprintf(field[2], 20, "%s", ip_to_str((const guint8*)&(strinfo->dest_addr)));
123 g_snprintf(field[3], 20, "%u", strinfo->dest_port);
124 g_snprintf(field[4], 20, "%u", strinfo->ssrc);
125 g_snprintf(field[5], 30, "%s", val_to_str(strinfo->pt, rtp_payload_type_vals,
127 g_snprintf(field[6], 20, "%u", strinfo->npackets);
128 /* XXX: Comment field is not used for the moment */
129 /* g_snprintf(field[7], 20, "%s", "");*/
131 added_row = gtk_clist_append(GTK_CLIST(clist), data);
133 /* set data pointer of last row to point to user data for that row */
134 gtk_clist_set_row_data(GTK_CLIST(clist), added_row, strinfo);
137 /****************************************************************************/
138 static void save_stream_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
140 /* Note that we no longer have a Save voice info dialog box. */
141 rtpstream_save_dlg = NULL;
144 /****************************************************************************/
146 static void save_stream_ok_cb(GtkWidget *ok_bt _U_, gpointer user_data _U_)
150 if (!selected_stream_fwd)
153 g_dest = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION (rtpstream_save_dlg)));
155 /* Perhaps the user specified a directory instead of a file.
156 Check whether they did. */
157 if (test_for_directory(g_dest) == EISDIR) {
158 /* It's a directory - set the file selection box to display it. */
159 set_last_open_dir(g_dest);
161 gtk_file_selection_set_filename(GTK_FILE_SELECTION(rtpstream_save_dlg), last_open_dir);
165 rtpstream_save(selected_stream_fwd, g_dest);
167 gtk_widget_destroy(GTK_WIDGET(rtpstream_save_dlg));
171 /****************************************************************************/
173 /****************************************************************************/
175 rtpstream_on_destroy (GtkObject *object _U_,
176 gpointer user_data _U_)
178 /* Remove the stream tap listener */
179 remove_tap_listener_rtp_stream();
181 /* Is there a save voice window open? */
182 if (rtpstream_save_dlg != NULL)
183 gtk_widget_destroy(rtpstream_save_dlg);
185 /* Clean up memory used by stream tap */
186 rtpstream_reset((rtpstream_tapinfo_t*) rtpstream_get_info());
188 /* Note that we no longer have a "RTP Streams" dialog box. */
189 rtp_stream_dlg = NULL;
193 /****************************************************************************/
195 rtpstream_on_unselect (GtkButton *button _U_,
196 gpointer user_data _U_)
198 selected_stream_fwd = NULL;
199 selected_stream_rev = NULL;
200 gtk_clist_unselect_all(GTK_CLIST(clist));
201 gtk_label_set_text(GTK_LABEL(label_fwd), FWD_LABEL_TEXT);
202 gtk_label_set_text(GTK_LABEL(label_rev), REV_LABEL_TEXT);
206 /****************************************************************************/
209 rtpstream_on_goto (GtkButton *button _U_,
210 gpointer user_data _U_)
212 if (selected_stream_fwd)
214 goto_frame(&cfile, selected_stream_fwd->first_frame_num);
220 /****************************************************************************/
222 rtpstream_on_save (GtkButton *button _U_,
225 rtpstream_tapinfo_t* tapinfo = data;
230 if (!selected_stream_fwd)
233 if (rtpstream_save_dlg != NULL) {
234 /* There's already a Save dialog box; reactivate it. */
235 reactivate_window(rtpstream_save_dlg);
239 rtpstream_save_dlg = gtk_file_selection_new("Ethereal: Save selected stream in rtpdump ('-F dump') format");
240 SIGNAL_CONNECT(rtpstream_save_dlg, "destroy", save_stream_destroy_cb,
243 /* Container for each row of widgets */
244 vertb = gtk_vbox_new(FALSE, 0);
245 gtk_container_border_width(GTK_CONTAINER(vertb), 5);
246 gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(rtpstream_save_dlg)->action_area),
247 vertb, FALSE, FALSE, 0);
248 gtk_widget_show (vertb);
250 ok_bt = GTK_FILE_SELECTION(rtpstream_save_dlg)->ok_button;
251 /* OBJECT_SET_DATA(ok_bt, "user_data", tapinfo);*/
253 /* Connect the cancel_button to destroy the widget */
254 SIGNAL_CONNECT_OBJECT(GTK_FILE_SELECTION(rtpstream_save_dlg)->cancel_button,
255 "clicked", (GtkSignalFunc)gtk_widget_destroy,
258 /* Catch the "key_press_event" signal in the window, so that we can catch
259 the ESC key being pressed and act as if the "Cancel" button had
261 dlg_set_cancel(rtpstream_save_dlg, GTK_FILE_SELECTION(rtpstream_save_dlg)->cancel_button);
263 SIGNAL_CONNECT(ok_bt, "clicked", save_stream_ok_cb, tapinfo);
265 gtk_widget_show(rtpstream_save_dlg);
269 /****************************************************************************/
271 rtpstream_on_mark (GtkButton *button _U_,
272 gpointer user_data _U_)
274 if (selected_stream_fwd==NULL && selected_stream_rev==NULL)
276 rtpstream_mark(selected_stream_fwd, selected_stream_rev);
280 #define MAX_FILTER_LENGTH 320
282 /****************************************************************************/
284 rtpstream_on_filter (GtkButton *button _U_,
285 gpointer user_data _U_)
287 gchar filter_string[MAX_FILTER_LENGTH] = "";
288 gchar filter_string_rev[MAX_FILTER_LENGTH] = "";
290 if (selected_stream_fwd==NULL && selected_stream_rev==NULL)
293 if (selected_stream_fwd)
295 g_snprintf(filter_string, MAX_FILTER_LENGTH,
296 "(ip.src==%s && udp.srcport==%u && ip.dst==%s && udp.dstport==%u && rtp.ssrc==%u)",
297 ip_to_str((const guint8*)&(selected_stream_fwd->src_addr)),
298 selected_stream_fwd->src_port,
299 ip_to_str((const guint8*)&(selected_stream_fwd->dest_addr)),
300 selected_stream_fwd->dest_port,
301 selected_stream_fwd->ssrc);
303 if (selected_stream_rev)
305 strcat(filter_string, " || ");
309 if (selected_stream_rev)
311 g_snprintf(filter_string_rev, MAX_FILTER_LENGTH,
312 "(ip.src==%s && udp.srcport==%u && ip.dst==%s && udp.dstport==%u && rtp.ssrc==%u)",
313 ip_to_str((const guint8*)&(selected_stream_rev->src_addr)),
314 selected_stream_rev->src_port,
315 ip_to_str((const guint8*)&(selected_stream_rev->dest_addr)),
316 selected_stream_rev->dest_port,
317 selected_stream_rev->ssrc);
318 strcat(filter_string, filter_string_rev);
321 gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), filter_string);
323 filter_packets(&cfile, filter_string);
324 rtpstream_dlg_update(rtpstream_get_info()->strinfo_list);
329 /****************************************************************************/
331 rtpstream_on_close (GtkButton *button _U_,
332 gpointer user_data _U_)
334 gtk_grab_remove(rtp_stream_dlg);
335 gtk_widget_destroy(rtp_stream_dlg);
339 /****************************************************************************/
341 rtpstream_on_analyse (GtkButton *button _U_,
342 gpointer user_data _U_)
344 guint32 ip_src_fwd = 0;
345 guint16 port_src_fwd = 0;
346 guint32 ip_dst_fwd = 0;
347 guint16 port_dst_fwd = 0;
348 guint32 ssrc_fwd = 0;
349 guint32 ip_src_rev = 0;
350 guint16 port_src_rev = 0;
351 guint32 ip_dst_rev = 0;
352 guint16 port_dst_rev = 0;
353 guint32 ssrc_rev = 0;
355 if (selected_stream_fwd) {
356 ip_src_fwd = selected_stream_fwd->src_addr;
357 port_src_fwd = selected_stream_fwd->src_port;
358 ip_dst_fwd = selected_stream_fwd->dest_addr;
359 port_dst_fwd = selected_stream_fwd->dest_port;
360 ssrc_fwd = selected_stream_fwd->ssrc;
363 if (selected_stream_rev) {
364 ip_src_rev = selected_stream_rev->src_addr;
365 port_src_rev = selected_stream_rev->src_port;
366 ip_dst_rev = selected_stream_rev->dest_addr;
367 port_dst_rev = selected_stream_rev->dest_port;
368 ssrc_rev = selected_stream_rev->ssrc;
387 /****************************************************************************/
388 /* This should be the callback function called upon a user-defined
389 * event "signal_rtpstream_update", but i didn't knoow how to do with GTK
391 rtpstream_on_update (GtkButton *button _U_,
392 gpointer user_data _U_)
394 rtpstream_dlg_update(rtpstream_get_info()->strinfo_list);
398 /****************************************************************************/
399 /* when the user selects a row in the stream list */
401 rtpstream_on_select_row(GtkCList *clist,
404 GdkEventButton *event _U_,
405 gpointer user_data _U_)
407 gchar label_text[80];
409 /* update the labels */
410 if (event->state & GDK_SHIFT_MASK) {
411 selected_stream_rev = gtk_clist_get_row_data(GTK_CLIST(clist), row);
412 g_snprintf(label_text, 80, "Reverse: %s:%u -> %s:%u, SSRC=%u",
413 ip_to_str((ip_addr_p)&selected_stream_rev->src_addr),
414 selected_stream_rev->src_port,
415 ip_to_str((ip_addr_p)&selected_stream_rev->dest_addr),
416 selected_stream_rev->dest_port,
417 selected_stream_rev->ssrc
419 gtk_label_set_text(GTK_LABEL(label_rev), label_text);
422 selected_stream_fwd = gtk_clist_get_row_data(GTK_CLIST(clist), row);
423 g_snprintf(label_text, 80, "Forward: %s:%u -> %s:%u, SSRC=%u",
424 ip_to_str((ip_addr_p)&selected_stream_fwd->src_addr),
425 selected_stream_fwd->src_port,
426 ip_to_str((ip_addr_p)&selected_stream_fwd->dest_addr),
427 selected_stream_fwd->dest_port,
428 selected_stream_fwd->ssrc
430 gtk_label_set_text(GTK_LABEL(label_fwd), label_text);
434 gtk_widget_set_sensitive(save_bt, TRUE);
435 gtk_widget_set_sensitive(filter_bt, TRUE);
436 gtk_widget_set_sensitive(mark_bt, TRUE);
438 /* TODO: activate other buttons when implemented */
442 /****************************************************************************/
444 /****************************************************************************/
446 static void rtpstream_dlg_create (void)
448 /* these are global static now:
449 GtkWidget *clist = NULL;
450 GtkWidget *label_fwd = NULL;
451 GtkWidget *label_rev = NULL;
453 GtkWidget *rtpstream_dlg_w;
454 GtkWidget *dialog_vbox1;
457 GtkWidget *scrolledwindow1;
465 /* GtkWidget *label9;*/
466 GtkWidget *dialog_action_area1;
467 GtkWidget *hbuttonbox2;
468 /* GtkWidget *bt_goto;*/
469 GtkWidget *bt_unselect;
471 GtkWidget *bt_frames;
472 GtkWidget *bt_filter;
473 GtkWidget *bt_analyse;
476 rtpstream_dlg_w = gtk_dialog_new();
477 gtk_window_set_title (GTK_WINDOW (rtpstream_dlg_w), "Ethereal: RTP Streams");
479 dialog_vbox1 = GTK_DIALOG (rtpstream_dlg_w)->vbox;
480 gtk_widget_show (dialog_vbox1);
482 vbox1 = gtk_vbox_new (FALSE, 0);
483 gtk_widget_ref (vbox1);
484 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "vbox1", vbox1, gtk_widget_unref);
485 gtk_widget_show (vbox1);
486 gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);
487 gtk_container_set_border_width (GTK_CONTAINER (vbox1), 8);
489 label10 = gtk_label_new ("Detected RTP streams. Choose one for forward and reverse direction for analysis");
490 gtk_widget_ref (label10);
491 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "label10", label10,
493 gtk_widget_show (label10);
494 gtk_box_pack_start (GTK_BOX (vbox1), label10, FALSE, FALSE, 0);
495 WIDGET_SET_SIZE(label10, -2, 32);
497 scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
498 gtk_widget_ref (scrolledwindow1);
499 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "scrolledwindow1",
500 scrolledwindow1, gtk_widget_unref);
501 gtk_widget_show (scrolledwindow1);
502 gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow1, TRUE, TRUE, 0);
504 clist = gtk_clist_new (7); /* defines number of columns */
505 gtk_widget_ref (clist);
506 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "clist", clist, gtk_widget_unref);
507 gtk_widget_show (clist);
508 gtk_container_add (GTK_CONTAINER (scrolledwindow1), clist);
509 WIDGET_SET_SIZE(clist, 640, 200);
510 gtk_clist_set_column_width (GTK_CLIST (clist), 0, 100);
511 gtk_clist_set_column_width (GTK_CLIST (clist), 1, 50);
512 gtk_clist_set_column_width (GTK_CLIST (clist), 2, 100);
513 gtk_clist_set_column_width (GTK_CLIST (clist), 3, 50);
514 gtk_clist_set_column_width (GTK_CLIST (clist), 4, 80);
515 gtk_clist_set_column_width (GTK_CLIST (clist), 5, 118);
516 gtk_clist_set_column_width (GTK_CLIST (clist), 6, 60);
517 /* gtk_clist_set_column_width (GTK_CLIST (clist), 7, 51);*/
518 gtk_clist_column_titles_show (GTK_CLIST (clist));
520 label2 = gtk_label_new ("Src IP addr");
521 gtk_widget_ref (label2);
522 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "label2", label2,
524 gtk_widget_show (label2);
525 gtk_clist_set_column_widget (GTK_CLIST (clist), 0, label2);
527 label3 = gtk_label_new ("Src port");
528 gtk_widget_ref (label3);
529 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "label3", label3,
531 gtk_widget_show (label3);
532 gtk_clist_set_column_widget (GTK_CLIST (clist), 1, label3);
534 label4 = gtk_label_new ("Dest IP addr");
535 gtk_widget_ref (label4);
536 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "label4", label4,
538 gtk_widget_show (label4);
539 gtk_clist_set_column_widget (GTK_CLIST (clist), 2, label4);
541 label5 = gtk_label_new ("Dest port");
542 gtk_widget_ref (label5);
543 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "label5", label5,
545 gtk_widget_show (label5);
546 gtk_clist_set_column_widget (GTK_CLIST (clist), 3, label5);
548 label6 = gtk_label_new ("SSRC");
549 gtk_widget_ref (label6);
550 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "label6", label6,
552 gtk_widget_show (label6);
553 gtk_clist_set_column_widget (GTK_CLIST (clist), 4, label6);
554 WIDGET_SET_SIZE(label6, 80, -2);
556 label7 = gtk_label_new ("Payload");
557 gtk_widget_ref (label7);
558 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "label7", label7,
560 gtk_widget_show (label7);
561 gtk_clist_set_column_widget (GTK_CLIST (clist), 5, label7);
563 label8 = gtk_label_new ("Packets");
564 gtk_widget_ref (label8);
565 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "label8", label8,
567 gtk_widget_show (label8);
568 gtk_clist_set_column_widget (GTK_CLIST (clist), 6, label8);
570 label9 = gtk_label_new ("Comment");
571 gtk_widget_ref (label9);
572 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "label9", label9,
574 gtk_widget_show (label9);
575 gtk_clist_set_column_widget (GTK_CLIST (clist), 7, label9);
577 label_fwd = gtk_label_new (FWD_LABEL_TEXT);
578 gtk_widget_ref (label_fwd);
579 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "label_fwd", label_fwd,
581 gtk_widget_show (label_fwd);
582 gtk_box_pack_start (GTK_BOX (vbox1), label_fwd, FALSE, FALSE, 0);
583 gtk_label_set_justify (GTK_LABEL (label_fwd), GTK_JUSTIFY_LEFT);
585 label_rev = gtk_label_new (REV_LABEL_TEXT);
586 gtk_widget_ref (label_rev);
587 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "label_rev", label_rev,
589 gtk_widget_show (label_rev);
590 gtk_box_pack_start (GTK_BOX (vbox1), label_rev, FALSE, FALSE, 0);
591 gtk_label_set_justify (GTK_LABEL (label_rev), GTK_JUSTIFY_LEFT);
593 dialog_action_area1 = GTK_DIALOG (rtpstream_dlg_w)->action_area;
594 gtk_widget_show (dialog_action_area1);
595 gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 10);
597 hbuttonbox2 = gtk_hbutton_box_new ();
598 gtk_widget_ref (hbuttonbox2);
599 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "hbuttonbox2", hbuttonbox2,
601 gtk_widget_show (hbuttonbox2);
602 gtk_box_pack_start (GTK_BOX (dialog_action_area1), hbuttonbox2, FALSE, FALSE, 0);
603 gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox2), GTK_BUTTONBOX_END);
604 gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox2), 0);
606 bt_unselect = gtk_button_new_with_label ("Unselect");
607 gtk_widget_ref (bt_unselect);
608 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "bt_unselect", bt_unselect,
610 gtk_widget_show (bt_unselect);
611 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_unselect);
612 GTK_WIDGET_SET_FLAGS (bt_unselect, GTK_CAN_DEFAULT);
614 bt_goto = gtk_button_new_with_label ("Go to Frame");
615 gtk_widget_ref (bt_goto);
616 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "bt_goto", bt_goto,
618 gtk_widget_show (bt_goto);
619 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_goto);
620 GTK_WIDGET_SET_FLAGS (bt_goto, GTK_CAN_DEFAULT);
622 bt_save = gtk_button_new_with_label ("Save as...");
623 gtk_widget_ref (bt_save);
624 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "bt_save", bt_save,
626 gtk_widget_show (bt_save);
627 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_save);
628 GTK_WIDGET_SET_FLAGS (bt_save, GTK_CAN_DEFAULT);
630 bt_frames = gtk_button_new_with_label ("Mark frames");
631 gtk_widget_ref (bt_frames);
632 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "bt_frames", bt_frames,
634 gtk_widget_show (bt_frames);
635 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_frames);
636 GTK_WIDGET_SET_FLAGS (bt_frames, GTK_CAN_DEFAULT);
638 bt_filter = gtk_button_new_with_label ("Set filter");
639 gtk_widget_ref (bt_filter);
640 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "bt_filter", bt_filter,
642 gtk_widget_show (bt_filter);
643 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_filter);
644 GTK_WIDGET_SET_FLAGS (bt_filter, GTK_CAN_DEFAULT);
646 bt_analyse = gtk_button_new_with_label ("Analyse");
647 gtk_widget_ref (bt_analyse);
648 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "bt_analyse", bt_analyse,
650 gtk_widget_show (bt_analyse);
651 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_analyse);
652 GTK_WIDGET_SET_FLAGS (bt_analyse, GTK_CAN_DEFAULT);
654 bt_close = gtk_button_new_with_label ("Close");
655 gtk_widget_ref (bt_close);
656 OBJECT_SET_DATA_FULL(rtpstream_dlg_w, "bt_close", bt_close,
658 gtk_widget_show (bt_close);
659 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_close);
660 GTK_WIDGET_SET_FLAGS (bt_close, GTK_CAN_DEFAULT);
662 SIGNAL_CONNECT(rtpstream_dlg_w, "destroy", rtpstream_on_destroy, NULL);
663 SIGNAL_CONNECT(clist, "select_row", rtpstream_on_select_row, NULL);
664 SIGNAL_CONNECT(bt_unselect, "clicked", rtpstream_on_unselect, NULL);
666 gtk_signal_connect (GTK_OBJECT (bt_goto), "clicked",
667 GTK_SIGNAL_FUNC (rtpstream_on_goto),
670 SIGNAL_CONNECT(bt_save, "clicked", rtpstream_on_save, NULL);
671 SIGNAL_CONNECT(bt_frames, "clicked", rtpstream_on_mark, NULL);
672 SIGNAL_CONNECT(bt_filter, "clicked", rtpstream_on_filter, NULL);
673 SIGNAL_CONNECT(bt_analyse, "clicked", rtpstream_on_analyse, NULL);
674 SIGNAL_CONNECT(bt_close, "clicked", rtpstream_on_close, NULL);
675 /* XXX: see rtpstream_on_update for comment
676 gtk_signal_connect (GTK_OBJECT (top_level), "signal_rtpstream_update",
677 GTK_SIGNAL_FUNC (rtpstream_on_update),
682 gtk_clist_set_column_justification(GTK_CLIST(clist), 0, GTK_JUSTIFY_CENTER);
683 gtk_clist_set_column_justification(GTK_CLIST(clist), 1, GTK_JUSTIFY_CENTER);
684 gtk_clist_set_column_justification(GTK_CLIST(clist), 2, GTK_JUSTIFY_CENTER);
685 gtk_clist_set_column_justification(GTK_CLIST(clist), 3, GTK_JUSTIFY_CENTER);
686 gtk_clist_set_column_justification(GTK_CLIST(clist), 4, GTK_JUSTIFY_CENTER);
687 gtk_clist_set_column_justification(GTK_CLIST(clist), 5, GTK_JUSTIFY_LEFT);
688 gtk_clist_set_column_justification(GTK_CLIST(clist), 6, GTK_JUSTIFY_RIGHT);
689 /* gtk_clist_set_column_justification(GTK_CLIST(clist), 7, GTK_JUSTIFY_CENTER);*/
692 rtpstream_on_unselect(NULL, NULL);
694 rtp_stream_dlg = rtpstream_dlg_w;
698 /****************************************************************************/
700 /****************************************************************************/
702 /****************************************************************************/
703 /* update the contents of the dialog box clist */
704 /* list: pointer to list of rtp_stream_info_t* */
705 void rtpstream_dlg_update(GList *list)
707 if (rtp_stream_dlg != NULL) {
708 gtk_clist_clear(GTK_CLIST(clist));
710 list = g_list_first(list);
713 add_to_clist((rtp_stream_info_t*)(list->data));
714 list = g_list_next(list);
717 rtpstream_on_unselect(NULL, NULL);
724 /****************************************************************************/
725 /* update the contents of the dialog box clist */
726 /* list: pointer to list of rtp_stream_info_t* */
727 void rtpstream_dlg_show(GList *list)
729 if (rtp_stream_dlg != NULL) {
730 /* There's already a dialog box; reactivate it. */
731 reactivate_window(rtp_stream_dlg);
732 /* Another list since last call? */
733 if (list != last_list) {
734 rtpstream_dlg_update(list);
738 /* Create and show the dialog box */
739 rtpstream_dlg_create();
740 rtpstream_dlg_update(list);
741 gtk_widget_show(rtp_stream_dlg);
746 /****************************************************************************/
747 /* entry point when called via the GTK menu */
748 void rtpstream_launch(GtkWidget *w _U_, gpointer data _U_)
750 /* Register the tap listener */
751 register_tap_listener_rtp_stream();
753 /* Scan for RTP streams (redissect all packets) */
756 /* Show the dialog box with the list of streams */
757 rtpstream_dlg_show(rtpstream_get_info()->strinfo_list);
759 /* Tap listener will be removed and cleaned up in rtpstream_on_destroy */
762 /****************************************************************************/
764 register_tap_menu_rtp_stream(void)
766 register_tap_menu_item("Statistics/RTP Streams/Show All...",
767 rtpstream_launch, NULL, NULL, NULL);