summaryrefslogtreecommitdiff
path: root/capture_opts.h
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2007-08-22 16:30:16 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2007-08-22 16:30:16 +0000
commit2f77efce7da0a079c38609e7bd24cc69937863b1 (patch)
tree2c5d954d066dd1bc7b7b81af5e15b2ebea283dcd /capture_opts.h
parent914e885354a310ae9219a9cd42da5f1123a3acc3 (diff)
downloadwireshark-2f77efce7da0a079c38609e7bd24cc69937863b1.tar.gz
Fix bug http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1757 :
Try to call get_interface_descriptive_name() as little as possible (storing the result in capture_opts) to avoid a performance hit during live capture (especially if you have lots of interfaces) and to avoid leaking memory. One issue with this is that capture_opts.c cannot (without adding significant dependencies) set the iface_descr so readers of that field (only gtk/main.c and tshark.c) use a macro to (set if not already set and) get the value of that field. svn path=/trunk/; revision=22587
Diffstat (limited to 'capture_opts.h')
-rw-r--r--capture_opts.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/capture_opts.h b/capture_opts.h
index 8d1d5600ea..fc0c92a16c 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -48,6 +48,12 @@ typedef struct capture_options_tag {
gboolean has_cfilter; /**< TRUE if capture filter specified on command line */
gchar *cfilter; /**< Capture filter string */
gchar *iface; /**< the network interface to capture from */
+ gchar *iface_descr; /**< A human readable description of iface.
+ *< NOTE: capture_opts.c is not able to
+ *< set this field because doing so
+ *< requires too many dependencies.
+ *< Readers of this field should use
+ *< GET_IFACE_DESCR to access it. */
#ifdef _WIN32
int buffer_size; /**< the capture buffer size (MB) */
@@ -99,6 +105,14 @@ typedef struct capture_options_tag {
gboolean output_to_pipe; /**< save_file is a pipe (named or stdout) */
} capture_options;
+/* Get iface_descr (and set it if it's not set already).
+ * It is assumed the caller includes capture_ui_utils.h (ugh, but what else
+ * can we do?)
+ */
+#define GET_IFACE_DESCR(capture_opts) capture_opts->iface_descr ? \
+ capture_opts->iface_descr : \
+ capture_opts->iface_descr = get_interface_descriptive_name(capture_opts->iface)
+
/* initialize the capture_options with some reasonable values */
extern void