ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Wireshark-qt : Capture Interfaces

From: Christopher Maynard <Christopher.Maynard@xxxxxxxxx>
Date: Tue, 26 Nov 2013 15:58:53 +0000 (UTC)
Alexis La Goutte <alexis.lagoutte@...> writes:

> Hi,
> I push yesterday the work of Thomas (GSoC'13 Students) about add captures
interfaces window dialog for Wireshark-qt.
> 
> It is a first "draft" of new captures interfaces,  only display the list
of interface and select for launch capture, options don't (yet) work.
> 
> We would like your comments / opinion / review... (and also patch !) about
this new dialog window.The idea is replace "Interface list" and (big)
Capture options  by only 1 window/dialog.
> 
> For people, who don't have Qt in your machine, i attach a screenshot of GUI.
> 
> Regards,Alexis

Maybe the snaplen column should display the actual snaplen value instead of
“default”?  The GTK version does this too, which I’m also not a fan of, as
“default” doesn’t actually tell you anything.  To that point, I would
propose applying the patch below (for GTK) unless there are any objections?

Also, there’s an “Add pipe” button, so presumably there would also be an
“Add remote interface” button as well?

How are other local interfaces that can come and go, such as USB interfaces
handled?  Should there be a "Refresh"?

- Chris


Index: ui/gtk/capture_dlg.c
===================================================================
--- ui/gtk/capture_dlg.c        (revision 53598)
+++ ui/gtk/capture_dlg.c        (working copy)
@@ -1372,11 +1372,7 @@
     device.selected = TRUE;
     global_capture_opts.num_selected++;
     g_array_append_val(global_capture_opts.all_ifaces, device);
-    if (device.has_snaplen) {
-      snaplen_string = g_strdup_printf("%d", device.snaplen);
-    } else {
-      snaplen_string = g_strdup("default");
-    }
+    snaplen_string = g_strdup_printf("%d", device.snaplen);

 #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);
@@ -2427,11 +2423,7 @@
     }
     if (!linkname)
       linkname = g_strdup("unknown");
-    if (device.has_snaplen) {
-      snaplen_string = g_strdup_printf("%d", device.snaplen);
-    } else {
-      snaplen_string = g_strdup("default");
-    }
+    snaplen_string = g_strdup_printf("%d", device.snaplen);
     if (cap_open_w) {
       if_cb      = (GtkTreeView *) g_object_get_data(G_OBJECT(cap_open_w),
E_CAP_IFACE_KEY);
       path_str = g_strdup_printf("%d", indx);
@@ -3363,11 +3355,7 @@
           g_array_remove_index(global_capture_opts.all_ifaces, i);
           g_array_insert_val(global_capture_opts.all_ifaces, i, device);
           temp = g_strdup_printf("<b>%s</b>", device.display_name);
-          if (device.has_snaplen) {
-            snaplen_string = g_strdup_printf("%d", device.snaplen);
-          } else {
-            snaplen_string = g_strdup("default");
-          }
+          snaplen_string = g_strdup_printf("%d", device.snaplen);
           if_cb = (GtkTreeView *) g_object_get_data(G_OBJECT(cap_open_w),
E_CAP_IFACE_KEY);
           model = gtk_tree_view_get_model(if_cb);
           if (gtk_tree_model_get_iter_first (model, &iter)) {
@@ -3500,11 +3488,7 @@
     indx = global_capture_opts.all_ifaces->len;
     temp = g_strdup_printf("<b>%s</b>", device.display_name);

-    if (device.has_snaplen) {
-      snaplen_string = g_strdup_printf("%d", device.snaplen);
-    } else {
-      snaplen_string = g_strdup("default");
-    }
+    snaplen_string = g_strdup_printf("%d", device.snaplen);

     if_cb      = (GtkTreeView *) g_object_get_data(G_OBJECT(cap_open_w),
E_CAP_IFACE_KEY);
     path_str = g_strdup_printf("%d", indx);
@@ -5723,11 +5707,7 @@
         device.has_snaplen = FALSE;
       }

-      if (device.has_snaplen) {
-        snaplen_string = g_strdup_printf("%d", device.snaplen);
-      } else {
-        snaplen_string = g_strdup("default");
-      }
+      snaplen_string = g_strdup_printf("%d", device.snaplen);

 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
       if (capture_dev_user_buffersize_find(device.name) != -1) {