summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-07-04 00:24:02 -0700
committerGuy Harris <guy@alum.mit.edu>2014-07-04 07:25:26 +0000
commit9e6487f24751d1c1a047ee82e158077ac67c9c68 (patch)
tree3cc4a8524062948f4951914dc9af489e0d7c4572 /ui
parentc5643a3d257909ed3e8752cd729b9192ae719683 (diff)
downloadwireshark-9e6487f24751d1c1a047ee82e158077ac67c9c68.tar.gz
Move utility routines for capturing into a libcaputils static library.
Some of those routines are used only in dumpcap; others are used in TShark and Wireshark as well. Change-Id: I9d92483f2fcff57a7d8b6bf6bdf2870505d19fb7 Reviewed-on: https://code.wireshark.org/review/2841 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui')
-rw-r--r--ui/capture.c6
-rw-r--r--ui/capture_ui_utils.c2
-rw-r--r--ui/gtk/capture_dlg.c4
-rw-r--r--ui/gtk/capture_if_details_dlg_win32.c4
-rw-r--r--ui/gtk/capture_if_dlg.c6
-rw-r--r--ui/gtk/capture_if_dlg.h2
-rw-r--r--ui/gtk/capture_info_dlg.c2
-rw-r--r--ui/gtk/main.c55
-rw-r--r--ui/gtk/main_80211_toolbar.c2
-rw-r--r--ui/gtk/main_welcome.c2
-rw-r--r--ui/gtk/prefs_capture.c2
-rw-r--r--ui/gtk/prefs_dlg.c2
-rw-r--r--ui/gtk/summary_dlg.c2
-rw-r--r--ui/qt/QtShark.pro13
-rw-r--r--ui/qt/interface_tree.h2
-rw-r--r--ui/qt/main.cpp55
-rw-r--r--ui/qt/main_window.cpp2
-rw-r--r--ui/qt/main_window_slots.cpp2
-rw-r--r--ui/qt/preferences_dialog.cpp2
-rw-r--r--ui/qt/summary_dialog.h2
20 files changed, 51 insertions, 118 deletions
diff --git a/ui/capture.c b/ui/capture.c
index 9665bcb340..6ae268e90b 100644
--- a/ui/capture.c
+++ b/ui/capture.c
@@ -38,16 +38,16 @@
#include <epan/dfilter/dfilter.h>
#include "file.h"
#include "ui/capture.h"
-#include <capchild/capture_ifinfo.h>
+#include "caputils/capture_ifinfo.h"
#include <capchild/capture_sync.h>
#include "capture_info.h"
#include "ui/capture_ui_utils.h"
#include "ui/util.h"
-#include "capture-pcap-util.h"
+#include "caputils/capture-pcap-util.h"
#include <epan/prefs.h>
#ifdef _WIN32
-#include "capture-wpcap.h"
+#include "caputils/capture-wpcap.h"
#endif
#include "ui/simple_dialog.h"
diff --git a/ui/capture_ui_utils.c b/ui/capture_ui_utils.c
index 2970ddd5e9..23de71f716 100644
--- a/ui/capture_ui_utils.c
+++ b/ui/capture_ui_utils.c
@@ -32,7 +32,7 @@
#include "epan/prefs.h"
#include "epan/ex-opt.h"
-#include <capchild/capture_ifinfo.h>
+#include "caputils/capture_ifinfo.h"
#include "ui/capture_ui_utils.h"
#include "wiretap/wtap.h"
#include "epan/to_str.h"
diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c
index e43d168f68..832ab4e399 100644
--- a/ui/gtk/capture_dlg.c
+++ b/ui/gtk/capture_dlg.c
@@ -37,8 +37,8 @@
#include <wsutil/filesystem.h>
#include "ui/capture.h"
-#include <capchild/capture_ifinfo.h>
-#include "../capture-pcap-util.h"
+#include "caputils/capture_ifinfo.h"
+#include "caputils/capture-pcap-util.h"
#include "../ringbuffer.h"
#include "ui/capture_ui_utils.h"
diff --git a/ui/gtk/capture_if_details_dlg_win32.c b/ui/gtk/capture_if_details_dlg_win32.c
index 8c8da75bcd..55a561888b 100644
--- a/ui/gtk/capture_if_details_dlg_win32.c
+++ b/ui/gtk/capture_if_details_dlg_win32.c
@@ -56,9 +56,9 @@
#include <Ntddndis.h>
#endif
-#include "capture_win_ifnames.h"
+#include "caputils/capture_win_ifnames.h"
-#include "../capture_wpcap_packet.h"
+#include "caputils/capture_wpcap_packet.h"
/* packet32.h requires sockaddr_storage
* whether sockaddr_storage is defined or not depends on the Platform SDK
diff --git a/ui/gtk/capture_if_dlg.c b/ui/gtk/capture_if_dlg.c
index f9db745edc..fee1caa59a 100644
--- a/ui/gtk/capture_if_dlg.c
+++ b/ui/gtk/capture_if_dlg.c
@@ -33,9 +33,9 @@
#include "../capture_opts.h"
#include <capchild/capture_session.h>
-#include <capchild/capture_ifinfo.h>
+#include "caputils/capture_ifinfo.h"
#include "ui/capture.h"
-#include "../capture-pcap-util.h"
+#include "caputils/capture-pcap-util.h"
#include "wsutil/file_util.h"
#include <wiretap/wtap.h>
@@ -46,7 +46,7 @@
#ifdef _WIN32
#include "ui/gtk/capture_if_details_dlg_win32.h"
-#include "../../capture-wpcap.h"
+#include "caputils/capture-wpcap.h"
#endif
#include "ui/gtk/stock_icons.h"
diff --git a/ui/gtk/capture_if_dlg.h b/ui/gtk/capture_if_dlg.h
index aeecdcac3d..ca790e7211 100644
--- a/ui/gtk/capture_if_dlg.h
+++ b/ui/gtk/capture_if_dlg.h
@@ -44,7 +44,7 @@ capture_if_cb(GtkWidget *widget, gpointer data);
#ifdef HAVE_LIBPCAP
-#include <capchild/capture_ifinfo.h> /* for if_info_t */
+#include "caputils/capture_ifinfo.h" /* for if_info_t */
/*
* Used to retrieve the interface icon
diff --git a/ui/gtk/capture_info_dlg.c b/ui/gtk/capture_info_dlg.c
index 497aa7b9f3..cf0fdd040b 100644
--- a/ui/gtk/capture_info_dlg.c
+++ b/ui/gtk/capture_info_dlg.c
@@ -32,7 +32,9 @@
#include "ui/capture.h"
#include "../capture_info.h"
+#if 0
#include "../capture-pcap-util.h"
+#endif
#include "ui/capture_ui_utils.h"
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index ad723142f3..b747c5af17 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -49,10 +49,6 @@
#include <zlib.h> /* to get the libz version number */
#endif
-#ifdef HAVE_LIBCAP
-# include <sys/capability.h>
-#endif
-
#ifdef _WIN32 /* Needed for console I/O */
#include <fcntl.h>
@@ -134,17 +130,17 @@
#include "codecs/codecs.h"
-#include "capture-pcap-util.h"
+#include "caputils/capture-pcap-util.h"
#ifdef HAVE_LIBPCAP
-#include <capchild/capture_ifinfo.h>
+#include "caputils/capture_ifinfo.h"
#include "ui/capture.h"
#include <capchild/capture_sync.h>
#endif
#ifdef _WIN32
-#include "capture-wpcap.h"
-#include "capture_wpcap_packet.h"
+#include "caputils/capture-wpcap.h"
+#include "caputils/capture_wpcap_packet.h"
#include <tchar.h> /* Needed for Unicode */
#include <wsutil/unicode-utils.h>
#include <commctrl.h>
@@ -1920,9 +1916,9 @@ get_wireshark_gtk_compiled_info(GString *str)
g_string_append(str, ", with Pango ");
g_string_append(str, PANGO_VERSION_STRING);
- /* Libpcap */
+ /* Capture libraries */
g_string_append(str, ", ");
- get_compiled_pcap_version(str);
+ get_compiled_caplibs_version(str);
/* LIBZ */
g_string_append(str, ", ");
@@ -1936,41 +1932,6 @@ get_wireshark_gtk_compiled_info(GString *str)
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
-
- /*
- * XXX - these libraries are actually used only by dumpcap,
- * but we mention them here so that a user reporting a bug
- * can get information about dumpcap's libraries without
- * having to run dumpcap.
- */
-#ifndef _WIN32
- /* This is UN*X-only. */
- /* LIBCAP */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBCAP
- g_string_append(str, "with POSIX capabilities");
-#ifdef _LINUX_CAPABILITY_VERSION
- g_string_append(str, " (Linux)");
-#endif /* _LINUX_CAPABILITY_VERSION */
-#else /* HAVE_LIBCAP */
- g_string_append(str, "without POSIX capabilities");
-#endif /* HAVE_LIBCAP */
-#endif /* _WIN32 */
-
-#ifdef __linux__
- /* This is a Linux-specific library. */
- /* LIBNL */
- g_string_append(str, ", ");
-#if defined(HAVE_LIBNL1)
- g_string_append(str, "with libnl 1");
-#elif defined(HAVE_LIBNL2)
- g_string_append(str, "with libnl 2");
-#elif defined(HAVE_LIBNL3)
- g_string_append(str, "with libnl 3");
-#else /* no libnl */
- g_string_append(str, "without libnl");
-#endif /* libnl version */
-#endif /* __linux__ */
}
static void
@@ -2002,9 +1963,9 @@ static void
get_wireshark_runtime_info(GString *str)
{
#ifdef HAVE_LIBPCAP
- /* Libpcap */
+ /* Capture libraries */
g_string_append(str, ", ");
- get_runtime_pcap_version(str);
+ get_runtime_caplibs_version(str);
#endif
/* zlib */
diff --git a/ui/gtk/main_80211_toolbar.c b/ui/gtk/main_80211_toolbar.c
index 212c9ffbb4..17bb8c34c1 100644
--- a/ui/gtk/main_80211_toolbar.c
+++ b/ui/gtk/main_80211_toolbar.c
@@ -45,7 +45,7 @@
#include "ui/ui_util.h"
#include "ui/gtk/main_80211_toolbar.h"
-#include "ws80211_utils.h"
+#include "caputils/ws80211_utils.h"
#include <capchild/capture_session.h>
#include <capchild/capture_sync.h>
diff --git a/ui/gtk/main_welcome.c b/ui/gtk/main_welcome.c
index f87fdb5f44..955d02d336 100644
--- a/ui/gtk/main_welcome.c
+++ b/ui/gtk/main_welcome.c
@@ -30,7 +30,9 @@
#include "../color.h"
#ifdef HAVE_LIBPCAP
#include "ui/capture.h"
+#if 0
#include "capture-pcap-util.h"
+#endif
#include "capture_opts.h"
#endif
diff --git a/ui/gtk/prefs_capture.c b/ui/gtk/prefs_capture.c
index d92b4a15fb..53bca5c809 100644
--- a/ui/gtk/prefs_capture.c
+++ b/ui/gtk/prefs_capture.c
@@ -30,7 +30,7 @@
#include <epan/prefs.h>
#include "capture_opts.h"
-#include <capchild/capture_ifinfo.h>
+#include "caputils/capture_ifinfo.h"
#include "ui/capture_ui_utils.h"
#include "ui/capture_globals.h"
#include "ui/iface_lists.h"
diff --git a/ui/gtk/prefs_dlg.c b/ui/gtk/prefs_dlg.c
index 17a903b592..60bed8ec25 100644
--- a/ui/gtk/prefs_dlg.c
+++ b/ui/gtk/prefs_dlg.c
@@ -59,7 +59,7 @@
#ifdef HAVE_LIBPCAP
#ifdef _WIN32
-#include "capture-wpcap.h"
+#include "caputils/capture-wpcap.h"
#endif /* _WIN32 */
#ifdef HAVE_AIRPCAP
#include "airpcap.h"
diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c
index 96094f881e..7be72452d0 100644
--- a/ui/gtk/summary_dlg.c
+++ b/ui/gtk/summary_dlg.c
@@ -36,7 +36,9 @@
#include "../globals.h"
#include "../file.h"
#include "../summary.h"
+#if 0
#include "../capture-pcap-util.h"
+#endif
#ifdef HAVE_LIBPCAP
#include "ui/capture.h"
diff --git a/ui/qt/QtShark.pro b/ui/qt/QtShark.pro
index 0300e7f3b3..497ec5bb97 100644
--- a/ui/qt/QtShark.pro
+++ b/ui/qt/QtShark.pro
@@ -187,7 +187,6 @@ win32:INCLUDEPATH += \
# Is there any way to do this automatically?
SOURCES_WS_C = \
../../airpcap_loader.c \
- ../../capture-pcap-util.c \
../../capture_info.c \
../../capture_opts.c \
../../cfile.c \
@@ -199,11 +198,7 @@ SOURCES_WS_C = \
../../sync_pipe_write.c \
../../version_info.c
-unix:SOURCES_WS_C += ../../capture-pcap-util-unix.c
win32:SOURCES_WS_C += \
- ../../capture_win_ifnames.c \
- ../../capture-wpcap.c \
- ../../capture_wpcap_packet.c \
../../ui/win32/console_win32.c \
../../ui/win32/file_dlg_win32.c
@@ -332,7 +327,7 @@ unix {
LIBS += -L../../run -Wl,-rpath ../../run
}
- LIBS += -lwireshark -lwiretap -lcapchild -lui -lcodecs -lwsutil \
+ LIBS += -lwireshark -lwiretap -lcapchild -lcaputils -lui -lcodecs -lwsutil \
-lpcap
exists(../libui_dirty.a) {
@@ -399,8 +394,10 @@ win32 {
LIBS += $$PA_OBJECTS
LIBS += \
$${guilibsdll} $${HHC_LIBS} \
- -L../../epan -llibwireshark -L../../wsutil -llibwsutil -L../../wiretap -lwiretap-$${WTAP_VERSION} \
- -L../../capchild -llibcapchild -L.. -llibui -L../../codecs -lcodecs \
+ -L../../epan -llibwireshark -L../../wsutil -llibwsutil \
+ -L../../wiretap -lwiretap-$${WTAP_VERSION} \
+ -L../../capchild -llibcapchild -L../../caputils -llibcaputils \
+ -L.. -llibui -L../../codecs -lcodecs \
-L$${GLIB_DIR}/lib -lglib-2.0 -lgmodule-2.0 \
-L$${ZLIB_DIR}/lib -lzdll \
-L$${WINSPARKLE_DIR} -lWinSparkle
diff --git a/ui/qt/interface_tree.h b/ui/qt/interface_tree.h
index a9055613bc..eeab0eeacb 100644
--- a/ui/qt/interface_tree.h
+++ b/ui/qt/interface_tree.h
@@ -28,7 +28,7 @@
#ifdef HAVE_LIBPCAP
#include "ui/capture.h"
-#include "capture-pcap-util.h"
+#include "caputils/capture-pcap-util.h"
#include "capture_opts.h"
#include "ui/capture_ui_utils.h"
#endif
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index 479d5576b0..f09ec6e8e1 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -105,21 +105,19 @@
#include "ui/simple_dialog.h"
#include "ui/ui_util.h"
+#if 0
#include "capture-pcap-util.h"
+#endif
#ifdef HAVE_LIBPCAP
-# include <capchild/capture_ifinfo.h>
+# include "caputils/capture_ifinfo.h"
# include "ui/capture.h"
# include <capchild/capture_sync.h>
#endif
-#ifdef HAVE_LIBCAP
-# include <sys/capability.h>
-#endif
-
#ifdef _WIN32
-# include "capture-wpcap.h"
-# include "capture_wpcap_packet.h"
+# include "caputils/capture-wpcap.h"
+# include "caputils/capture_wpcap_packet.h"
# include <tchar.h> /* Needed for Unicode */
# include <wsutil/unicode-utils.h>
# include <commctrl.h>
@@ -410,9 +408,9 @@ get_wireshark_qt_compiled_info(GString *str)
"Qt (version unknown)");
#endif
- /* Libpcap */
+ /* Capture libraries */
g_string_append(str, ", ");
- get_compiled_pcap_version(str);
+ get_compiled_caplibs_version(str);
/* LIBZ */
g_string_append(str, ", ");
@@ -426,41 +424,6 @@ get_wireshark_qt_compiled_info(GString *str)
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
-
- /*
- * XXX - these libraries are actually used only by dumpcap,
- * but we mention them here so that a user reporting a bug
- * can get information about dumpcap's libraries without
- * having to run dumpcap.
- */
-#ifndef _WIN32
- /* This is UN*X-only. */
- /* LIBCAP */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBCAP
- g_string_append(str, "with POSIX capabilities");
-#ifdef _LINUX_CAPABILITY_VERSION
- g_string_append(str, " (Linux)");
-#endif /* _LINUX_CAPABILITY_VERSION */
-#else /* HAVE_LIBCAP */
- g_string_append(str, "without POSIX capabilities");
-#endif /* HAVE_LIBCAP */
-#endif /* _WIN32 */
-
-#ifdef __linux__
- /* This is a Linux-specific library. */
- /* LIBNL */
- g_string_append(str, ", ");
-#if defined(HAVE_LIBNL1)
- g_string_append(str, "with libnl 1");
-#elif defined(HAVE_LIBNL2)
- g_string_append(str, "with libnl 2");
-#elif defined(HAVE_LIBNL3)
- g_string_append(str, "with libnl 3");
-#else /* no libnl */
- g_string_append(str, "without libnl");
-#endif /* libnl version */
-#endif /* __linux__ */
}
// xxx copied from ../gtk/main.c
@@ -485,9 +448,9 @@ static void
get_wireshark_runtime_info(GString *str)
{
#ifdef HAVE_LIBPCAP
- /* Libpcap */
+ /* Capture libraries */
g_string_append(str, ", ");
- get_runtime_pcap_version(str);
+ get_runtime_caplibs_version(str);
#endif
/* zlib */
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 5d085d39b9..36cf1b0e03 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -32,7 +32,9 @@
#ifdef HAVE_LIBPCAP
#include "ui/capture.h"
+#if 0
#include "capture-pcap-util.h"
+#endif
#include <capchild/capture_session.h>
#endif
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index daf4fb54dd..a8917c5aef 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -44,8 +44,10 @@
#ifdef HAVE_LIBPCAP
#include "ui/capture.h"
+#if 0
#include "capture-pcap-util.h"
#endif
+#endif
#include "wsutil/file_util.h"
diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp
index e470d4c337..0503db718e 100644
--- a/ui/qt/preferences_dialog.cpp
+++ b/ui/qt/preferences_dialog.cpp
@@ -27,7 +27,7 @@
#ifdef HAVE_LIBPCAP
#ifdef _WIN32
-#include "capture-wpcap.h"
+#include "caputils/capture-wpcap.h"
#endif /* _WIN32 */
#endif /* HAVE_LIBPCAP */
diff --git a/ui/qt/summary_dialog.h b/ui/qt/summary_dialog.h
index 48c6e59217..926f774f3d 100644
--- a/ui/qt/summary_dialog.h
+++ b/ui/qt/summary_dialog.h
@@ -41,8 +41,10 @@
#ifdef HAVE_LIBPCAP
#include "ui/capture.h"
#include "ui/capture_globals.h"
+#if 0
#include "capture-pcap-util.h"
#endif
+#endif
#include <QDialog>
#include <QClipboard>