/* rtp_analysis.c
* RTP analysis addition for ethereal
*
- * $Id: rtp_analysis.c,v 1.31 2004/01/31 09:48:26 guy Exp $
+ * $Id: rtp_analysis.c,v 1.38 2004/02/22 18:44:03 ulfl Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
#include "../graph/graph.h"
#endif
+#include <epan/epan_dissect.h>
+#include <epan/filesystem.h>
+
#include "util.h"
-#include "epan/epan_dissect.h"
-#include "epan/filesystem.h"
#include "tap.h"
#include "register.h"
#include "packet-rtp.h"
/* in /gtk ... */
#include "dlg_utils.h"
#include "ui_util.h"
+#include "alert_box.h"
#include "simple_dialog.h"
-#include "menu.h"
+#include "tap_menu.h"
#include "main.h"
#include "progress_dlg.h"
#include "compat_macros.h"
/* try to compile the filter. */
strcpy(filter_text,"rtp && ip");
if (!dfilter_compile(filter_text, &sfcode)) {
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK, dfilter_error_msg);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, dfilter_error_msg);
return;
}
error_string = register_tap_listener("rtp", user_data, filter_text,
rtp_reset, rtp_packet, rtp_draw);
if (error_string != NULL) {
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK, error_string->str);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str);
g_string_free(error_string, TRUE);
return;
}
if (GTK_TOGGLE_BUTTON(forw)->active || GTK_TOGGLE_BUTTON(both)->active) {
fp = fopen(g_dest, "w");
if (fp == NULL) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- file_open_error_message(errno, TRUE), g_dest);
+ open_failure_alert_box(g_dest, errno, TRUE);
return;
}
if (GTK_TOGGLE_BUTTON(both)->active) {
fprintf(fp, "Forward\n");
if (ferror(fp)) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- file_write_error_message(errno), g_dest);
+ write_failure_alert_box(g_dest, errno);
fclose(fp);
return;
}
}
fprintf(fp,"\n");
if (ferror(fp)) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- file_write_error_message(errno), g_dest);
+ write_failure_alert_box(g_dest, errno);
fclose(fp);
return;
}
}
fprintf(fp,"\n");
if (ferror(fp)) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- file_write_error_message(errno), g_dest);
+ write_failure_alert_box(g_dest, errno);
fclose(fp);
return;
}
}
if (fclose(fp) == EOF) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- file_write_error_message(errno), g_dest);
+ write_failure_alert_box(g_dest, errno);
return;
}
}
if (GTK_TOGGLE_BUTTON(both)->active) {
fp = fopen(g_dest, "a");
if (fp == NULL) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- file_open_error_message(errno, TRUE),
- g_dest);
+ open_failure_alert_box(g_dest, errno, TRUE);
return;
}
fprintf(fp, "\nReverse\n");
if (ferror(fp)) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- file_write_error_message(errno), g_dest);
+ write_failure_alert_box(g_dest, errno);
fclose(fp);
return;
}
} else {
fp = fopen(g_dest, "w");
if (fp == NULL) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- file_open_error_message(errno, TRUE),
- g_dest);
+ open_failure_alert_box(g_dest, errno, TRUE);
return;
}
}
}
fprintf(fp,"\n");
if (ferror(fp)) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- file_write_error_message(errno), g_dest);
+ write_failure_alert_box(g_dest, errno);
fclose(fp);
return;
}
}
fprintf(fp,"\n");
if (ferror(fp)) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- file_write_error_message(errno), g_dest);
+ write_failure_alert_box(g_dest, errno);
fclose(fp);
return;
}
}
if (fclose(fp) == EOF) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- file_write_error_message(errno), g_dest);
+ write_failure_alert_box(g_dest, errno);
return;
}
}
/* there are many combinations here, we just exit when first matches */
if ((user_data->forward.saveinfo.error_type == TAP_RTP_WRONG_CODEC) ||
(user_data->reversed.saveinfo.error_type == TAP_RTP_WRONG_CODEC))
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save in a file: Unsupported codec!");
else if ((user_data->forward.saveinfo.error_type == TAP_RTP_WRONG_LENGTH) ||
(user_data->reversed.saveinfo.error_type == TAP_RTP_WRONG_LENGTH))
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save in a file: Wrong length of captured packets!");
else if ((user_data->forward.saveinfo.error_type == TAP_RTP_PADDING_ERROR) ||
(user_data->reversed.saveinfo.error_type == TAP_RTP_PADDING_ERROR))
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save in a file: RTP data with padding!");
else if ((user_data->forward.saveinfo.error_type == TAP_RTP_SHORT_FRAME) ||
(user_data->reversed.saveinfo.error_type == TAP_RTP_SHORT_FRAME))
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save in a file: Not all data in all packets was captured!");
else
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save in a file: File I/O problem!");
return;
}
else if ((user_data->forward.saveinfo.saved == FALSE) && ((GTK_TOGGLE_BUTTON (forw)->active) ||
(GTK_TOGGLE_BUTTON (both)->active))) {
if (user_data->forward.saveinfo.error_type == TAP_RTP_WRONG_CODEC)
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save forward direction in a file: Unsupported codec!");
else if (user_data->forward.saveinfo.error_type == TAP_RTP_WRONG_LENGTH)
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save forward direction in a file: Wrong length of captured packets!");
else if (user_data->forward.saveinfo.error_type == TAP_RTP_PADDING_ERROR)
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save forward direction in a file: RTP data with padding!");
else if (user_data->forward.saveinfo.error_type == TAP_RTP_SHORT_FRAME)
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save forward direction in a file: Not all data in all packets was captured!");
else
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save forward direction in a file: File I/O problem!");
return;
}
else if ((user_data->reversed.saveinfo.saved == FALSE) && ((GTK_TOGGLE_BUTTON (rev)->active) ||
(GTK_TOGGLE_BUTTON (both)->active))) {
if (user_data->reversed.saveinfo.error_type == TAP_RTP_WRONG_CODEC)
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save reversed direction in a file: Unsupported codec!");
else if (user_data->reversed.saveinfo.error_type == TAP_RTP_WRONG_LENGTH)
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save reversed direction in a file: Wrong length of captured packets!");
else if (user_data->reversed.saveinfo.error_type == TAP_RTP_PADDING_ERROR)
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save reversed direction in a file: RTP data with padding!");
else if (user_data->forward.saveinfo.error_type == TAP_RTP_SHORT_FRAME)
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save reversed direction in a file: Not all data in all packets was captured!");
else if (user_data->reversed.saveinfo.error_type == TAP_RTP_NO_DATA)
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save reversed direction in a file: No RTP data!");
else
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't save reversed direction in a file: File I/O problem!");
return;
}
if(!copy_file(g_dest, channels/*, format*/, user_data)) {
/* XXX - report the error type! */
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"An error occured while saving voice in a file!");
return;
}
column_arrows *col_arrows_rev;
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window), "Ethereal: RTP Stream Analysis");
+ window = window_new (GTK_WINDOW_TOPLEVEL, "Ethereal: RTP Stream Analysis");
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
SIGNAL_CONNECT(window, "destroy", on_destroy, user_data);
gtk_box_pack_end(GTK_BOX(page), label_stats_fwd, FALSE, FALSE, 0);
/* scrolled window */
- scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+ scrolled_window = scrolled_window_new(NULL, NULL);
WIDGET_SET_SIZE(scrolled_window, 560, 200);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
/* packet clist */
clist_fwd = create_clist(user_data);
label_stats_rev = gtk_label_new("\n");
gtk_box_pack_end(GTK_BOX(page_r), label_stats_rev, FALSE, FALSE, 0);
- scrolled_window_r = gtk_scrolled_window_new(NULL, NULL);
+ scrolled_window_r = scrolled_window_new(NULL, NULL);
WIDGET_SET_SIZE(scrolled_window_r, 560, 200);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window_r),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
clist_rev = create_clist(user_data);
gtk_widget_show(clist_rev);
/* Try to compile the filter. */
strcpy(filter_text,"rtp && ip");
if (!dfilter_compile(filter_text, &sfcode)) {
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
- dfilter_error_msg);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, dfilter_error_msg);
return;
}
/* we load the current file into cf variable */
/* dissect the current frame */
if (!wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header,
cf->pd, fdata->cap_len, &err, &err_info)) {
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
cf_read_error_message(err, err_info), cf->filename);
return;
}
frame_matched = dfilter_apply_edt(sfcode, edt);
if (frame_matched != 1) {
epan_dissect_free(edt);
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"You didn't choose a RTP packet!");
return;
}
/* now we need the SSRC value of the current frame */
if (!get_int_value_from_proto_tree(edt->tree, "rtp", "rtp.ssrc", &ssrc_fwd)) {
- simple_dialog(ESD_TYPE_ERROR | ESD_TYPE_MODAL, ESD_BTN_OK,
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"SSRC value couldn't be found!");
return;
}
register_tap_listener_rtp_analysis(void)
{
register_ethereal_tap("rtp", rtp_analysis_init);
-}
-void
-register_tap_menu_rtp_analysis(void)
-{
- register_tap_menu_item("_Statistics/RTP Streams/Analyse...",
+ register_tap_menu_item("RTP/Stream Analysis...", REGISTER_TAP_LAYER_APPLICATION,
rtp_analysis_cb, NULL, NULL, NULL);
}