2 * RTP streams summary addition for ethereal
4 * $Id: rtp_stream_dlg.c,v 1.1 2003/09/24 07:48:11 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"
47 extern GtkWidget *main_display_filter_widget;
50 /****************************************************************************/
56 * http://www.iana.org/assignments/rtp-parameters
58 #define PT_PCMU 0 /* RFC 1890 */
59 #define PT_1016 1 /* RFC 1890 */
60 #define PT_G721 2 /* RFC 1890 */
61 #define PT_GSM 3 /* RFC 1890 */
62 #define PT_G723 4 /* From Vineet Kumar of Intel; see the Web page */
63 #define PT_DVI4_8000 5 /* RFC 1890 */
64 #define PT_DVI4_16000 6 /* RFC 1890 */
65 #define PT_LPC 7 /* RFC 1890 */
66 #define PT_PCMA 8 /* RFC 1890 */
67 #define PT_G722 9 /* RFC 1890 */
68 #define PT_L16_STEREO 10 /* RFC 1890 */
69 #define PT_L16_MONO 11 /* RFC 1890 */
70 #define PT_QCELP 12 /* Qualcomm Code Excited Linear Predictive coding? */
71 #define PT_CN 13 /* RFC 3389 */
72 #define PT_MPA 14 /* RFC 1890, RFC 2250 */
73 #define PT_G728 15 /* RFC 1890 */
74 #define PT_DVI4_11025 16 /* from Joseph Di Pol of Sun; see the Web page */
75 #define PT_DVI4_22050 17 /* from Joseph Di Pol of Sun; see the Web page */
77 #define PT_CELB 25 /* RFC 2029 */
78 #define PT_JPEG 26 /* RFC 2435 */
79 #define PT_NV 28 /* RFC 1890 */
80 #define PT_H261 31 /* RFC 2032 */
81 #define PT_MPV 32 /* RFC 2250 */
82 #define PT_MP2T 33 /* RFC 2250 */
83 #define PT_H263 34 /* from Chunrong Zhu of Intel; see the Web page */
85 static const value_string rtp_payload_type_vals[] =
87 { PT_PCMU, "ITU-T G.711 PCMU" },
88 { PT_1016, "USA Federal Standard FS-1016" },
89 { PT_G721, "ITU-T G.721" },
90 { PT_GSM, "GSM 06.10" },
91 { PT_G723, "ITU-T G.723" },
92 { PT_DVI4_8000, "DVI4 8000 samples/s" },
93 { PT_DVI4_16000, "DVI4 16000 samples/s" },
94 { PT_LPC, "Experimental linear predictive encoding from Xerox PARC" },
95 { PT_PCMA, "ITU-T G.711 PCMA" },
96 { PT_G722, "ITU-T G.722" },
97 { PT_L16_STEREO, "16-bit uncompressed audio, stereo" },
98 { PT_L16_MONO, "16-bit uncompressed audio, monaural" },
99 { PT_QCELP, "Qualcomm Code Excited Linear Predictive coding" },
100 { PT_CN, "Comfort noise" },
101 { PT_MPA, "MPEG-I/II Audio"},
102 { PT_G728, "ITU-T G.728" },
103 { PT_DVI4_11025, "DVI4 11025 samples/s" },
104 { PT_DVI4_22050, "DVI4 22050 samples/s" },
105 { PT_G729, "ITU-T G.729" },
106 { PT_CELB, "Sun CellB video encoding" },
107 { PT_JPEG, "JPEG-compressed video" },
108 { PT_NV, "'nv' program" },
109 { PT_H261, "ITU-T H.261" },
110 { PT_MPV, "MPEG-I/II Video"},
111 { PT_MP2T, "MPEG-II transport streams"},
112 { PT_H263, "ITU-T H.263" },
117 typedef const guint8 * ip_addr_p;
119 static const gchar FWD_LABEL_TEXT[] = "Select a forward stream with left mouse button";
120 static const gchar REV_LABEL_TEXT[] = "Select a reverse stream with SHIFT + left mouse button";
122 /****************************************************************************/
123 /* pointer to the one and only dialog window */
124 static GtkWidget *rtp_stream_dlg = NULL;
126 /* save as dialog box */
127 static GtkWidget *rtpstream_save_dlg = NULL;
128 static GtkWidget *clist = NULL;
129 static GtkWidget *label_fwd = NULL;
130 static GtkWidget *label_rev = NULL;
132 static rtp_stream_info_t* selected_stream_fwd = NULL; /* current selection */
133 static rtp_stream_info_t* selected_stream_rev = NULL; /* current selection for reversed */
134 static GList *last_list = NULL;
137 /****************************************************************************/
138 /* append a line to clist */
139 static void add_to_clist(rtp_stream_info_t* strinfo)
145 data[0]=&field[0][0];
146 data[1]=&field[1][0];
147 data[2]=&field[2][0];
148 data[3]=&field[3][0];
149 data[4]=&field[4][0];
150 data[5]=&field[5][0];
151 data[6]=&field[6][0];
152 data[7]=&field[7][0];
154 g_snprintf(field[0], 20, "%s", ip_to_str((const guint8*)&(strinfo->src_addr)));
155 g_snprintf(field[1], 20, "%u", strinfo->src_port);
156 g_snprintf(field[2], 20, "%s", ip_to_str((const guint8*)&(strinfo->dest_addr)));
157 g_snprintf(field[3], 20, "%u", strinfo->dest_port);
158 g_snprintf(field[4], 20, "%u", strinfo->ssrc);
159 g_snprintf(field[5], 30, "%s", val_to_str(strinfo->pt, rtp_payload_type_vals,
161 g_snprintf(field[6], 20, "%u", strinfo->npackets);
162 /* XXX: Comment field is not used for the moment */
163 /* g_snprintf(field[7], 20, "%s", "");*/
165 added_row = gtk_clist_append(GTK_CLIST(clist), data);
167 /* set data pointer of last row to point to user data for that row */
168 gtk_clist_set_row_data(GTK_CLIST(clist), added_row, strinfo);
171 /****************************************************************************/
172 static void save_stream_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
174 /* Note that we no longer have a Save voice info dialog box. */
175 rtpstream_save_dlg = NULL;
178 /****************************************************************************/
180 static void save_stream_ok_cb(GtkWidget *ok_bt _U_, gpointer user_data _U_)
184 if (!selected_stream_fwd)
187 g_dest = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION (rtpstream_save_dlg)));
189 /* Perhaps the user specified a directory instead of a file.
190 Check whether they did. */
191 if (test_for_directory(g_dest) == EISDIR) {
192 /* It's a directory - set the file selection box to display it. */
193 set_last_open_dir(g_dest);
195 gtk_file_selection_set_filename(GTK_FILE_SELECTION(rtpstream_save_dlg), last_open_dir);
199 rtpstream_save(selected_stream_fwd, g_dest);
201 gtk_widget_destroy(GTK_WIDGET(rtpstream_save_dlg));
205 /****************************************************************************/
207 /****************************************************************************/
209 rtpstream_on_destroy (GtkObject *object _U_,
210 gpointer user_data _U_)
212 /* Is there a save voice window open? */
213 if (rtpstream_save_dlg != NULL)
214 gtk_widget_destroy(rtpstream_save_dlg);
216 /* Note that we no longer have a "RTP Analyse" dialog box. */
217 rtp_stream_dlg = NULL;
221 /****************************************************************************/
223 rtpstream_on_unselect (GtkButton *button _U_,
224 gpointer user_data _U_)
226 selected_stream_fwd = NULL;
227 selected_stream_rev = NULL;
228 gtk_clist_unselect_all(GTK_CLIST(clist));
229 gtk_label_set_text(GTK_LABEL(label_fwd), FWD_LABEL_TEXT);
230 gtk_label_set_text(GTK_LABEL(label_rev), REV_LABEL_TEXT);
234 /****************************************************************************/
237 rtpstream_on_goto (GtkButton *button _U_,
238 gpointer user_data _U_)
240 if (selected_stream_fwd)
242 goto_frame(&cfile, selected_stream_fwd->first_frame_num);
248 /****************************************************************************/
250 rtpstream_on_save (GtkButton *button _U_,
253 rtpstream_tapinfo_t* tapinfo = data;
258 if (!selected_stream_fwd)
261 if (rtpstream_save_dlg != NULL) {
262 /* There's already a Save dialog box; reactivate it. */
263 reactivate_window(rtpstream_save_dlg);
267 rtpstream_save_dlg = gtk_file_selection_new("Ethereal: Save selected stream in rtpdump ('-F dump') format");
268 gtk_signal_connect(GTK_OBJECT(rtpstream_save_dlg), "destroy",
269 GTK_SIGNAL_FUNC(save_stream_destroy_cb), NULL);
271 /* Container for each row of widgets */
272 vertb = gtk_vbox_new(FALSE, 0);
273 gtk_container_border_width(GTK_CONTAINER(vertb), 5);
274 gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(rtpstream_save_dlg)->action_area),
275 vertb, FALSE, FALSE, 0);
276 gtk_widget_show (vertb);
278 ok_bt = GTK_FILE_SELECTION(rtpstream_save_dlg)->ok_button;
279 /* OBJECT_SET_DATA(ok_bt, "user_data", tapinfo);*/
281 /* Connect the cancel_button to destroy the widget */
282 SIGNAL_CONNECT_OBJECT(GTK_FILE_SELECTION(rtpstream_save_dlg)->cancel_button,
283 "clicked", (GtkSignalFunc)gtk_widget_destroy,
286 /* Catch the "key_press_event" signal in the window, so that we can catch
287 the ESC key being pressed and act as if the "Cancel" button had
289 dlg_set_cancel(rtpstream_save_dlg, GTK_FILE_SELECTION(rtpstream_save_dlg)->cancel_button);
291 gtk_signal_connect(GTK_OBJECT(ok_bt), "clicked",
292 GTK_SIGNAL_FUNC(save_stream_ok_cb), tapinfo);
294 gtk_widget_show(rtpstream_save_dlg);
298 /****************************************************************************/
300 rtpstream_on_mark (GtkButton *button _U_,
301 gpointer user_data _U_)
303 if (selected_stream_fwd==NULL && selected_stream_rev==NULL)
305 rtpstream_mark(selected_stream_fwd, selected_stream_rev);
309 #define MAX_FILTER_LENGTH 320
311 /****************************************************************************/
313 rtpstream_on_filter (GtkButton *button _U_,
314 gpointer user_data _U_)
316 gchar filter_string[MAX_FILTER_LENGTH] = "";
317 gchar filter_string_rev[MAX_FILTER_LENGTH] = "";
319 if (selected_stream_fwd==NULL && selected_stream_rev==NULL)
322 if (selected_stream_fwd)
324 g_snprintf(filter_string, MAX_FILTER_LENGTH,
325 "(ip.src==%s && udp.srcport==%u && ip.dst==%s && udp.dstport==%u && rtp.ssrc==%u)",
326 ip_to_str((const guint8*)&(selected_stream_fwd->src_addr)),
327 selected_stream_fwd->src_port,
328 ip_to_str((const guint8*)&(selected_stream_fwd->dest_addr)),
329 selected_stream_fwd->dest_port,
330 selected_stream_fwd->ssrc);
332 if (selected_stream_rev)
334 strcat(filter_string, " || ");
338 if (selected_stream_rev)
340 g_snprintf(filter_string_rev, MAX_FILTER_LENGTH,
341 "(ip.src==%s && udp.srcport==%u && ip.dst==%s && udp.dstport==%u && rtp.ssrc==%u)",
342 ip_to_str((const guint8*)&(selected_stream_rev->src_addr)),
343 selected_stream_rev->src_port,
344 ip_to_str((const guint8*)&(selected_stream_rev->dest_addr)),
345 selected_stream_rev->dest_port,
346 selected_stream_rev->ssrc);
347 strcat(filter_string, filter_string_rev);
350 gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), filter_string);
352 filter_packets(&cfile, filter_string);
353 rtpstream_dlg_update(rtpstream_get_info()->strinfo_list);
358 /****************************************************************************/
360 rtpstream_on_close (GtkButton *button _U_,
361 gpointer user_data _U_)
363 gtk_grab_remove(rtp_stream_dlg);
364 gtk_widget_destroy(rtp_stream_dlg);
368 /****************************************************************************/
370 rtpstream_on_analyse (GtkButton *button _U_,
371 gpointer user_data _U_)
373 guint32 ip_src_fwd = 0;
374 guint16 port_src_fwd = 0;
375 guint32 ip_dst_fwd = 0;
376 guint16 port_dst_fwd = 0;
377 guint32 ssrc_fwd = 0;
378 guint32 ip_src_rev = 0;
379 guint16 port_src_rev = 0;
380 guint32 ip_dst_rev = 0;
381 guint16 port_dst_rev = 0;
382 guint32 ssrc_rev = 0;
384 if (selected_stream_fwd) {
385 ip_src_fwd = selected_stream_fwd->src_addr;
386 port_src_fwd = selected_stream_fwd->src_port;
387 ip_dst_fwd = selected_stream_fwd->dest_addr;
388 port_dst_fwd = selected_stream_fwd->dest_port;
389 ssrc_fwd = selected_stream_fwd->ssrc;
392 if (selected_stream_rev) {
393 ip_src_rev = selected_stream_rev->src_addr;
394 port_src_rev = selected_stream_rev->src_port;
395 ip_dst_rev = selected_stream_rev->dest_addr;
396 port_dst_rev = selected_stream_rev->dest_port;
397 ssrc_rev = selected_stream_rev->ssrc;
415 /****************************************************************************/
416 /* This should be the callback function called upon a user-defined
417 * event "signal_rtpstream_update", but i didn't knoow how to do with GTK
419 rtpstream_on_update (GtkButton *button _U_,
420 gpointer user_data _U_)
422 rtpstream_dlg_update(rtpstream_get_info()->strinfo_list);
426 /****************************************************************************/
427 /* when the user selects a row in the stream list */
429 rtpstream_on_select_row(GtkCList *clist,
432 GdkEventButton *event _U_,
433 gpointer user_data _U_)
435 gchar label_text[80];
437 /* update the labels */
438 if (event->state & GDK_SHIFT_MASK) {
439 selected_stream_rev = gtk_clist_get_row_data(GTK_CLIST(clist), row);
440 g_snprintf(label_text, 80, "Reverse: %s:%u -> %s:%u, SSRC=%u",
441 ip_to_str((ip_addr_p)&selected_stream_rev->src_addr),
442 selected_stream_rev->src_port,
443 ip_to_str((ip_addr_p)&selected_stream_rev->dest_addr),
444 selected_stream_rev->dest_port,
445 selected_stream_rev->ssrc
447 gtk_label_set_text(GTK_LABEL(label_rev), label_text);
450 selected_stream_fwd = gtk_clist_get_row_data(GTK_CLIST(clist), row);
451 g_snprintf(label_text, 80, "Forward: %s:%u -> %s:%u, SSRC=%u",
452 ip_to_str((ip_addr_p)&selected_stream_fwd->src_addr),
453 selected_stream_fwd->src_port,
454 ip_to_str((ip_addr_p)&selected_stream_fwd->dest_addr),
455 selected_stream_fwd->dest_port,
456 selected_stream_fwd->ssrc
458 gtk_label_set_text(GTK_LABEL(label_fwd), label_text);
462 gtk_widget_set_sensitive(save_bt, TRUE);
463 gtk_widget_set_sensitive(filter_bt, TRUE);
464 gtk_widget_set_sensitive(mark_bt, TRUE);
466 /* TODO: activate other buttons when implemented */
470 /****************************************************************************/
472 /****************************************************************************/
474 static void rtpstream_dlg_create (void)
476 /* these are global static now:
477 GtkWidget *clist = NULL;
478 GtkWidget *label_fwd = NULL;
479 GtkWidget *label_rev = NULL;
481 GtkWidget *rtpstream_dlg_w;
482 GtkWidget *dialog_vbox1;
485 GtkWidget *scrolledwindow1;
493 /* GtkWidget *label9;*/
494 GtkWidget *dialog_action_area1;
495 GtkWidget *hbuttonbox2;
496 /* GtkWidget *bt_goto;*/
497 GtkWidget *bt_unselect;
499 GtkWidget *bt_frames;
500 GtkWidget *bt_filter;
501 GtkWidget *bt_analyse;
504 rtpstream_dlg_w = gtk_dialog_new ();
505 gtk_window_set_title (GTK_WINDOW (rtpstream_dlg_w), "Ethereal: RTP Streams");
507 dialog_vbox1 = GTK_DIALOG (rtpstream_dlg_w)->vbox;
508 gtk_widget_show (dialog_vbox1);
510 vbox1 = gtk_vbox_new (FALSE, 0);
511 gtk_widget_ref (vbox1);
512 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "vbox1", vbox1,
513 (GtkDestroyNotify) gtk_widget_unref);
514 gtk_widget_show (vbox1);
515 gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);
516 gtk_container_set_border_width (GTK_CONTAINER (vbox1), 8);
518 label10 = gtk_label_new ("Detected RTP streams. Choose one for forward and reverse direction for analysis");
519 gtk_widget_ref (label10);
520 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "label10", label10,
521 (GtkDestroyNotify) gtk_widget_unref);
522 gtk_widget_show (label10);
523 gtk_box_pack_start (GTK_BOX (vbox1), label10, FALSE, FALSE, 0);
524 gtk_widget_set_usize (label10, -2, 32);
526 scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
527 gtk_widget_ref (scrolledwindow1);
528 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "scrolledwindow1", scrolledwindow1,
529 (GtkDestroyNotify) gtk_widget_unref);
530 gtk_widget_show (scrolledwindow1);
531 gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow1, TRUE, TRUE, 0);
533 clist = gtk_clist_new (7); /* defines number of columns */
534 gtk_widget_ref (clist);
535 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "clist", clist,
536 (GtkDestroyNotify) gtk_widget_unref);
537 gtk_widget_show (clist);
538 gtk_container_add (GTK_CONTAINER (scrolledwindow1), clist);
539 gtk_widget_set_usize (clist, 640, 200);
540 gtk_clist_set_column_width (GTK_CLIST (clist), 0, 100);
541 gtk_clist_set_column_width (GTK_CLIST (clist), 1, 50);
542 gtk_clist_set_column_width (GTK_CLIST (clist), 2, 100);
543 gtk_clist_set_column_width (GTK_CLIST (clist), 3, 50);
544 gtk_clist_set_column_width (GTK_CLIST (clist), 4, 80);
545 gtk_clist_set_column_width (GTK_CLIST (clist), 5, 118);
546 gtk_clist_set_column_width (GTK_CLIST (clist), 6, 60);
547 /* gtk_clist_set_column_width (GTK_CLIST (clist), 7, 51);*/
548 gtk_clist_column_titles_show (GTK_CLIST (clist));
550 label2 = gtk_label_new ("Src IP addr");
551 gtk_widget_ref (label2);
552 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "label2", label2,
553 (GtkDestroyNotify) gtk_widget_unref);
554 gtk_widget_show (label2);
555 gtk_clist_set_column_widget (GTK_CLIST (clist), 0, label2);
557 label3 = gtk_label_new ("Src port");
558 gtk_widget_ref (label3);
559 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "label3", label3,
560 (GtkDestroyNotify) gtk_widget_unref);
561 gtk_widget_show (label3);
562 gtk_clist_set_column_widget (GTK_CLIST (clist), 1, label3);
564 label4 = gtk_label_new ("Dest IP addr");
565 gtk_widget_ref (label4);
566 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "label4", label4,
567 (GtkDestroyNotify) gtk_widget_unref);
568 gtk_widget_show (label4);
569 gtk_clist_set_column_widget (GTK_CLIST (clist), 2, label4);
571 label5 = gtk_label_new ("Dest port");
572 gtk_widget_ref (label5);
573 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "label5", label5,
574 (GtkDestroyNotify) gtk_widget_unref);
575 gtk_widget_show (label5);
576 gtk_clist_set_column_widget (GTK_CLIST (clist), 3, label5);
578 label6 = gtk_label_new ("SSRC");
579 gtk_widget_ref (label6);
580 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "label6", label6,
581 (GtkDestroyNotify) gtk_widget_unref);
582 gtk_widget_show (label6);
583 gtk_clist_set_column_widget (GTK_CLIST (clist), 4, label6);
584 gtk_widget_set_usize (label6, 80, -2);
586 label7 = gtk_label_new ("Payload");
587 gtk_widget_ref (label7);
588 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "label7", label7,
589 (GtkDestroyNotify) gtk_widget_unref);
590 gtk_widget_show (label7);
591 gtk_clist_set_column_widget (GTK_CLIST (clist), 5, label7);
593 label8 = gtk_label_new ("Packets");
594 gtk_widget_ref (label8);
595 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "label8", label8,
596 (GtkDestroyNotify) gtk_widget_unref);
597 gtk_widget_show (label8);
598 gtk_clist_set_column_widget (GTK_CLIST (clist), 6, label8);
600 label9 = gtk_label_new ("Comment");
601 gtk_widget_ref (label9);
602 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "label9", label9,
603 (GtkDestroyNotify) gtk_widget_unref);
604 gtk_widget_show (label9);
605 gtk_clist_set_column_widget (GTK_CLIST (clist), 7, label9);
607 label_fwd = gtk_label_new (FWD_LABEL_TEXT);
608 gtk_widget_ref (label_fwd);
609 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "label_fwd", label_fwd,
610 (GtkDestroyNotify) gtk_widget_unref);
611 gtk_widget_show (label_fwd);
612 gtk_box_pack_start (GTK_BOX (vbox1), label_fwd, FALSE, FALSE, 0);
613 gtk_label_set_justify (GTK_LABEL (label_fwd), GTK_JUSTIFY_LEFT);
615 label_rev = gtk_label_new (REV_LABEL_TEXT);
616 gtk_widget_ref (label_rev);
617 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "label_rev", label_rev,
618 (GtkDestroyNotify) gtk_widget_unref);
619 gtk_widget_show (label_rev);
620 gtk_box_pack_start (GTK_BOX (vbox1), label_rev, FALSE, FALSE, 0);
621 gtk_label_set_justify (GTK_LABEL (label_rev), GTK_JUSTIFY_LEFT);
623 dialog_action_area1 = GTK_DIALOG (rtpstream_dlg_w)->action_area;
624 gtk_widget_show (dialog_action_area1);
625 gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 10);
627 hbuttonbox2 = gtk_hbutton_box_new ();
628 gtk_widget_ref (hbuttonbox2);
629 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "hbuttonbox2", hbuttonbox2,
630 (GtkDestroyNotify) gtk_widget_unref);
631 gtk_widget_show (hbuttonbox2);
632 gtk_box_pack_start (GTK_BOX (dialog_action_area1), hbuttonbox2, FALSE, FALSE, 0);
633 gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox2), GTK_BUTTONBOX_END);
634 gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox2), 0);
636 bt_unselect = gtk_button_new_with_label ("Unselect");
637 gtk_widget_ref (bt_unselect);
638 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "bt_unselect", bt_unselect,
639 (GtkDestroyNotify) gtk_widget_unref);
640 gtk_widget_show (bt_unselect);
641 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_unselect);
642 GTK_WIDGET_SET_FLAGS (bt_unselect, GTK_CAN_DEFAULT);
644 bt_goto = gtk_button_new_with_label ("Go to Frame");
645 gtk_widget_ref (bt_goto);
646 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "bt_goto", bt_goto,
647 (GtkDestroyNotify) gtk_widget_unref);
648 gtk_widget_show (bt_goto);
649 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_goto);
650 GTK_WIDGET_SET_FLAGS (bt_goto, GTK_CAN_DEFAULT);
652 bt_save = gtk_button_new_with_label ("Save as...");
653 gtk_widget_ref (bt_save);
654 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "bt_save", bt_save,
655 (GtkDestroyNotify) gtk_widget_unref);
656 gtk_widget_show (bt_save);
657 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_save);
658 GTK_WIDGET_SET_FLAGS (bt_save, GTK_CAN_DEFAULT);
660 bt_frames = gtk_button_new_with_label ("Mark frames");
661 gtk_widget_ref (bt_frames);
662 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "bt_frames", bt_frames,
663 (GtkDestroyNotify) gtk_widget_unref);
664 gtk_widget_show (bt_frames);
665 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_frames);
666 GTK_WIDGET_SET_FLAGS (bt_frames, GTK_CAN_DEFAULT);
668 bt_filter = gtk_button_new_with_label ("Set filter");
669 gtk_widget_ref (bt_filter);
670 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "bt_filter", bt_filter,
671 (GtkDestroyNotify) gtk_widget_unref);
672 gtk_widget_show (bt_filter);
673 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_filter);
674 GTK_WIDGET_SET_FLAGS (bt_filter, GTK_CAN_DEFAULT);
676 bt_analyse = gtk_button_new_with_label ("Analyse");
677 gtk_widget_ref (bt_analyse);
678 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "bt_analyse", bt_analyse,
679 (GtkDestroyNotify) gtk_widget_unref);
680 gtk_widget_show (bt_analyse);
681 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_analyse);
682 GTK_WIDGET_SET_FLAGS (bt_analyse, GTK_CAN_DEFAULT);
684 bt_close = gtk_button_new_with_label ("Close");
685 gtk_widget_ref (bt_close);
686 gtk_object_set_data_full (GTK_OBJECT (rtpstream_dlg_w), "bt_close", bt_close,
687 (GtkDestroyNotify) gtk_widget_unref);
688 gtk_widget_show (bt_close);
689 gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_close);
690 GTK_WIDGET_SET_FLAGS (bt_close, GTK_CAN_DEFAULT);
692 gtk_signal_connect (GTK_OBJECT (rtpstream_dlg_w), "destroy",
693 GTK_SIGNAL_FUNC (rtpstream_on_destroy),
695 gtk_signal_connect (GTK_OBJECT (clist), "select_row",
696 GTK_SIGNAL_FUNC (rtpstream_on_select_row),
698 gtk_signal_connect (GTK_OBJECT (bt_unselect), "clicked",
699 GTK_SIGNAL_FUNC (rtpstream_on_unselect),
702 gtk_signal_connect (GTK_OBJECT (bt_goto), "clicked",
703 GTK_SIGNAL_FUNC (rtpstream_on_goto),
706 gtk_signal_connect (GTK_OBJECT (bt_save), "clicked",
707 GTK_SIGNAL_FUNC (rtpstream_on_save),
709 gtk_signal_connect (GTK_OBJECT (bt_frames), "clicked",
710 GTK_SIGNAL_FUNC (rtpstream_on_mark),
712 gtk_signal_connect (GTK_OBJECT (bt_filter), "clicked",
713 GTK_SIGNAL_FUNC (rtpstream_on_filter),
715 gtk_signal_connect (GTK_OBJECT (bt_analyse), "clicked",
716 GTK_SIGNAL_FUNC (rtpstream_on_analyse),
718 gtk_signal_connect (GTK_OBJECT (bt_close), "clicked",
719 GTK_SIGNAL_FUNC (rtpstream_on_close),
721 /* XXX: see rtpstream_on_update for comment
722 gtk_signal_connect (GTK_OBJECT (top_level), "signal_rtpstream_update",
723 GTK_SIGNAL_FUNC (rtpstream_on_update),
728 gtk_clist_set_column_justification(GTK_CLIST(clist), 0, GTK_JUSTIFY_CENTER);
729 gtk_clist_set_column_justification(GTK_CLIST(clist), 1, GTK_JUSTIFY_CENTER);
730 gtk_clist_set_column_justification(GTK_CLIST(clist), 2, GTK_JUSTIFY_CENTER);
731 gtk_clist_set_column_justification(GTK_CLIST(clist), 3, GTK_JUSTIFY_CENTER);
732 gtk_clist_set_column_justification(GTK_CLIST(clist), 4, GTK_JUSTIFY_CENTER);
733 gtk_clist_set_column_justification(GTK_CLIST(clist), 5, GTK_JUSTIFY_LEFT);
734 gtk_clist_set_column_justification(GTK_CLIST(clist), 6, GTK_JUSTIFY_RIGHT);
735 /* gtk_clist_set_column_justification(GTK_CLIST(clist), 7, GTK_JUSTIFY_CENTER);*/
738 rtpstream_on_unselect(NULL, NULL);
740 rtp_stream_dlg = rtpstream_dlg_w;
744 /****************************************************************************/
746 /****************************************************************************/
748 /****************************************************************************/
749 /* update the contents of the dialog box clist */
750 /* list: pointer to list of rtp_stream_info_t* */
751 void rtpstream_dlg_update(GList *list)
753 if (rtp_stream_dlg != NULL) {
754 gtk_clist_clear(GTK_CLIST(clist));
756 list = g_list_first(list);
759 add_to_clist((rtp_stream_info_t*)(list->data));
760 list = g_list_next(list);
763 rtpstream_on_unselect(NULL, NULL);
770 /****************************************************************************/
771 /* update the contents of the dialog box clist */
772 /* list: pointer to list of rtp_stream_info_t* */
773 void rtpstream_dlg_show(GList *list)
775 if (rtp_stream_dlg != NULL) {
776 /* There's already a dialog box; reactivate it. */
777 reactivate_window(rtp_stream_dlg);
778 /* Another list since last call? */
779 if (list != last_list) {
780 rtpstream_dlg_update(list);
784 /* Create and show the dialog box */
785 rtpstream_dlg_create();
786 rtpstream_dlg_update(list);
787 gtk_widget_show(rtp_stream_dlg);
792 /****************************************************************************/
793 /* entry point when called via the GTK menu */
794 void rtpstream_launch(GtkWidget *w _U_, gpointer data _U_)
796 /* Show the dialog box */
797 rtpstream_dlg_show(rtpstream_get_info()->strinfo_list);
800 /****************************************************************************/
802 register_tap_menu_rtp_stream(void)
804 register_tap_menu_item("Statistics/RTP Streams/Show All...",
805 rtpstream_launch, NULL, NULL);