diff options
55 files changed, 538 insertions, 291 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 16572792a5..85e2de1b04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -760,6 +760,7 @@ endforeach() add_subdirectory( asn1 EXCLUDE_FROM_ALL ) add_subdirectory( capchild ) +add_subdirectory( caputils ) add_subdirectory( codecs ) add_subdirectory( epan ) add_subdirectory( filetap ) @@ -831,6 +832,7 @@ configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h set( IN_FILES adns_dll.rc capchild/doxygen.cfg.in + caputils/doxygen.cfg.in doxygen.cfg.in doxygen_global.cfg epan/doxygen.cfg.in @@ -888,6 +890,7 @@ link_directories( ${CMAKE_BINARY_DIR}/ui/gtk ${CMAKE_BINARY_DIR}/ui/qt ${CMAKE_BINARY_DIR}/capchild + ${CMAKE_BINARY_DIR}/caputils ${CMAKE_BINARY_DIR}/codecs ${CMAKE_BINARY_DIR}/epan ${CMAKE_BINARY_DIR}/filetap @@ -895,18 +898,7 @@ link_directories( ${CMAKE_BINARY_DIR}/wsutil ) -if(UNIX) - set(PLATFORM_PCAP_SRC - capture-pcap-util-unix.c - ) -endif() - if(WIN32) - set(PLATFORM_PCAP_SRC - capture_win_ifnames.c - capture-wpcap.c - capture_wpcap_packet.c - ) set(PLATFORM_UI_SRC ui/win32/console_win32.c ui/win32/file_dlg_win32.c @@ -917,8 +909,6 @@ endif() # sources common for wireshark, tshark, and rawshark set(SHARK_COMMON_SRC - ${PLATFORM_PCAP_SRC} - capture-pcap-util.c cfile.c frame_tvbuff.c sync_pipe_write.c @@ -1043,7 +1033,6 @@ if( (BUILD_wireshark AND GTK_FOUND) OR (BUILD_qtshark AND QT_FOUND) ) fileset.c iface_monitor.c summary.c - ws80211_utils.c ${SHARK_COMMON_CAPTURE_SRC} ${SHARK_COMMON_SRC} ${PLATFORM_UI_SRC} @@ -1056,6 +1045,7 @@ if(BUILD_wireshark AND GTK_FOUND) gtkui ui capchild + caputils ${GTK2_LIBRARIES} ${GTK3_LIBRARIES} ${GTHREAD2_LIBRARIES} @@ -1082,6 +1072,7 @@ if(BUILD_qtshark AND QT_FOUND) qtui ui capchild + caputils ${QT_LIBRARIES} ${GTHREAD2_LIBRARIES} codecs @@ -1109,6 +1100,7 @@ if(BUILD_tshark) set(tshark_LIBS ui capchild + caputils ${LIBEPAN_LIBS} ${APPLE_CORE_FOUNDATION_LIBRARY} ${APPLE_SYSTEM_CONFIGURATION_LIBRARY} @@ -1152,6 +1144,7 @@ endif() if(BUILD_rawshark AND PCAP_FOUND) set(rawshark_LIBS + caputils ${LIBEPAN_LIBS} ${APPLE_CORE_FOUNDATION_LIBRARY} ${APPLE_SYSTEM_CONFIGURATION_LIBRARY} @@ -1327,6 +1320,7 @@ endif() if(BUILD_dumpcap AND PCAP_FOUND) set(dumpcap_LIBS wsutil + caputils ${PCAP_LIBRARIES} ${CAP_LIBRARIES} # @SOCKET_LIBS@ @@ -1340,7 +1334,6 @@ if(BUILD_dumpcap AND PCAP_FOUND) ) set(dumpcap_FILES capture_opts.c - capture-pcap-util.c capture_stop_conditions.c conditions.c dumpcap.c @@ -1348,8 +1341,6 @@ if(BUILD_dumpcap AND PCAP_FOUND) ringbuffer.c sync_pipe_write.c version_info.c - ws80211_utils.c - ${PLATFORM_PCAP_SRC} image/dumpcap.rc ) add_executable(dumpcap ${dumpcap_FILES}) diff --git a/Makefile.am b/Makefile.am index 424a9d2635..5ae7441082 100644 --- a/Makefile.am +++ b/Makefile.am @@ -286,9 +286,6 @@ dist_wimaxasncp_DATA = \ wimaxasncp/dictionary.xml \ wimaxasncp/dictionary.dtd -PLATFORM_PCAP_SRC = \ - capture-pcap-util-unix.c - if HAVE_PLUGINS -include plugins/Custom.make plugin_ldadd = $(_CUSTOM_plugin_ldadd_) \ @@ -353,6 +350,7 @@ endif # wireshark_ldadd = \ capchild/libcapchild.a \ + caputils/libcaputils.a \ ui/libui.a \ ui/libui_dirty.a \ codecs/libcodec.a \ @@ -421,6 +419,7 @@ endif # Libraries and plugin flags with which to link tshark. tshark_LDADD = \ capchild/libcapchild.a \ + caputils/libcaputils.a \ ui/cli/libcliui.a \ ui/libui.a \ wiretap/libwiretap.la \ @@ -479,6 +478,7 @@ endif # Libraries and plugin flags with which to link rawshark. rawshark_LDADD = \ + caputils/libcaputils.a \ ui/libui.a \ wiretap/libwiretap.la \ epan/libwireshark.la \ @@ -602,6 +602,7 @@ echld_test_CFLAGS = $(AM_CLEAN_CFLAGS) # Libraries with which to link dumpcap. dumpcap_LDADD = \ + caputils/libcaputils.a \ wsutil/libwsutil.la \ @GLIB_LIBS@ \ @PCAP_LIBS@ \ @@ -710,12 +711,6 @@ EXTRA_DIST = \ autogen.sh \ capinfos.c \ captype.c \ - capture_win_ifnames.c \ - capture_win_ifnames.h \ - capture-wpcap.c \ - capture-wpcap.h \ - capture_wpcap_packet.c \ - capture_wpcap_packet.h \ cfilters \ colorfilters \ config.h.win32 \ @@ -1056,6 +1051,7 @@ endif DIST_SUBDIRS = \ asn1 \ capchild \ + caputils \ codecs \ doc \ epan \ @@ -1080,6 +1076,7 @@ SUBDIRS = \ filetap \ epan \ capchild \ + caputils \ @echld_dir@ \ @plugins_dir@ \ packaging \ @@ -1233,6 +1230,7 @@ checkapi: checkapi_local cd filetap && $(MAKE) checkapi cd codecs && $(MAKE) checkapi cd capchild && $(MAKE) checkapi + cd caputils && $(MAKE) checkapi cd ui && $(MAKE) checkapi cd ui/gtk && $(MAKE) checkapi ## cd epan && $(MAKE) checkapi @@ -1249,6 +1247,7 @@ if HAVE_DOXYGEN rm -rf wsar_html cd epan && $(MAKE) $@ cd capchild && $(MAKE) $@ + cd caputils && $(MAKE) $@ cd ui && $(MAKE) $@ (umask 022 ; $(DOXYGEN) doxygen.cfg) endif diff --git a/Makefile.common b/Makefile.common index 72f7ee5988..678b30a10e 100644 --- a/Makefile.common +++ b/Makefile.common @@ -41,8 +41,6 @@ GENERATED_FILES = $(GENERATED_C_FILES) $(GENERATED_HEADER_FILES) # sources common for wireshark, tshark, and rawshark SHARK_COMMON_SRC = \ - $(PLATFORM_PCAP_SRC) \ - capture-pcap-util.c \ cfile.c \ frame_tvbuff.c \ sync_pipe_write.c \ @@ -50,8 +48,6 @@ SHARK_COMMON_SRC = \ # corresponding headers SHARK_COMMON_INCLUDES = \ - capture-pcap-util.h \ - capture-pcap-util-int.h \ cfile.h \ color.h \ file.h \ @@ -71,8 +67,7 @@ WIRESHARK_COMMON_SRC = \ file.c \ fileset.c \ iface_monitor.c \ - summary.c \ - ws80211_utils.c + summary.c # corresponding headers WIRESHARK_COMMON_INCLUDES = \ @@ -85,8 +80,7 @@ WIRESHARK_COMMON_INCLUDES = \ iface_monitor.h \ log.h \ summary.h \ - sync_pipe.h \ - ws80211_utils.h + sync_pipe.h # tshark specifics tshark_SOURCES = \ @@ -150,17 +144,14 @@ randpkt_SOURCES = \ # dumpcap specifics dumpcap_SOURCES = \ - $(PLATFORM_PCAP_SRC) \ capture_opts.c \ - capture-pcap-util.c \ capture_stop_conditions.c \ conditions.c \ dumpcap.c \ pcapio.c \ ringbuffer.c \ sync_pipe_write.c \ - version_info.c \ - ws80211_utils.c + version_info.c # corresponding headers dumpcap_INCLUDES = \ diff --git a/Makefile.nmake b/Makefile.nmake index 6880f44ce0..fcd5b6d321 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -49,11 +49,6 @@ CFLAGS=$(WARNINGS_ARE_ERRORS) $(GENERATED_CFLAGS) .c.obj:: $(CC) $(CFLAGS) -Fd.\ -c $< -PLATFORM_PCAP_SRC = \ - capture-wpcap.c \ - capture_wpcap_packet.c \ - capture_win_ifnames.c - include Makefile.common wireshark_OBJECTS = $(WIRESHARK_COMMON_SRC:.c=.obj) @@ -185,6 +180,7 @@ text2pcap_LIBS= \ dumpcap_LIBS= \ wsock32.lib user32.lib \ + caputils\libcaputils.lib \ wsutil\libwsutil.lib \ $(GLIB_LIBS) \ $(GTHREAD_LIBS) @@ -271,6 +267,7 @@ packaging_zip: all wireshark.bsc: \ *.sbr \ capchild\*.sbr \ + caputils\*.sbr \ codecs\*.sbr \ epan\*.sbr \ epan\crypt\*.sbr \ @@ -320,21 +317,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) 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 +wireshark.exe : $(LIBS_CHECK) config.h $(wireshark_OBJECTS) capchild caputils 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) capchild\libcapchild.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 + /OUT:$(PROGRAM_NAME).exe $(guiflags) $(guilibsdll) $(LDFLAGS) /LARGEADDRESSAWARE $(wireshark_LIBS) $(GTK_LIBS) capchild\libcapchild.lib caputils\libcaputils.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 capchild epan ui qt wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins +qtshark.exe : install-generated-files $(LIBS_CHECK) config.h capchild caputils epan ui qt 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 +tshark.exe : $(LIBS_CHECK) config.h $(tshark_OBJECTS) capchild caputils 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) capchild\libcapchild.lib ui\cli\libcliui.lib ui\libui.lib image\tshark.res + /OUT:tshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE $(tshark_LIBS) $(tshark_OBJECTS) capchild\libcapchild.lib caputils\libcaputils.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 @@ -433,7 +430,7 @@ randpkt.exe : $(randpkt_OBJECTS) mt.exe -nologo -manifest "randpkt.exe.manifest" -outputresource:randpkt.exe;1 !ENDIF -dumpcap.exe : $(LIBS_CHECK) config.h $(dumpcap_OBJECTS) wsutil\libwsutil.lib image\dumpcap.res +dumpcap.exe : $(LIBS_CHECK) config.h $(dumpcap_OBJECTS) caputils wsutil\libwsutil.lib image\dumpcap.res @echo Linking $@ $(LINK) @<< /OUT:dumpcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) $(dumpcap_LIBS) $(dumpcap_OBJECTS) image\dumpcap.res @@ -585,6 +582,8 @@ clean: clean-local $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../capchild $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean + cd ../caputils + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../codecs $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../ui @@ -641,6 +640,8 @@ distclean: distclean-local $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../capchild $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean + cd ../caputils + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../codecs $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../ui @@ -690,6 +691,8 @@ maintainer-clean: maintainer-clean-local $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean cd ../capchild $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean + cd ../caputils + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean cd ../codecs $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean cd ../ui @@ -808,6 +811,11 @@ capchild:: help config.h version.h doxygen $(MAKE) /$(MAKEFLAGS) /f Makefile.nmake libcapchild.lib cd .. +caputils:: help config.h version.h doxygen + cd caputils + $(MAKE) /$(MAKEFLAGS) /f Makefile.nmake libcaputils.lib + cd .. + codecs:: cd codecs $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake @@ -1414,6 +1422,8 @@ checkapi: checkapi_local $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi cd ../capchild $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi + cd ../caputils + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi cd ../codecs $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi cd ../ui diff --git a/capchild/Makefile.common b/capchild/Makefile.common index 740898299c..bc6af7edbe 100644 --- a/capchild/Makefile.common +++ b/capchild/Makefile.common @@ -26,6 +26,5 @@ CAPCHILD_SRC = \ capture_sync.c noinst_HEADERS = \ - capture_ifinfo.h \ capture_session.h \ capture_sync.h diff --git a/capchild/capture_ifinfo.c b/capchild/capture_ifinfo.c index 3d758c2f67..984fa664fe 100644 --- a/capchild/capture_ifinfo.c +++ b/capchild/capture_ifinfo.c @@ -51,7 +51,7 @@ #include <capchild/capture_sync.h> #include "log.h" -#include <capchild/capture_ifinfo.h> +#include <caputils/capture_ifinfo.h> #ifdef HAVE_PCAP_REMOTE static GList *remote_interface_list = NULL; diff --git a/capchild/capture_sync.c b/capchild/capture_sync.c index f75ca556f0..f744b1a92d 100644 --- a/capchild/capture_sync.c +++ b/capchild/capture_sync.c @@ -48,7 +48,7 @@ # include <sys/wait.h> #endif -#include "capture-pcap-util.h" +#include "caputils/capture-pcap-util.h" #ifndef _WIN32 /* @@ -90,7 +90,7 @@ #include "sync_pipe.h" #ifdef _WIN32 -#include "capture-wpcap.h" +#include "caputils/capture-wpcap.h" #endif #include "ui/ui_util.h" diff --git a/capture_opts.c b/capture_opts.c index 0f2f1f8037..57139662a8 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -42,12 +42,13 @@ #include "capture_opts.h" #include "ringbuffer.h" -#include <capchild/capture_ifinfo.h> -#include "capture-pcap-util.h" #include <wsutil/clopts_common.h> #include <wsutil/cmdarg_err.h> #include <wsutil/file_util.h> +#include "caputils/capture_ifinfo.h" +#include "caputils/capture-pcap-util.h" + static gboolean capture_opts_output_to_pipe(const char *save_file, gboolean *is_pipe); diff --git a/capture_opts.h b/capture_opts.h index dafa4957bf..fba10f8022 100644 --- a/capture_opts.h +++ b/capture_opts.h @@ -34,7 +34,7 @@ # include <sys/types.h> /* for gid_t */ #endif -#include <capchild/capture_ifinfo.h> +#include <caputils/capture_ifinfo.h> #ifdef __cplusplus extern "C" { diff --git a/caputils/CMakeLists.txt b/caputils/CMakeLists.txt new file mode 100644 index 0000000000..4c8dab086a --- /dev/null +++ b/caputils/CMakeLists.txt @@ -0,0 +1,61 @@ +# 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. +# + + +if(UNIX) + set(PLATFORM_CAPUTILS_SRC + capture-pcap-util-unix.c + ) +endif() + +if(WIN32) + set(PLATFORM_CAPUTILS_SRC + capture_win_ifnames.c + capture-wpcap.c + capture_wpcap_packet.c + ) +endif() + +set(CAPUTILS_SRC + ${PLATFORM_CAPUTILS_SRC} + capture-pcap-util.c + ws80211_utils.c +) + +set(CLEAN_FILES + ${CAPUTILS_SRC} +) + +if (WERROR) + set_source_files_properties( + ${CLEAN_FILES} + PROPERTIES + COMPILE_FLAGS -Werror + ) +endif() + + +add_library(caputils STATIC + ${CAPUTILS_SRC} +) + +set_target_properties(caputils PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}") +set_target_properties(caputils PROPERTIES FOLDER "CAPUTILS") diff --git a/caputils/Makefile.am b/caputils/Makefile.am new file mode 100644 index 0000000000..ad0326f5a5 --- /dev/null +++ b/caputils/Makefile.am @@ -0,0 +1,89 @@ +# Makefile.am +# Automake file for the "capture utilities" 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 = libcaputils.a + +PLATFORM_CAPUTILS_SRC = \ + capture-pcap-util-unix.c + +CLEANFILES = \ + doxygen-caputils.tag \ + libcaputils.a \ + *~ + +MAINTAINERCLEANFILES = \ + $(GENERATED_FILES) \ + Makefile.in + +# All sources that should be put in the source distribution tarball +libcaputils_a_SOURCES = \ + $(CAPUTILS_SRC) \ + $(noinst_HEADERS) + +libcaputils_a_CFLAGS = $(AM_CLEAN_CFLAGS) + +libcaputils_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) \ + $(CAPUTILS_SRC) + +checkapi-todo: + $(PERL) $(top_srcdir)/tools/checkAPIs.pl -M -g deprecated-gtk-todo -build \ + -sourcedir=$(srcdir) \ + $(CAPUTILS_SRC) + +EXTRA_DIST = \ + $(GENERATOR_FILES) \ + capture_win_ifnames.c \ + capture_win_ifnames.h \ + capture-wpcap.c \ + capture-wpcap.h \ + capture_wpcap_packet.c \ + capture_wpcap_packet.h \ + CMakeLists.txt \ + doxygen.cfg.in \ + Makefile.common \ + Makefile.nmake diff --git a/caputils/Makefile.common b/caputils/Makefile.common new file mode 100644 index 0000000000..57599380a7 --- /dev/null +++ b/caputils/Makefile.common @@ -0,0 +1,35 @@ +# 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. + +CAPUTILS_SRC = \ + $(PLATFORM_CAPUTILS_SRC) \ + capture-pcap-util.c \ + ws80211_utils.c + +noinst_HEADERS = \ + capture_ifinfo.h \ + capture-pcap-util.h \ + capture-pcap-util-int.h \ + capture-wpcap.h \ + capture_wpcap_packet.h \ + ws80211_utils.h diff --git a/caputils/Makefile.nmake b/caputils/Makefile.nmake new file mode 100644 index 0000000000..55dd1a6fb1 --- /dev/null +++ b/caputils/Makefile.nmake @@ -0,0 +1,82 @@ +## 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 $< + +PLATFORM_CAPUTILS_SRC = \ + capture_win_ifnames.c \ + capture-wpcap.c \ + capture_wpcap_packet.c + +include Makefile.common + + +# if you add files here, be sure to include them also in Makefile.am EXTRA_DIST +CAPUTILS_OBJECTS = \ + $(CAPUTILS_SRC:.c=.obj) + +RUNLEX=..\tools\runlex.sh + +libcaputils.lib : ..\config.h $(CAPUTILS_OBJECTS) + link /lib /out:libcaputils.lib $(CAPUTILS_OBJECTS) + +clean: + rm -f $(CAPUTILS_OBJECTS) $(WIRESHARK_TAP_OBJECTS) libcaputils.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 \ + $(CAPUTILS_SRC) + +checkapi-todo: + $(PERL) ../tools/checkAPIs.pl -M -g deprecated-gtk-todo -build \ + $(CAPUTILS_SRC) diff --git a/capture-pcap-util-int.h b/caputils/capture-pcap-util-int.h index d49a0cef04..d49a0cef04 100644 --- a/capture-pcap-util-int.h +++ b/caputils/capture-pcap-util-int.h diff --git a/capture-pcap-util-unix.c b/caputils/capture-pcap-util-unix.c index f169d701e3..21e832b166 100644 --- a/capture-pcap-util-unix.c +++ b/caputils/capture-pcap-util-unix.c @@ -60,13 +60,17 @@ struct rtentry; # include <sys/sockio.h> #endif -#include "capture-pcap-util.h" +#include "caputils/capture-pcap-util.h" #endif /* HAVE_PCAP_FINDALLDEVS */ -#include <capchild/capture_ifinfo.h> -#include "capture-pcap-util.h" -#include "capture-pcap-util-int.h" +#ifdef HAVE_LIBCAP +# include <sys/capability.h> +#endif + +#include "caputils/capture_ifinfo.h" +#include "caputils/capture-pcap-util.h" +#include "caputils/capture-pcap-util-int.h" #ifdef HAVE_PCAP_REMOTE GList * @@ -331,10 +335,11 @@ cant_get_if_list_error_message(const char *err_str) } /* - * Append the version of libpcap with which we were compiled to a GString. + * Get the versions of libpcap, libpcap, and libnl with which we were + * compiled, and append them to a GString. */ void -get_compiled_pcap_version(GString *str) +get_compiled_caplibs_version(GString *str) { /* * NOTE: in *some* flavors of UN*X, the data from a shared @@ -357,13 +362,45 @@ get_compiled_pcap_version(GString *str) * of libpcap with which we were compiled. */ g_string_append(str, "with libpcap"); + + /* + * 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. + */ + /* 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 */ + +#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__ */ } /* * Append the version of libpcap with which we we're running to a GString. */ void -get_runtime_pcap_version(GString *str) +get_runtime_caplibs_version(GString *str) { g_string_append_printf(str, "with "); #ifdef HAVE_PCAP_LIB_VERSION @@ -377,19 +414,20 @@ get_runtime_pcap_version(GString *str) /* * Append an indication that we were not compiled with libpcap - * to a GString. + * to a GString. Don't even bother mentioning the other + * libraries. */ void -get_compiled_pcap_version(GString *str) +get_compiled_caplibs_version(GString *str) { g_string_append(str, "without libpcap"); } /* - * Don't append anything, as we weren't even compiled to use WinPcap. + * Don't append anything, as we weren't even compiled to use libpcap. */ void -get_runtime_pcap_version(GString *str _U_) +get_runtime_caplibs_version(GString *str _U_) { } diff --git a/capture-pcap-util.c b/caputils/capture-pcap-util.c index 7f9a5d2d1a..c4e7df3868 100644 --- a/capture-pcap-util.c +++ b/caputils/capture-pcap-util.c @@ -42,9 +42,9 @@ #include <wtap.h> #include <libpcap.h> -#include <capchild/capture_ifinfo.h> -#include "capture-pcap-util.h" -#include "capture-pcap-util-int.h" +#include "caputils/capture_ifinfo.h" +#include "caputils/capture-pcap-util.h" +#include "caputils/capture-pcap-util-int.h" #include "wsutil/file_util.h" @@ -53,7 +53,7 @@ #endif #ifdef _WIN32 -#include "capture_win_ifnames.h" /* windows friendly interface names */ +#include "caputils/capture_win_ifnames.h" /* windows friendly interface names */ #endif /* diff --git a/capture-pcap-util.h b/caputils/capture-pcap-util.h index 2dde7b89db..617bcc82e5 100644 --- a/capture-pcap-util.h +++ b/caputils/capture-pcap-util.h @@ -53,19 +53,19 @@ int linktype_name_to_val(const char *linktype); #endif /* HAVE_LIBPCAP */ /* - * Append to a GString an indication of the version of libpcap/WinPcap - * with which we were compiled, if we were, or an indication that we - * weren't compiled with libpcap/WinPcap, if we weren't. + * Get the versions of capture libraries with which we were compiled, + * and append them to a GString. */ -extern void get_compiled_pcap_version(GString *str); +extern void get_compiled_caplibs_version(GString *str); /* - * Append to a GString an indication of the version of libpcap/WinPcap + * Append to a GString an indication of the version of capture libraries * with which we're running, or an indication that we're not running - * with libpcap/WinPcap, if we were compiled with libpcap/WinPcap, - * or nothing, if we weren't compiled with libpcap/WinPcap. + * with capture libraries, if we were compiled with WinPcap but + * WinPcap wasn't loaded, or nothing, if we weren't compiled with + * libpcap/WinPcap. */ -extern void get_runtime_pcap_version(GString *str); +extern void get_runtime_caplibs_version(GString *str); #ifdef __cplusplus } diff --git a/capture-wpcap.c b/caputils/capture-wpcap.c index c7a172623a..f4f9d61c25 100644 --- a/capture-wpcap.c +++ b/caputils/capture-wpcap.c @@ -30,10 +30,10 @@ #include <epan/strutil.h> -#include <capchild/capture_ifinfo.h> -#include "capture-pcap-util.h" -#include "capture-pcap-util-int.h" -#include "capture-wpcap.h" +#include "caputils/capture_ifinfo.h" +#include "caputils/capture-pcap-util.h" +#include "caputils/capture-pcap-util-int.h" +#include "caputils/capture-wpcap.h" #include <wsutil/file_util.h> diff --git a/capture-wpcap.h b/caputils/capture-wpcap.h index 5e6b10c3ca..5e6b10c3ca 100644 --- a/capture-wpcap.h +++ b/caputils/capture-wpcap.h diff --git a/capchild/capture_ifinfo.h b/caputils/capture_ifinfo.h index f70bdf4ba5..f70bdf4ba5 100644 --- a/capchild/capture_ifinfo.h +++ b/caputils/capture_ifinfo.h diff --git a/capture_win_ifnames.c b/caputils/capture_win_ifnames.c index ee1c3d12e8..b18250f57d 100644 --- a/capture_win_ifnames.c +++ b/caputils/capture_win_ifnames.c @@ -48,7 +48,7 @@ #include "log.h" #include <capchild/capture_ifinfo.h> -#include "capture_win_ifnames.h" +#include "caputils/capture_win_ifnames.h" #include "wsutil/file_util.h" static int gethexdigit(const char *p) diff --git a/capture_win_ifnames.h b/caputils/capture_win_ifnames.h index 528c73de14..528c73de14 100644 --- a/capture_win_ifnames.h +++ b/caputils/capture_win_ifnames.h diff --git a/capture_wpcap_packet.c b/caputils/capture_wpcap_packet.c index 7ccf03b95c..5b3ffc479d 100644 --- a/capture_wpcap_packet.c +++ b/caputils/capture_wpcap_packet.c @@ -44,7 +44,7 @@ #include <windowsx.h> #include <Ntddndis.h> -#include "capture_wpcap_packet.h" +#include "caputils/capture_wpcap_packet.h" #include <wsutil/file_util.h> /* packet32.h requires sockaddr_storage diff --git a/capture_wpcap_packet.h b/caputils/capture_wpcap_packet.h index f043d89e92..f043d89e92 100644 --- a/capture_wpcap_packet.h +++ b/caputils/capture_wpcap_packet.h diff --git a/caputils/doxygen.cfg.in b/caputils/doxygen.cfg.in new file mode 100644 index 0000000000..cae55f4037 --- /dev/null +++ b/caputils/doxygen.cfg.in @@ -0,0 +1,81 @@ +# @configure_input@ + +@INCLUDE = ../doxygen_global.cfg + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "Wireshark Capture Utilities Library" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = @VERSION@ + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ../wsar_html + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = caputils + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = ../doxygen-core.tag=.. + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = doxygen-caputils.tag + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories +# that are symbolic links (a Unix filesystem feature) are excluded from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = wireshark-caputils.chm diff --git a/ws80211_utils.c b/caputils/ws80211_utils.c index 21f8a8a673..21f8a8a673 100644 --- a/ws80211_utils.c +++ b/caputils/ws80211_utils.c diff --git a/ws80211_utils.h b/caputils/ws80211_utils.h index 2a6e04f629..2a6e04f629 100644 --- a/ws80211_utils.h +++ b/caputils/ws80211_utils.h diff --git a/configure.ac b/configure.ac index bc081a9766..1522170bae 100644 --- a/configure.ac +++ b/configure.ac @@ -2877,6 +2877,8 @@ AC_OUTPUT( asn1/x721/Makefile capchild/Makefile capchild/doxygen.cfg + caputils/Makefile + caputils/doxygen.cfg doc/Makefile docbook/Makefile epan/Makefile @@ -92,15 +92,17 @@ #include "ringbuffer.h" #include "version_info.h" -#include "capture-pcap-util.h" +#include "caputils/capture_ifinfo.h" +#include "caputils/capture-pcap-util.h" +#include "caputils/capture-pcap-util-int.h" #ifdef _WIN32 -#include "capture-wpcap.h" +#include "caputils/capture-wpcap.h" #endif /* _WIN32 */ #include "pcapio.h" #ifdef _WIN32 -#include "capture-wpcap.h" +#include "caputils/capture-wpcap.h" #include <wsutil/unicode-utils.h> #endif @@ -119,7 +121,6 @@ #include "capture_opts.h" #include <capchild/capture_session.h> -#include <capchild/capture_ifinfo.h> #include <capchild/capture_sync.h> #include "conditions.h" @@ -130,7 +131,7 @@ #include "wsutil/file_util.h" #include "wsutil/os_version_info.h" -#include "ws80211_utils.h" +#include "caputils/ws80211_utils.h" /* * Get information about libpcap format from "wiretap/libpcap.h". @@ -4159,9 +4160,9 @@ out: static void get_dumpcap_compiled_info(GString *str) { - /* Libpcap */ + /* Capture libraries */ g_string_append(str, ", "); - get_compiled_pcap_version(str); + get_compiled_caplibs_version(str); /* LIBZ */ g_string_append(str, ", "); @@ -4175,43 +4176,14 @@ get_dumpcap_compiled_info(GString *str) #else /* HAVE_LIBZ */ g_string_append(str, "without libz"); #endif /* HAVE_LIBZ */ - -#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 get_dumpcap_runtime_info(GString *str) { - /* Libpcap */ + /* Capture libraries */ g_string_append(str, ", "); - get_runtime_pcap_version(str); + get_runtime_caplibs_version(str); /* zlib */ #if defined(HAVE_LIBZ) && !defined(_WIN32) diff --git a/echld/Makefile.am b/echld/Makefile.am index f842243ca7..b6336d286f 100644 --- a/echld/Makefile.am +++ b/echld/Makefile.am @@ -50,12 +50,14 @@ libechld_la_SOURCES = \ libechld_la_DEPENDENCIES = \ + ../caputils/libcaputils.a \ ../epan/libwireshark.la \ ../wiretap/libwiretap.la \ ../wsutil/libwsutil.la libechld_la_LIBADD = \ + ../caputils/libcaputils.a \ ../epan/libwireshark.la \ ../wsutil/libwsutil.la \ ../wiretap/libwiretap.la \ diff --git a/echld/Makefile.common b/echld/Makefile.common index af24795275..cf7033fd2d 100644 --- a/echld/Makefile.common +++ b/echld/Makefile.common @@ -41,16 +41,13 @@ LIBECHLD_INCLUDES = \ LIBECHLD_MORE_SRC = \ ../capture_opts.c \ - ../capture-pcap-util.c \ - ../capture-pcap-util-unix.c \ ../capture_stop_conditions.c \ ../cfile.c \ ../conditions.c \ ../pcapio.c \ ../ringbuffer.c \ ../sync_pipe_write.c \ - ../version_info.c \ - ../ws80211_utils.c + ../version_info.c OTHER = \ ../dumpcap.c diff --git a/echld/echld-int.h b/echld/echld-int.h index f433f883fd..acf5557a97 100644 --- a/echld/echld-int.h +++ b/echld/echld-int.h @@ -62,7 +62,7 @@ #include "capture_opts.h" #include <capchild/capture_session.h> -#include <capchild/capture_ifinfo.h> +#include <caputils/capture_ifinfo.h> #include <capchild/capture_sync.h> #include "version_info.h" #include "cfile.h" diff --git a/rawshark.c b/rawshark.c index 0661d61272..39503711a1 100644 --- a/rawshark.c +++ b/rawshark.c @@ -111,12 +111,12 @@ #include <wsutil/clopts_common.h> #include <wsutil/ws_version_info.h> -#include "capture-pcap-util.h" +#include "caputils/capture-pcap-util.h" #ifdef HAVE_LIBPCAP #include <setjmp.h> #ifdef _WIN32 -#include "capture-wpcap.h" +#include "caputils/capture-wpcap.h" #endif /* _WIN32 */ #endif /* HAVE_LIBPCAP */ #include "log.h" @@ -108,12 +108,12 @@ #include "capture_opts.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" #ifdef _WIN32 -#include "capture-wpcap.h" +#include "caputils/capture-wpcap.h" #include <wsutil/unicode-utils.h> #endif /* _WIN32 */ #include <capchild/capture_session.h> @@ -913,8 +913,8 @@ show_version(GString *comp_info_str, GString *runtime_info_str) static void get_tshark_compiled_version_info(GString *str) { - /* Libpcap */ - get_compiled_pcap_version(str); + /* Capture libraries */ + get_compiled_caplibs_version(str); /* LIBZ */ g_string_append(str, ", "); @@ -928,50 +928,15 @@ get_tshark_compiled_version_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 get_tshark_runtime_version_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/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> diff --git a/version_info.c b/version_info.c index 8d84503784..03785f9142 100644 --- a/version_info.c +++ b/version_info.c @@ -32,7 +32,6 @@ #endif #include "version_info.h" -#include "capture-pcap-util.h" #include <wsutil/glib_version_info.h> #include <wsutil/os_version_info.h> #include <wsutil/compiler_info.h> |