aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-06-23 16:48:41 -0700
committerGuy Harris <guy@alum.mit.edu>2014-06-23 23:58:29 +0000
commit213189ef9e7bbd851e145e1cfb1067c7b2b72de8 (patch)
tree67bc7b5ce4a1e36fd16203d12fd184a0aee38965
parente22d3c9b744af8fa49806f1cde2100be85cc58cc (diff)
Move the routines to talk to dumpcap into a static libcapchild.
This pulls some stuff out of the top-level directory, and means we don't have to build them once for every program using them. Change-Id: I37b31fed20f2d5c3563ecd2bae9fd86af70afff5 Reviewed-on: https://code.wireshark.org/review/2591 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--CMakeLists.txt7
-rw-r--r--Makefile.am47
-rw-r--r--Makefile.common4
-rw-r--r--Makefile.nmake16
-rw-r--r--capchild/CMakeLists.txt46
-rw-r--r--capchild/Makefile.am80
-rw-r--r--capchild/Makefile.common30
-rw-r--r--capchild/Makefile.nmake77
-rw-r--r--capchild/capture_ifinfo.c (renamed from capture_ifinfo.c)0
-rw-r--r--capchild/capture_ifinfo.h (renamed from capture_ifinfo.h)0
-rw-r--r--capchild/capture_sync.c (renamed from capture_sync.c)0
-rw-r--r--capchild/capture_sync.h (renamed from capture_sync.h)0
-rw-r--r--capture_opts.h2
-rw-r--r--configure.ac4
-rw-r--r--ui/gtk/main_80211_toolbar.c2
15 files changed, 295 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4fa6265ac0..7eff37eff0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -735,6 +735,7 @@ foreach(PLUGIN_DIR ${PLUGIN_SRC_DIRS})
endforeach()
add_subdirectory( asn1 EXCLUDE_FROM_ALL )
+add_subdirectory( capchild )
add_subdirectory( codecs )
add_subdirectory( epan )
add_subdirectory( filetap )
@@ -861,6 +862,7 @@ link_directories(
${CMAKE_BINARY_DIR}/ui
${CMAKE_BINARY_DIR}/ui/gtk
${CMAKE_BINARY_DIR}/ui/qt
+ ${CMAKE_BINARY_DIR}/capchild
${CMAKE_BINARY_DIR}/codecs
${CMAKE_BINARY_DIR}/epan
${CMAKE_BINARY_DIR}/filetap
@@ -922,8 +924,6 @@ set(SHARK_COMMON_SRC
# sources common for wireshark and tshark, but not rawshark;
# these are for programs that capture traffic by running dumpcap
set(SHARK_COMMON_CAPTURE_SRC
- capture_ifinfo.c
- capture_sync.c
capture_ui_utils.c
)
@@ -1055,6 +1055,7 @@ if(BUILD_wireshark AND GTK_FOUND)
set(wireshark_LIBS
gtkui
ui
+ capchild
${GTK2_LIBRARIES}
${GTK3_LIBRARIES}
${GTHREAD2_LIBRARIES}
@@ -1081,6 +1082,7 @@ if(BUILD_qtshark AND QT_FOUND)
set(qtshark_LIBS
qtui
ui
+ capchild
${QT_LIBRARIES}
${GTHREAD2_LIBRARIES}
codecs
@@ -1108,6 +1110,7 @@ register_tap_files(tshark-tap-register.c
if(BUILD_tshark)
set(tshark_LIBS
ui
+ capchild
${LIBEPAN_LIBS}
${APPLE_CORE_FOUNDATION_LIBRARY}
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
diff --git a/Makefile.am b/Makefile.am
index 95f5ce9b45..6b4d192bf8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -351,6 +351,7 @@ endif
# GLIB_LIBS (that's the case on my machine right now, for example).
#
wireshark_ldadd = \
+ capchild/libcapchild.a \
ui/libui.a \
ui/libui_dirty.a \
codecs/libcodec.a \
@@ -418,6 +419,7 @@ endif
# Libraries and plugin flags with which to link tshark.
tshark_LDADD = \
+ capchild/libcapchild.a \
ui/cli/libcliui.a \
ui/libui.a \
wiretap/libwiretap.la \
@@ -1049,13 +1051,42 @@ endif
endif
-DIST_SUBDIRS = asn1 codecs doc epan echld filetap ui ui/cli ui/gtk ui/qt help packaging plugins tools wiretap wsutil docbook
-
-if HAVE_PLUGINS
-SUBDIRS = tools wsutil wiretap filetap epan @echld_dir@ plugins packaging help ui @wireshark_SUBDIRS@ ui/cli . doc
-else
-SUBDIRS = tools wsutil wiretap filetap epan @echld_dir@ packaging help ui @wireshark_SUBDIRS@ ui/cli . doc
-endif
+DIST_SUBDIRS = \
+ asn1 \
+ capchild \
+ codecs \
+ doc \
+ epan \
+ echld \
+ filetap \
+ ui \
+ ui/cli \
+ ui/gtk \
+ ui/qt \
+ help \
+ packaging \
+ plugins \
+ tools \
+ wiretap \
+ wsutil \
+ docbook
+
+SUBDIRS = \
+ tools \
+ wsutil \
+ wiretap \
+ filetap \
+ epan \
+ capchild \
+ @echld_dir@ \
+ @plugins_dir@ \
+ packaging \
+ help \
+ ui \
+ @wireshark_SUBDIRS@ \
+ ui/cli \
+ . \
+ doc
help/faq.txt: $(srcdir)/help/faq.py
$(AM_V_GEN)(cd help ; \
@@ -1199,6 +1230,7 @@ checkapi: checkapi_local
cd wiretap && $(MAKE) checkapi
cd filetap && $(MAKE) checkapi
cd codecs && $(MAKE) checkapi
+ cd capchild && $(MAKE) checkapi
cd ui && $(MAKE) checkapi
cd ui/gtk && $(MAKE) checkapi
## cd epan && $(MAKE) checkapi
@@ -1214,6 +1246,7 @@ wsar_html: doxygen.cfg doxygen_global.cfg FORCE
if HAVE_DOXYGEN
rm -rf wsar_html
cd epan && $(MAKE) $@
+ cd capchild && $(MAKE) $@
cd ui && $(MAKE) $@
(umask 022 ; $(DOXYGEN) doxygen.cfg)
endif
diff --git a/Makefile.common b/Makefile.common
index 59cfebe4e0..34205d70c7 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -68,15 +68,11 @@ SHARK_COMMON_INCLUDES = \
# sources common for wireshark and tshark, but not rawshark;
# these are for programs that capture traffic by running dumpcap
SHARK_COMMON_CAPTURE_SRC = \
- capture_ifinfo.c \
- capture_sync.c \
capture_ui_utils.c
# corresponding headers
SHARK_COMMON_CAPTURE_INCLUDES = \
- capture_ifinfo.h \
capture_session.h \
- capture_sync.h \
capture_ui_utils.h
# wireshark specifics
diff --git a/Makefile.nmake b/Makefile.nmake
index 38f1f59b4e..fa1e458506 100644
--- a/Makefile.nmake
+++ b/Makefile.nmake
@@ -265,6 +265,7 @@ packaging_zip: all
# See: http://ask.wireshark.org/questions/8660/wireshark-building-and-debugging-on-visual-c-or-visual-studio
wireshark.bsc: \
*.sbr \
+ capchild\*.sbr \
codecs\*.sbr \
epan\*.sbr \
epan\crypt\*.sbr \
@@ -314,21 +315,21 @@ $(RESOURCES): image
filetap\filetap-$(FTAP_VERSION).lib: image $(ZLIB_DLL) filetap
wiretap\wiretap-$(WTAP_VERSION).lib: image $(ZLIB_DLL) wiretap
-wireshark.exe : $(LIBS_CHECK) config.h $(wireshark_OBJECTS) codecs epan ui gtk win32 image\wireshark.res image\file_dlg_win32.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib codecs\codecs.lib ui\libui.lib ui\gtk\libgtkui.lib ui\win32\libgtkui_win32.lib plugins
+wireshark.exe : $(LIBS_CHECK) config.h $(wireshark_OBJECTS) capchild codecs epan ui gtk win32 image\wireshark.res image\file_dlg_win32.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib codecs\codecs.lib ui\libui.lib ui\gtk\libgtkui.lib ui\win32\libgtkui_win32.lib plugins
@echo Linking $@
$(LINK) @<<
- /OUT:$(PROGRAM_NAME).exe $(guiflags) $(guilibsdll) $(LDFLAGS) /LARGEADDRESSAWARE $(wireshark_LIBS) $(GTK_LIBS) codecs\codecs.lib ui\gtk\libgtkui.lib ui\win32\libgtkui_win32.lib ui\libui.lib $(wireshark_OBJECTS) image\wireshark.res image\file_dlg_win32.res
+ /OUT:$(PROGRAM_NAME).exe $(guiflags) $(guilibsdll) $(LDFLAGS) /LARGEADDRESSAWARE $(wireshark_LIBS) $(GTK_LIBS) capchild\capchild.lib codecs\codecs.lib ui\gtk\libgtkui.lib ui\win32\libgtkui_win32.lib ui\libui.lib $(wireshark_OBJECTS) image\wireshark.res image\file_dlg_win32.res
<<
!IFDEF MANIFEST_INFO_REQUIRED
mt.exe -nologo -manifest "wireshark.exe.manifest" -outputresource:$(PROGRAM_NAME).exe;1
!ENDIF
-qtshark.exe : install-generated-files $(LIBS_CHECK) config.h epan ui qt wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins
+qtshark.exe : install-generated-files $(LIBS_CHECK) config.h capchild epan ui qt wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins
-tshark.exe : $(LIBS_CHECK) config.h $(tshark_OBJECTS) epan ui cli image\tshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins
+tshark.exe : $(LIBS_CHECK) config.h $(tshark_OBJECTS) capchild epan ui cli image\tshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins
@echo Linking $@
$(LINK) @<<
- /OUT:tshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE $(tshark_LIBS) $(tshark_OBJECTS) ui\cli\libcliui.lib ui\libui.lib image\tshark.res
+ /OUT:tshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE $(tshark_LIBS) $(tshark_OBJECTS) capchild\libcapchild.lib ui\cli\libcliui.lib ui\libui.lib image\tshark.res
<<
!IFDEF MANIFEST_INFO_REQUIRED
mt.exe -nologo -manifest "tshark.exe.manifest" -outputresource:tshark.exe;1
@@ -797,6 +798,11 @@ filetap::
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
cd ..
+capchild:: help config.h version.h doxygen
+ cd capchild
+ $(MAKE) /$(MAKEFLAGS) /f Makefile.nmake libcapchild.lib
+ cd ..
+
codecs::
cd codecs
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
diff --git a/capchild/CMakeLists.txt b/capchild/CMakeLists.txt
new file mode 100644
index 0000000000..af4a1cbc58
--- /dev/null
+++ b/capchild/CMakeLists.txt
@@ -0,0 +1,46 @@
+# CMakeLists.txt
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+
+set(CAPCHILD_SRC
+ capture_ifinfo.c
+ capture_sync.c
+)
+
+set(CLEAN_FILES
+ ${CAPCHILD_SRC}
+)
+
+if (WERROR)
+ set_source_files_properties(
+ ${CLEAN_FILES}
+ PROPERTIES
+ COMPILE_FLAGS -Werror
+ )
+endif()
+
+
+add_library(capchild STATIC
+ ${CAPCHILD_SRC}
+)
+
+set_target_properties(capchild PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
+set_target_properties(capchild PROPERTIES FOLDER "CAPCHILD")
diff --git a/capchild/Makefile.am b/capchild/Makefile.am
new file mode 100644
index 0000000000..ed14eeb5f2
--- /dev/null
+++ b/capchild/Makefile.am
@@ -0,0 +1,80 @@
+# Makefile.am
+# Automake file for the "talking to dumpcap" routines for Wireshark
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+include Makefile.common
+include ../Makefile.am.inc
+
+if HAVE_WARNINGS_AS_ERRORS
+AM_CLEAN_CFLAGS = -Werror
+endif
+
+noinst_LIBRARIES = libcapchild.a
+
+CLEANFILES = \
+ doxygen-capchild.tag \
+ libcapchild.a \
+ *~
+
+MAINTAINERCLEANFILES = \
+ $(GENERATED_FILES) \
+ Makefile.in
+
+# All sources that should be put in the source distribution tarball
+libcapchild_a_SOURCES = \
+ $(CAPCHILD_SRC) \
+ $(noinst_HEADERS)
+
+libcapchild_a_CFLAGS = $(AM_CLEAN_CFLAGS)
+
+libcapchild_a_DEPENDENCIES =
+
+# Common headers
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/wiretap $(LIBGCRYPT_CFLAGS) $(LIBGNUTLS_CFLAGS) $(PORTAUDIO_INCLUDES)
+
+
+doxygen:
+if HAVE_DOXYGEN
+ $(DOXYGEN) doxygen.cfg
+endif # HAVE_DOXYGEN
+
+wsar_html: doxygen.cfg ../doxygen_global.cfg
+if HAVE_DOXYGEN
+ (umask 022 ; $(DOXYGEN) doxygen.cfg)
+endif
+
+checkapi: checkapi-base checkapi-todo
+
+checkapi-base:
+ $(PERL) $(top_srcdir)/tools/checkAPIs.pl -g deprecated-gtk -build \
+ -sourcedir=$(srcdir) \
+ $(CAPCHILD_SRC)
+
+checkapi-todo:
+ $(PERL) $(top_srcdir)/tools/checkAPIs.pl -M -g deprecated-gtk-todo -build \
+ -sourcedir=$(srcdir) \
+ $(CAPCHILD_SRC)
+
+EXTRA_DIST = \
+ $(GENERATOR_FILES) \
+ CMakeLists.txt \
+ doxygen.cfg.in \
+ Makefile.common \
+ Makefile.nmake
diff --git a/capchild/Makefile.common b/capchild/Makefile.common
new file mode 100644
index 0000000000..80a8b9adaa
--- /dev/null
+++ b/capchild/Makefile.common
@@ -0,0 +1,30 @@
+# Makefile.common
+# Contains the stuff from Makefile.am and Makefile.nmake that is
+# a) common to both files and
+# b) portable between both files
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+CAPCHILD_SRC = \
+ capture_ifinfo.c \
+ capture_sync.c
+
+noinst_HEADERS = \
+ capture_ifinfo.h \
+ capture_sync.h
diff --git a/capchild/Makefile.nmake b/capchild/Makefile.nmake
new file mode 100644
index 0000000000..2e55521e66
--- /dev/null
+++ b/capchild/Makefile.nmake
@@ -0,0 +1,77 @@
+## Makefile for building wireshark.exe with Microsoft C and nmake
+## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
+#
+
+include ..\config.nmake
+include ..\Makefile.nmake.inc
+
+############### no need to modify below this line #########
+
+# We use GENERATED_CFLAGS to get around flex's non-LLP64-compliant output
+GENERATED_CFLAGS=\
+ $(STANDARD_CFLAGS) \
+ /Zm800 \
+ /I.. /I../wiretap $(GLIB_CFLAGS) $(GNUTLS_CFLAGS) \
+ /I$(PCAP_DIR)\WPCAP\LIBPCAP /I$(PCAP_DIR)\WPCAP\LIBPCAP\bpf \
+ /I$(PCAP_DIR)\WPCAP\LIBPCAP\lbl \
+ /I$(PCAP_DIR)\include $(AIRPCAP_CFLAGS) \
+ $(PORTAUDIO_CFLAGS) $(GEOIP_CFLAGS) $(WINSPARKLE_CFLAGS) \
+ $(HHC_CFLAGS)
+
+CFLAGS=$(WARNINGS_ARE_ERRORS) $(GENERATED_CFLAGS)
+
+.c.obj::
+ $(CC) $(CFLAGS) $(WSUG_CFLAGS) -Fd.\ -c $<
+
+include Makefile.common
+
+
+# if you add files here, be sure to include them also in Makefile.am EXTRA_DIST
+CAPCHILD_OBJECTS = \
+ $(CAPCHILD_SRC:.c=.obj)
+
+RUNLEX=..\tools\runlex.sh
+
+libcapchild.lib : ..\config.h $(CAPCHILD_OBJECTS)
+ link /lib /out:libcapchild.lib $(CAPCHILD_OBJECTS)
+
+clean:
+ rm -f $(CAPCHILD_OBJECTS) $(WIRESHARK_TAP_OBJECTS) libcapchild.lib *.pdb *.sbr \
+ doxygen.cfg html/*.* wireshark-tap-register-cache.pkl
+ if exist html rmdir html
+
+distclean: clean
+
+maintainer-clean: distclean
+ rm -f $(GENERATED_FILES)
+
+# convert doxygen.cfg.in to doxygen.cfg with stamped version info
+doxygen.cfg: ..\config.nmake doxygen.cfg.in
+!IFDEF DOXYGEN
+ sed -e s/@VERSION@/$(VERSION)/ \
+ < doxygen.cfg.in > $@
+!ENDIF
+
+doxygen-run:
+!IFDEF DOXYGEN
+ $(DOXYGEN) doxygen.cfg
+!ENDIF
+
+# MS html help compiler hhc returns 1 on success, but as nmake expects 0 it would stop here.
+# the prepended -1 will raise the accepted error levels of nmake, so it will continue
+doxygen.chm:
+!IFDEF HHC
+ -1 $(HHC) html\index.hhp
+!ENDIF
+
+doxygen: doxygen.cfg doxygen-run doxygen.chm
+
+checkapi: checkapi-base checkapi-todo
+
+checkapi-base:
+ $(PERL) ../tools/checkAPIs.pl -g deprecated-gtk -build \
+ $(CAPCHILD_SRC)
+
+checkapi-todo:
+ $(PERL) ../tools/checkAPIs.pl -M -g deprecated-gtk-todo -build \
+ $(CAPCHILD_SRC)
diff --git a/capture_ifinfo.c b/capchild/capture_ifinfo.c
index 039ef53473..039ef53473 100644
--- a/capture_ifinfo.c
+++ b/capchild/capture_ifinfo.c
diff --git a/capture_ifinfo.h b/capchild/capture_ifinfo.h
index f70bdf4ba5..f70bdf4ba5 100644
--- a/capture_ifinfo.h
+++ b/capchild/capture_ifinfo.h
diff --git a/capture_sync.c b/capchild/capture_sync.c
index 2f9d2cc62e..2f9d2cc62e 100644
--- a/capture_sync.c
+++ b/capchild/capture_sync.c
diff --git a/capture_sync.h b/capchild/capture_sync.h
index 2c4bb639af..2c4bb639af 100644
--- a/capture_sync.h
+++ b/capchild/capture_sync.h
diff --git a/capture_opts.h b/capture_opts.h
index 9439c4e958..dafa4957bf 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -34,7 +34,7 @@
# include <sys/types.h> /* for gid_t */
#endif
-#include "capture_ifinfo.h"
+#include <capchild/capture_ifinfo.h>
#ifdef __cplusplus
extern "C" {
diff --git a/configure.ac b/configure.ac
index 350cb76924..dfa296dae5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1676,10 +1676,13 @@ LIBS="$ac_save_LIBS"
if test "$ac_cv_glib_supports_modules" = yes ; then
AC_MSG_RESULT(yes)
have_plugins=yes
+ plugins_dir="plugins"
else
AC_MSG_RESULT(no)
have_plugins=no
+ plugins_dir=""
fi
+AC_SUBST(plugins_dir)
#
# If we have <dlfcn.h>, check whether we have dladdr.
@@ -2873,6 +2876,7 @@ AC_OUTPUT(
asn1/x509if/Makefile
asn1/x509sat/Makefile
asn1/x721/Makefile
+ capchild/Makefile
doc/Makefile
docbook/Makefile
epan/Makefile
diff --git a/ui/gtk/main_80211_toolbar.c b/ui/gtk/main_80211_toolbar.c
index e8cce9f9f3..df11100cb2 100644
--- a/ui/gtk/main_80211_toolbar.c
+++ b/ui/gtk/main_80211_toolbar.c
@@ -47,7 +47,7 @@
#include "ws80211_utils.h"
#include "capture_session.h"
-#include "capture_sync.h"
+#include <capchild/capture_sync.h>
static GtkWidget *tb80211_tb, *tb80211_iface_list_box, *tb80211_freq_list_box, *tb80211_chan_type_box, *tb80211_info_label;