aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2008-06-24 03:38:15 +0000
committerGuy Harris <guy@alum.mit.edu>2008-06-24 03:38:15 +0000
commitf441b8941eee0a6878500e95557d136f4c63e9a4 (patch)
tree85804bf42e519f493c87fe87e821d9c3cedfbec4
parentf8b78637532b77b7feabadea280ca900f7a72292 (diff)
Add gtk/capture_globals.h, to declare global_capture_opts, so files that
don't need global_capture_opts don't need to have it declared and thus don't need capture_options defined. Include gtk/capture_globals in the files in question. Change some more capture_opts references to refer to global_capture_opts. Change some global_capture_opts references in routines with a capture_opts argument to refer to capture_opts. The structure type is capture_options, not capture_opts; fix some references. Include <sys/types.h>, if it's present, in capture_opts.h, so we get gid_t defined. Clean up indentation. svn path=/trunk/; revision=25574
-rw-r--r--capture_info.c2
-rw-r--r--capture_info.h5
-rw-r--r--capture_opts.h4
-rw-r--r--gtk/Makefile.common1
-rw-r--r--gtk/capture_dlg.c1
-rw-r--r--gtk/capture_globals.h30
-rw-r--r--gtk/capture_if_dlg.c1
-rw-r--r--gtk/capture_info_dlg.c4
-rw-r--r--gtk/drag_and_drop.c5
-rw-r--r--gtk/main.h4
-rw-r--r--gtk/main_statusbar.c13
-rw-r--r--gtk/main_welcome.c21
-rw-r--r--gtk/summary_dlg.c3
13 files changed, 66 insertions, 28 deletions
diff --git a/capture_info.c b/capture_info.c
index 3a3c092e3e..9b7a51ea05 100644
--- a/capture_info.c
+++ b/capture_info.c
@@ -74,7 +74,7 @@ info_data_t info_data;
/* open the info */
-void capture_info_open(capture_opts *capture_opts)
+void capture_info_open(capture_options *capture_opts)
{
info_data.counts.total = 0;
info_data.counts.sctp = 0;
diff --git a/capture_info.h b/capture_info.h
index 6943314c0f..29df790178 100644
--- a/capture_info.h
+++ b/capture_info.h
@@ -32,9 +32,10 @@
#ifndef __CAPTURE_INFO_H__
#define __CAPTURE_INFO_H__
+#include "capture_opts.h"
/* open the info - init values (wtap, counts), create dialog */
-extern void capture_info_open(capture_opts *capture_opts);
+extern void capture_info_open(capture_options *capture_opts);
/* new file arrived - (eventually close old wtap), open wtap */
extern gboolean capture_info_new_file(const char *new_filename);
@@ -62,7 +63,7 @@ typedef struct {
/** Create the capture info dialog */
extern void capture_info_ui_create(
capture_info *cinfo,
-capture_opts *capture_opts);
+capture_options *capture_opts);
/** Update the capture info counters in the dialog */
extern void capture_info_ui_update(
diff --git a/capture_opts.h b/capture_opts.h
index 6d86c41d83..0ce50a2f88 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -32,6 +32,10 @@
#ifndef __CAPTURE_OPTS_H__
#define __CAPTURE_OPTS_H__
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h> /* for gid_t */
+#endif
+
/* Current state of capture engine. XXX - differentiate states */
typedef enum {
diff --git a/gtk/Makefile.common b/gtk/Makefile.common
index 11c0f2433e..c9048d0ceb 100644
--- a/gtk/Makefile.common
+++ b/gtk/Makefile.common
@@ -205,6 +205,7 @@ noinst_HEADERS = \
airpcap_gui_utils.h \
capture_dlg.h \
capture_file_dlg.h \
+ capture_globals.h \
cfilter_combo_utils.h \
color_dlg.h \
color_edit_dlg.h \
diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c
index ebfc7e5adb..c71a4c14df 100644
--- a/gtk/capture_dlg.c
+++ b/gtk/capture_dlg.c
@@ -67,6 +67,7 @@
#include "gtk/capture_file_dlg.h"
#include "gtk/help_dlg.h"
#include "gtk/gtkglobals.h"
+#include "gtk/capture_globals.h"
#include "gtk/cfilter_combo_utils.h"
#ifdef _WIN32
diff --git a/gtk/capture_globals.h b/gtk/capture_globals.h
new file mode 100644
index 0000000000..9482557079
--- /dev/null
+++ b/gtk/capture_globals.h
@@ -0,0 +1,30 @@
+/* capture_globals.h
+ * Capture-related globals.
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __CAPTURE_GLOBALS_H__
+#define __CAPTURE_GLOBALS_H__
+
+extern capture_options global_capture_opts;
+
+#endif /* __CAPTURE_GLOBALS_H__ */
diff --git a/gtk/capture_if_dlg.c b/gtk/capture_if_dlg.c
index 70f088ff14..6c40b60b7f 100644
--- a/gtk/capture_if_dlg.c
+++ b/gtk/capture_if_dlg.c
@@ -60,6 +60,7 @@
#include "gtk/help_dlg.h"
#include "gtk/keys.h"
#include "gtk/webbrowser.h"
+#include "gtk/capture_globals.h"
#ifdef HAVE_AIRPCAP
#include "../image/toolbar/capture_airpcap_16.xpm"
diff --git a/gtk/capture_info_dlg.c b/gtk/capture_info_dlg.c
index 68e7958542..5a47567a53 100644
--- a/gtk/capture_info_dlg.c
+++ b/gtk/capture_info_dlg.c
@@ -91,7 +91,7 @@ pct(gint num, gint denom) {
static gboolean
capture_info_delete_cb(GtkWidget *w _U_, GdkEvent *event _U_, gpointer data) {
- capture_opts *capture_opts = data;
+ capture_options *capture_opts = data;
#ifdef HAVE_AIRPCAP
airpcap_set_toolbar_stop_capture(airpcap_if_active);
#endif
@@ -119,7 +119,7 @@ capture_info_ui_update_cb(gpointer data)
/* will keep pointers to the fields in the counts parameter */
void capture_info_ui_create(
capture_info *cinfo,
-capture_opts *capture_opts)
+capture_options *capture_opts)
{
unsigned int i;
GtkWidget *main_vb, *stop_bt, *counts_tb;
diff --git a/gtk/drag_and_drop.c b/gtk/drag_and_drop.c
index 87dddd8e28..9232a71c98 100644
--- a/gtk/drag_and_drop.c
+++ b/gtk/drag_and_drop.c
@@ -49,6 +49,7 @@
#include "gtk/drag_and_drop.h"
#include "gtk/main.h"
#include "gtk/main_menu.h"
+#include "gtk/capture_globals.h"
enum { DND_TARGET_STRING, DND_TARGET_ROOTWIN, DND_TARGET_URL };
@@ -306,7 +307,7 @@ dnd_data_received(GtkWidget *widget _U_, GdkDragContext *dc _U_, gint x _U_, gin
GtkSelectionData *selection_data, guint info, guint t _U_, gpointer data _U_)
{
gpointer dialog;
- gchar *cf_names_freeme;
+ gchar *cf_names_freeme;
if (info == DND_TARGET_URL) {
/* Usually we block incoming events by disabling the corresponding menu/toolbar items.
@@ -316,7 +317,7 @@ GtkSelectionData *selection_data, guint info, guint t _U_, gpointer data _U_)
#ifdef HAVE_LIBPCAP
/* if a capture is running, do nothing but warn the user */
- if((capture_opts->state != CAPTURE_STOPPED)) {
+ if((global_capture_opts.state != CAPTURE_STOPPED)) {
dialog = simple_dialog(ESD_TYPE_CONFIRMATION,
ESD_BTN_OK,
"%sDrag and Drop currently not possible!%s\n\n"
diff --git a/gtk/main.h b/gtk/main.h
index a53f2fafe0..40442bfee0 100644
--- a/gtk/main.h
+++ b/gtk/main.h
@@ -332,10 +332,6 @@ extern void prefs_to_capture_opts(void);
/** Change configuration profile */
extern void change_configuration_profile(const gchar *profile_name);
-#ifdef HAVE_LIBPCAP
-extern capture_opts global_capture_opts;
-#endif
-
extern GtkWidget *pkt_scrollw;
#endif /* __MAIN_H__ */
diff --git a/gtk/main_statusbar.c b/gtk/main_statusbar.c
index 97fb207bfd..da1e2eddb8 100644
--- a/gtk/main_statusbar.c
+++ b/gtk/main_statusbar.c
@@ -48,6 +48,7 @@
#include "gtk/main_statusbar.h"
#include "gtk/gui_utils.h"
#include "gtk/gtkglobals.h"
+#include "gtk/capture_globals.h"
#include "gtk/expert_comp_dlg.h"
#include "gtk/profile_dlg.h"
@@ -578,13 +579,13 @@ statusbar_cf_live_capture_update_started_cb(capture_options *capture_opts)
statusbar_pop_file_msg();
- if(global_capture_opts.iface) {
+ if(capture_opts->iface) {
capture_msg = g_strdup_printf(" %s: <live capture in progress> to file: %s",
- get_iface_description(&global_capture_opts),
- (global_capture_opts.save_file) ? global_capture_opts.save_file : "");
+ get_iface_description(capture_opts),
+ (capture_opts->save_file) ? capture_opts->save_file : "");
} else {
capture_msg = g_strdup_printf(" <live capture in progress> to file: %s",
- (global_capture_opts.save_file) ? global_capture_opts.save_file : "");
+ (capture_opts->save_file) ? capture_opts->save_file : "");
}
statusbar_push_file_msg(capture_msg);
@@ -639,8 +640,8 @@ statusbar_cf_live_capture_fixed_started_cb(capture_options *capture_opts)
statusbar_pop_file_msg();
capture_msg = g_strdup_printf(" %s: <live capture in progress> to file: %s",
- get_iface_description(&global_capture_opts),
- (global_capture_opts.save_file) ? global_capture_opts.save_file : "");
+ get_iface_description(capture_opts),
+ (capture_opts->save_file) ? capture_opts->save_file : "");
statusbar_push_file_msg(capture_msg);
gtk_statusbar_push(GTK_STATUSBAR(packets_bar), packets_ctx, " Packets: 0");
diff --git a/gtk/main_welcome.c b/gtk/main_welcome.c
index fff8c96085..676747796b 100644
--- a/gtk/main_welcome.c
+++ b/gtk/main_welcome.c
@@ -53,6 +53,7 @@
#include "gtk/capture_file_dlg.h"
#include "gtk/help_dlg.h"
#include "gtk/stock_icons.h"
+#include "gtk/capture_globals.h"
#include "../image/wssplash.xpm"
@@ -458,20 +459,20 @@ main_welcome_add_recent_capture_files(const char *widget_cf_name)
static gboolean
welcome_if_press_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer data)
{
- if (capture_opts->iface)
- g_free(capture_opts->iface);
- if (capture_opts->iface_descr)
- g_free(capture_opts->iface_descr);
+ if (global_capture_opts.iface)
+ g_free(global_capture_opts.iface);
+ if (global_capture_opts.iface_descr)
+ g_free(global_capture_opts.iface_descr);
- capture_opts->iface = g_strdup(data);
- capture_opts->iface_descr = NULL;
+ global_capture_opts.iface = g_strdup(data);
+ global_capture_opts.iface_descr = NULL;
/* XXX - fix this */
- /*capture_opts->iface_descr = get_interface_descriptive_name(capture_opts->iface);*/
+ /*global_capture_opts.iface_descr = get_interface_descriptive_name(global_capture_opts.iface);*/
/* XXX - remove this? */
- if (capture_opts->save_file) {
- g_free(capture_opts->save_file);
- capture_opts->save_file = NULL;
+ if (global_capture_opts.save_file) {
+ g_free(global_capture_opts.save_file);
+ global_capture_opts.save_file = NULL;
}
capture_start_cb(NULL, NULL);
diff --git a/gtk/summary_dlg.c b/gtk/summary_dlg.c
index 628ddf30bc..f6a2db7f29 100644
--- a/gtk/summary_dlg.c
+++ b/gtk/summary_dlg.c
@@ -44,6 +44,7 @@
#ifdef HAVE_LIBPCAP
#include "../capture.h"
#include "gtk/main.h"
+#include "gtk/capture_globals.h"
#endif
#include "gtk/summary_dlg.h"
@@ -124,7 +125,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
/* initial computations */
summary_fill_in(&cfile, &summary);
#ifdef HAVE_LIBPCAP
- summary_fill_in_capture(capture_opts, &summary);
+ summary_fill_in_capture(&global_capture_opts, &summary);
#endif
seconds = summary.stop_time - summary.start_time;
disp_seconds = summary.filtered_stop - summary.filtered_start;