Add gtk/capture_globals.h, to declare global_capture_opts, so files that
authorGuy Harris <guy@alum.mit.edu>
Tue, 24 Jun 2008 03:38:15 +0000 (03:38 -0000)
committerGuy Harris <guy@alum.mit.edu>
Tue, 24 Jun 2008 03:38:15 +0000 (03:38 -0000)
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

13 files changed:
capture_info.c
capture_info.h
capture_opts.h
gtk/Makefile.common
gtk/capture_dlg.c
gtk/capture_globals.h [new file with mode: 0644]
gtk/capture_if_dlg.c
gtk/capture_info_dlg.c
gtk/drag_and_drop.c
gtk/main.h
gtk/main_statusbar.c
gtk/main_welcome.c
gtk/summary_dlg.c

index 3a3c092e3e95dcb858283a79b2ae5e033288b5f8..9b7a51ea05c8f1356b450e7b53fbdff064a95ba4 100644 (file)
@@ -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;
index 6943314c0fc7517cb8be67a3fac47d7b32a76b82..29df7901789534228186e1337c222dd6f8093e97 100644 (file)
 #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(
index 6d86c41d83c6845783528ed42585c4c48e35194a..0ce50a2f888d7137567a64245243ba1c27e786e1 100644 (file)
 #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 {
index 11c0f2433e7e4935ea2a5e579debe936c0984093..c9048d0ceb4e073768aa1b4c850767515ec6ed9c 100644 (file)
@@ -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        \
index ebfc7e5adb4cbc4511d74acd728bafded1a0e70c..c71a4c14df4138d215b09f423fcb7bac756cf3e6 100644 (file)
@@ -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 (file)
index 0000000..9482557
--- /dev/null
@@ -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__ */
index 70f088ff14e295392ddbd4dd575855a545650306..6c40b60b7f4afcd4c5b03c81598aa5cf9ab208d1 100644 (file)
@@ -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"
index 68e79585421e1b02370aaaac7f3a05facb93b630..5a47567a535d28662b9729d3432bd07197367d6f 100644 (file)
@@ -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;
index 87dddd8e283fbfe2ce3ffcb9c4436b7e01399081..9232a71c98aef191c864611d711bf6dd59360425 100644 (file)
@@ -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"
index a53f2fafe002d1d83df65436016ebb07e2985c43..40442bfee0778af959e867ebe52468bfbc71093b 100644 (file)
@@ -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__ */
index 97fb207bfdc73b587d67aecfec1814c62730801d..da1e2eddb879bc653ab59afd1c171be4fac6e878 100644 (file)
@@ -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");
index fff8c960854f1a1c6f4bf7bd31faae3b6d0b4b84..676747796b62caddf0bc1b7f2070f73203fe6a23 100644 (file)
@@ -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);
index 628ddf30bcf2782a5b86151f1f00ed229723c16a..f6a2db7f29bfabf6b5488d7c3511ba9de677969a 100644 (file)
@@ -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;