aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/capture_dlg.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui/gtk/capture_dlg.c')
-rw-r--r--ui/gtk/capture_dlg.c58
1 files changed, 25 insertions, 33 deletions
diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c
index 8ea6100f03..f8e2601aaf 100644
--- a/ui/gtk/capture_dlg.c
+++ b/ui/gtk/capture_dlg.c
@@ -86,14 +86,6 @@
#endif
/*
- * If this is WinPcap or if we have pcap_create(), we can set the
- * buffer size.
- */
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
-#define HAVE_BUFFER_SIZE
-#endif
-
-/*
* Symbolic names for column indices.
*/
enum
@@ -104,7 +96,7 @@ enum
LINK,
PMODE,
SNAPLEN,
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
BUFFER,
#endif
#ifdef HAVE_PCAP_CREATE
@@ -133,7 +125,7 @@ enum
#define E_CAP_SNAP_CB_KEY "cap_snap_cb"
#define E_CAP_LT_CBX_KEY "cap_lt_cbx"
#define E_CAP_LT_CBX_LABEL_KEY "cap_lt_cbx_label"
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
#define E_CAP_BUFFER_SIZE_SB_KEY "cap_buffer_size_sb"
#endif
#define E_CAP_SNAP_SB_KEY "cap_snap_sb"
@@ -329,7 +321,7 @@ gchar *col_index_to_name(gint indx)
break;
case SNAPLEN: col_name = g_strdup("SNAPLEN");
break;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
case BUFFER: col_name = g_strdup("BUFFER");
break;
#endif
@@ -352,7 +344,7 @@ gint col_title_to_index(const gchar *name)
if (strcmp(name, "Link-layer header") == 0) return LINK;
if (strcmp(name, "Prom. Mode") == 0) return PMODE;
if (strcmp(name, "Snaplen [B]") == 0) return SNAPLEN;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
if (strcmp(name, "Buffer [MiB]") == 0) return BUFFER;
#endif
#ifdef HAVE_PCAP_CREATE
@@ -1275,7 +1267,7 @@ insert_new_rows(GList *list)
} else {
device.display_name = g_strdup(if_string);
}
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
if ((device.buffer = capture_dev_user_buffersize_find(if_string)) == -1) {
device.buffer = global_capture_opts.default_options.buffer_size;
}
@@ -1391,7 +1383,7 @@ insert_new_rows(GList *list)
#if defined(HAVE_PCAP_CREATE)
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, FALSE, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, link_type_name, PMODE, (device.pmode?"enabled":"disabled"), SNAPLEN, snaplen_string, BUFFER, device.buffer, MONITOR, "no",FILTER, "",-1);
-#elif defined(HAVE_BUFFER_SIZE)
+#elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, FALSE, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, link_type_name, PMODE, (device.pmode?"enabled":"disabled"), SNAPLEN, snaplen_string, BUFFER, device.buffer, FILTER, "",-1);
#else
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, FALSE, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, link_type_name, PMODE, (device.pmode?"enabled":"disabled"), SNAPLEN, snaplen_string, -1);
@@ -2357,7 +2349,7 @@ update_options_table(gint indx)
}
#if defined(HAVE_PCAP_CREATE)
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname, PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, MONITOR, device.monitor_mode_supported?(device.monitor_mode_enabled?"enabled":"disabled"):"n/a", FILTER, device.cfilter, -1);
- #elif defined(HAVE_BUFFER_SIZE)
+ #elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, linkname, PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, FILTER, device.cfilter, -1);
#else
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, linkname, PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, device.cfilter, -1);
@@ -2396,7 +2388,7 @@ save_options_cb(GtkWidget *win _U_, gpointer user_data _U_)
*monitor_cb,
#endif
*filter_cm, *linktype_combo_box;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
GtkWidget *buffer_size_sb;
#endif
#ifdef HAVE_EXTCAP
@@ -2412,7 +2404,7 @@ save_options_cb(GtkWidget *win _U_, gpointer user_data _U_)
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, marked_interface);
snap_cb = (GtkWidget *) g_object_get_data(G_OBJECT(opt_edit_w), E_CAP_SNAP_CB_KEY);
snap_sb = (GtkWidget *) g_object_get_data(G_OBJECT(opt_edit_w), E_CAP_SNAP_SB_KEY);
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
buffer_size_sb = (GtkWidget *) g_object_get_data(G_OBJECT(opt_edit_w), E_CAP_BUFFER_SIZE_SB_KEY);
#endif
promisc_cb = (GtkWidget *) g_object_get_data(G_OBJECT(opt_edit_w), E_CAP_PROMISC_KEY);
@@ -2439,7 +2431,7 @@ save_options_cb(GtkWidget *win _U_, gpointer user_data _U_)
}
}
device.active_dlt = dlt;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
device.buffer = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffer_size_sb));
#endif
device.pmode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(promisc_cb));
@@ -2548,12 +2540,12 @@ static GtkWidget *build_extcap_options(const gchar *name, GHashTable *hash) {
* We avoid having the right column if we don't need it, because it
* steals 3 pixels.
*/
-#if defined(HAVE_AIRPCAP) || defined(HAVE_PCAP_REMOTE) || defined(HAVE_BUFFER_SIZE)
+#if defined(HAVE_AIRPCAP) || defined(HAVE_PCAP_REMOTE) || defined(CAN_SET_CAPTURE_BUFFER_SIZE)
#define HAVE_TWO_SETTING_COLUMNS
# if !defined(HAVE_PCAP_REMOTE)
# define BUFFER_SIZE_IN_RIGHT_COLUMN
# endif /* !defined(HAVE_PCAP_REMOTE) */
-#endif /* defined(HAVE_AIRPCAP) || defined(HAVE_PCAP_REMOTE) || defined(HAVE_BUFFER_SIZE) */
+#endif /* defined(HAVE_AIRPCAP) || defined(HAVE_PCAP_REMOTE) || defined(CAN_SET_CAPTURE_BUFFER_SIZE) */
void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column _U_, gpointer userdata)
{
@@ -2584,7 +2576,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
GList *cf_entry, *list, *cfilter_list;
GtkAdjustment *snap_adj;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
GtkAdjustment *buffer_size_adj;
GtkWidget *buffer_size_lb, *buffer_size_sb, *buffer_size_hb;
#endif
@@ -2631,7 +2623,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
device.has_snaplen = FALSE;
device.snaplen = 65535;
device.cfilter = NULL;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
device.buffer = DEFAULT_CAPTURE_BUFFER_SIZE;
#endif
#ifdef HAVE_EXTCAP
@@ -2943,7 +2935,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
gtk_box_pack_start(GTK_BOX(filter_hb), compile_bt, FALSE, FALSE, 3);
#endif
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
buffer_size_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3, FALSE);
buffer_size_lb = gtk_label_new("Buffer size:");
gtk_box_pack_start (GTK_BOX(buffer_size_hb), buffer_size_lb, FALSE, FALSE, 0);
@@ -2966,7 +2958,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
#else /* BUFFER_SIZE_IN_RIGHT_COLUMN */
gtk_box_pack_start (GTK_BOX(left_vb), buffer_size_hb, FALSE, FALSE, 0);
#endif /* BUFFER_SIZE_IN_RIGHT_COLUMN */
-#endif /* HAVE_BUFFER_SIZE */
+#endif /* CAN_SET_CAPTURE_BUFFER_SIZE */
#ifdef HAVE_PCAP_REMOTE
/*
@@ -3369,7 +3361,7 @@ static void change_pipe_name_cb(gpointer dialog _U_, gint btn, gpointer data)
if (strcmp(optname, pipe_name) == 0) {
#if defined(HAVE_PCAP_CREATE)
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, "", PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, MONITOR, device.monitor_mode_supported?(device.monitor_mode_enabled?"enabled":"disabled"):"n/a", FILTER, device.cfilter, -1);
-#elif defined(HAVE_BUFFER_SIZE)
+#elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, "", PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, FILTER, device.cfilter, -1);
#else
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, "", PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, device.cfilter, -1);
@@ -3477,7 +3469,7 @@ add_pipe_cb(gpointer w _U_)
device.no_addresses = 0;
device.last_packets = 0;
device.links = NULL;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
device.buffer = DEFAULT_CAPTURE_BUFFER_SIZE;
#endif
device.active_dlt = -1;
@@ -3507,7 +3499,7 @@ add_pipe_cb(gpointer w _U_)
gtk_list_store_append (GTK_LIST_STORE(model), &iter);
#if defined(HAVE_PCAP_CREATE)
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, "", PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, MONITOR, device.monitor_mode_supported?(device.monitor_mode_enabled?"enabled":"disabled"):"n/a", FILTER, device.cfilter, -1);
-#elif defined(HAVE_BUFFER_SIZE)
+#elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, "", PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, FILTER, device.cfilter, -1);
#else
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, "", PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, device.cfilter, -1);
@@ -4724,7 +4716,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_tree_view_column_set_visible(column, FALSE);
g_object_set(renderer, "xalign", 0.5f, NULL);
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes("Buffer [MiB]", renderer, "text", BUFFER, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
@@ -5663,7 +5655,7 @@ create_and_fill_model(GtkTreeView *view)
guint i;
link_row *linkr = NULL;
interface_t device;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
gint buffer;
#endif
gint snaplen;
@@ -5671,7 +5663,7 @@ create_and_fill_model(GtkTreeView *view)
#if defined(HAVE_PCAP_CREATE)
store = gtk_list_store_new (9, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
-#elif defined(HAVE_BUFFER_SIZE)
+#elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
store = gtk_list_store_new (8, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
#else
store = gtk_list_store_new (7, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
@@ -5712,7 +5704,7 @@ create_and_fill_model(GtkTreeView *view)
snaplen_string = g_strdup_printf("%d", device.snaplen);
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
if (capture_dev_user_buffersize_find(device.name) != -1) {
buffer = capture_dev_user_buffersize_find(device.name);
device.buffer = buffer;
@@ -5725,7 +5717,7 @@ create_and_fill_model(GtkTreeView *view)
gtk_list_store_append (store, &iter);
#if defined(HAVE_PCAP_CREATE)
gtk_list_store_set (store, &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname, PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, MONITOR, device.monitor_mode_supported?(device.monitor_mode_enabled?"enabled":"disabled"):"n/a", FILTER, device.cfilter, -1);
-#elif defined(HAVE_BUFFER_SIZE)
+#elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
gtk_list_store_set (store, &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname, PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, FILTER, device.cfilter, -1);
#else
gtk_list_store_set (store, &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname, PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, device.cfilter, -1);
@@ -5780,7 +5772,7 @@ query_tooltip_tree_view_cb (GtkWidget *widget,
case SNAPLEN: g_snprintf(buffer, sizeof(buffer), "Limit the maximum number of bytes to be captured from each packet. This size includes the "
"link-layer header and all subsequent headers.");
break;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
case BUFFER: g_snprintf (buffer, sizeof(buffer), "The memory buffer size used while capturing. "
"If you notice packet drops, you can try increasing this size.");
break;