rework of capture.c: better seperation of sync and capture pipe by using

explicit names and seperated functionality of do_capture(),
but no functional change!

svn path=/trunk/; revision=10168
This commit is contained in:
Ulf Lamping 2004-02-21 12:58:42 +00:00
parent 9a7cac1dff
commit ba50469654
4 changed files with 365 additions and 302 deletions

631
capture.c

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* capture.h
* Definitions for packet capture windows
*
* $Id: capture.h,v 1.38 2003/11/15 08:47:28 ulfl Exp $
* $Id: capture.h,v 1.39 2004/02/21 12:58:41 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -101,10 +101,6 @@ capture_info *cinfo);
extern void capture_info_destroy(
capture_info *cinfo);
/* ui calls this, when user wants to stop capturing */
extern void capture_ui_stop_callback(
gpointer callback_data);
#endif /* HAVE_LIBPCAP */

16
file.c
View File

@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
* $Id: file.c,v 1.363 2004/02/21 02:15:05 guy Exp $
* $Id: file.c,v 1.364 2004/02/21 12:58:41 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -70,7 +70,6 @@
#include "file.h"
#include "menu.h"
#include "util.h"
#include "report_err.h"
#include "alert_box.h"
#include "simple_dialog.h"
#include "progress_dlg.h"
@ -669,14 +668,6 @@ cf_finish_tail(capture_file *cf, int *err)
XXX - pop up a dialog box? */
return (READ_ERROR);
} else {
if(cf->count == 0) {
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
"%sNo packets captured!%s\n\n"
"As no data was captured, closing the %scapture file!",
simple_dialog_primary_start(), simple_dialog_primary_end(),
(cf->is_tempfile) ? "temporary " : "");
cf_close(cf);
}
return (READ_SUCCESS);
}
}
@ -3027,7 +3018,10 @@ copy_binary_file(char *from_filename, char *to_filename)
}
}
if (nread < 0) {
report_read_failure(from_filename, errno);
err = errno;
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"An error occurred while reading from the file \"%s\": %s.",
from_filename, strerror(err));
close(from_fd);
close(to_fd);
goto done;

View File

@ -1,7 +1,7 @@
/* capture_info_dlg.c
* Routines for packet capture info dialog
*
* $Id: capture_info_dlg.c,v 1.11 2004/01/21 21:19:32 ulfl Exp $
* $Id: capture_info_dlg.c,v 1.12 2004/02/21 12:58:42 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -70,14 +70,14 @@ pct(gint num, gint denom) {
/* stop button (or ESC key) was pressed */
static void
capture_info_stop_cb(GtkWidget *w _U_, gpointer data) {
capture_ui_stop_callback(data);
capture_info_stop_cb(GtkWidget *w _U_, gpointer data _U_) {
capture_stop();
}
static void
capture_info_delete_cb(GtkWidget *w _U_, GdkEvent *event _U_, gpointer data) {
capture_ui_stop_callback(data);
capture_info_delete_cb(GtkWidget *w _U_, GdkEvent *event _U_, gpointer data _U_) {
capture_stop();
}
@ -209,9 +209,9 @@ capture_info *cinfo)
stop_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_STOP);
gtk_widget_grab_default(stop_bt);
SIGNAL_CONNECT(stop_bt, "clicked", capture_info_stop_cb,
cinfo->callback_data);
NULL);
SIGNAL_CONNECT(info->cap_w, "delete_event", capture_info_delete_cb,
cinfo->callback_data);
NULL);
/* Catch the "key_press_event" signal in the window, so that we can catch
the ESC key being pressed and act as if the "Stop" button had