diff --git a/CMakeLists.txt b/CMakeLists.txt index fc1c02e223..ad1c1c1984 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -576,16 +576,9 @@ set(INSTALL_FILES ) set(LIBEPAN_LIBS -# @GETOPT_O@ # wsgetopt.c -# @INET_ATON_LO@ # epan/inet_aton.c -# @INET_NTOP_LO@ # inet_ntop.c -# @INET_PTON_LO@ # inet_pton.c # @NSL_LIBS@ # -lnsl # @SOCKET_LIBS@ # -lsocket # @SSL_LIBS@ # -lcrypto -# @STRERROR_O@ # strerror.c -# @STRNCASECMP_O@ # strncasecmp.c -# @STRPTIME_O@ # strptime.c epan # $(plugin_ldadd) # in case of static ${PCRE_LIBRARIES} diff --git a/Makefile.am b/Makefile.am index d874e8ba5a..597cb04ab5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -295,17 +295,6 @@ endif # HAVE_PLUGINS include Makefile.common -# Optional objects that I know how to build. These will be -# linked into the wireshark executable. -# They will also be linked into the tshark executable; if this -# list ever grows to include something that can't be linked with -# tshark, or if tshark needs something that wireshark doesn't, -# we should probably split this into stuff needed both -# by wireshark and tshark and stuff needed only by one or the -# other. -wireshark_optional_objects = @GETOPT_O@ @STRERROR_O@ \ - @STRNCASECMP_O@ @STRPTIME_O@ - if ENABLE_STATIC wireshark_LDFLAGS = -Wl,-static -all-static else @@ -320,14 +309,11 @@ endif # @GTK_LIBS@ (as those are also needed for X applications, and GTK+ # applications are X applications). wireshark_LDADD = \ - $(wireshark_optional_objects) \ gtk/libui.a \ codecs/libcodec.a \ wiretap/libwiretap.la \ epan/libwireshark.la \ wsutil/libwsutil.la \ - @INET_PTON_LO@ \ - @INET_NTOP_LO@ \ @SSL_LIBS@ \ $(plugin_ldadd) \ @PCRE_LIBS@ \ @@ -351,12 +337,9 @@ endif # Libraries and plugin flags with which to link tshark. tshark_LDADD = \ - $(wireshark_optional_objects) \ wiretap/libwiretap.la \ epan/libwireshark.la \ wsutil/libwsutil.la \ - @INET_PTON_LO@ \ - @INET_NTOP_LO@ \ @SSL_LIBS@ \ $(plugin_ldadd) \ @PCRE_LIBS@ \ @@ -381,12 +364,9 @@ endif # Libraries and plugin flags with which to link rawshark. rawshark_LDADD = \ - $(wireshark_optional_objects) \ wiretap/libwiretap.la \ epan/libwireshark.la \ wsutil/libwsutil.la \ - @INET_PTON_LO@ \ - @INET_NTOP_LO@ \ @SSL_LIBS@ \ $(plugin_ldadd) \ @PCRE_LIBS@ \ @@ -403,13 +383,8 @@ rawshark_LDADD = \ @LIBSMI_LDFLAGS@ rawshark_CFLAGS = $(AM_CLEAN_CFLAGS) $(py_dissectors_dir) -# Optional objects that I know how to build, and that are needed by -# text2pcap. -text2pcap_optional_objects = @STRERROR_O@ @STRPTIME_O@ - # Libraries with which to link text2pcap. text2pcap_LDADD = \ - $(text2pcap_optional_objects) \ wiretap/libwiretap.la \ wsutil/libwsutil.la \ @GLIB_LIBS@ -lm @@ -455,7 +430,6 @@ randpkt_CFLAGS = $(AM_CLEAN_CFLAGS) $(py_dissectors_dir) # Libraries and plugin flags with which to link dftest. dftest_LDADD = \ - $(wireshark_optional_objects) \ wiretap/libwiretap.la \ wsutil/libwsutil.la \ epan/libwireshark.la \ @@ -478,7 +452,6 @@ dftest_CFLAGS = $(AM_CLEAN_CFLAGS) $(py_dissectors_dir) dumpcap_LDADD = \ wiretap/libwiretap.la \ wsutil/libwsutil.la \ - @INET_NTOP_LO@ \ @GLIB_LIBS@ \ @PCAP_LIBS@ \ @SOCKET_LIBS@ \ diff --git a/Makefile.common b/Makefile.common index e3d1a7e7dc..bb4f4b6007 100644 --- a/Makefile.common +++ b/Makefile.common @@ -131,22 +131,6 @@ TSHARK_TAP_SRC = \ tap-stats_tree.c \ tap-wspstat.c -# helpers already available on some platforms (and on others not) -EXTRA_wireshark_SOURCES = \ - wsgetopt.c \ - inet_ntop.c \ - inet_pton.c \ - strerror.c \ - strncasecmp.c \ - strptime.c - -# corresponding headers -EXTRA_wireshark_INCLUDES = \ - wsgetopt.h \ - inet_v6defs.h \ - strerror.h \ - strptime.h - # wireshark specifics wireshark_SOURCES = \ $(WIRESHARK_COMMON_SRC) \ @@ -264,5 +248,4 @@ noinst_HEADERS = \ $(WIRESHARK_COMMON_INCLUDES) \ $(SHARK_COMMON_CAPTURE_INCLUDES) \ $(wireshark_INCLUDES) \ - $(EXTRA_wireshark_INCLUDES) \ $(dumpcap_INCLUDES) diff --git a/Makefile.nmake b/Makefile.nmake index a91008b9af..75298aa5d7 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -27,7 +27,7 @@ WIN_SETUP=tools/$(WIRESHARK_TARGET_PLATFORM)-setup.sh # If $(CHECK_TAG) is null, but either config.nmake or Makefile.nmake # are newer than the $(LIBS_CHECK) target, then a detailed verification # as to the required library package files will be made. -# +# LIBS_CHECK=_libs_check_ !IF [$(SH) $(WIN_SETUP) --checktag "$(WIRESHARK_LIBS)"] != 0 CHECK_TAG=_check_tag_ @@ -72,12 +72,6 @@ dftest_OBJECTS = $(dftest_SOURCES:.c=.obj) dumpcap_OBJECTS = $(dumpcap_SOURCES:.c=.obj) randpkt_OBJECTS = $(randpkt_SOURCES:.c=.obj) -EXTRA_OBJECTS = \ - wsgetopt.obj \ - inet_ntop.obj \ - inet_pton.obj \ - strptime.obj - wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ wsock32.lib user32.lib shell32.lib comctl32.lib \ $(HHC_LIBS) \ @@ -252,28 +246,28 @@ $(RESOURCES): image wiretap\wiretap-$(WTAP_VERSION).lib: image $(ZLIB_DLL) wiretap -wireshark.exe : $(LIBS_CHECK) config.h $(wireshark_OBJECTS) wsgetopt.obj inet_ntop.obj inet_pton.obj codecs epan gtk image\wireshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib codecs\codecs.lib gtk\libui.lib plugins +wireshark.exe : $(LIBS_CHECK) config.h $(wireshark_OBJECTS) codecs epan gtk image\wireshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib codecs\codecs.lib gtk\libui.lib plugins @echo Linking $@ $(LINK) @<< - /OUT:wireshark.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:windows $(wireshark_LIBS) wsgetopt.obj inet_ntop.obj inet_pton.obj $(GTK_LIBS) codecs\codecs.lib gtk\libui.lib $(wireshark_OBJECTS) image\wireshark.res + /OUT:wireshark.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:windows $(wireshark_LIBS) $(GTK_LIBS) codecs\codecs.lib gtk\libui.lib $(wireshark_OBJECTS) image\wireshark.res << !IFDEF MANIFEST_INFO_REQUIRED mt.exe -nologo -manifest "wireshark.exe.manifest" -outputresource:wireshark.exe;1 !ENDIF -tshark.exe : $(LIBS_CHECK) config.h $(tshark_OBJECTS) wsgetopt.obj inet_ntop.obj inet_pton.obj epan image\tshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins +tshark.exe : $(LIBS_CHECK) config.h $(tshark_OBJECTS) epan image\tshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins @echo Linking $@ $(LINK) @<< - /OUT:tshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console $(tshark_LIBS) $(tshark_OBJECTS) wsgetopt.obj inet_ntop.obj inet_pton.obj image\tshark.res + /OUT:tshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console $(tshark_LIBS) $(tshark_OBJECTS) image\tshark.res << !IFDEF MANIFEST_INFO_REQUIRED mt.exe -nologo -manifest "tshark.exe.manifest" -outputresource:tshark.exe;1 !ENDIF -rawshark.exe : $(LIBS_CHECK) config.h $(rawshark_OBJECTS) wsgetopt.obj inet_ntop.obj epan image\rawshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins +rawshark.exe : $(LIBS_CHECK) config.h $(rawshark_OBJECTS) epan image\rawshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins @echo Linking $@ $(LINK) @<< - /OUT:rawshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console $(rawshark_LIBS) $(rawshark_OBJECTS) wsgetopt.obj inet_ntop.obj image\rawshark.res + /OUT:rawshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console $(rawshark_LIBS) $(rawshark_OBJECTS) image\rawshark.res << !IFDEF MANIFEST_INFO_REQUIRED mt.exe -nologo -manifest "rawshark.exe.manifest" -outputresource:rawshark.exe;1 @@ -282,10 +276,10 @@ rawshark.exe : $(LIBS_CHECK) config.h $(rawshark_OBJECTS) wsgetopt.obj inet_ntop # XXX: This makefile does not properly handle doing a 'nmake ... capinfos.exe' directly since some of the .objs # (e.g. epan\plugins.obj) must be built first using epan\Makefile.nmake (which happens for 'nmake ... all'). # Linking with setargv.obj enables "wildcard expansion" of command-line arguments -capinfos.exe : $(LIBS_CHECK) config.h $(capinfos_OBJECTS) wsgetopt.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\capinfos.res +capinfos.exe : $(LIBS_CHECK) config.h $(capinfos_OBJECTS) wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\capinfos.res @echo Linking $@ $(LINK) @<< - /OUT:capinfos.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(capinfos_OBJECTS) wsgetopt.obj $(capinfos_LIBS) setargv.obj image\capinfos.res + /OUT:capinfos.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(capinfos_OBJECTS) $(capinfos_LIBS) setargv.obj image\capinfos.res << !IFDEF MANIFEST_INFO_REQUIRED mt.exe -nologo -manifest "capinfos.exe.manifest" -outputresource:capinfos.exe;1 @@ -293,29 +287,29 @@ capinfos.exe : $(LIBS_CHECK) config.h $(capinfos_OBJECTS) wsgetopt.obj wsutil\li # XXX: This makefile does not properly handle doing a 'nmake ... editcap.exe' directly since some of the .objs # (e.g. epan\plugins.obj) must be built first using epan\Makefile.nmake (which happens for 'nmake ... all'). -editcap.exe : $(LIBS_CHECK) config.h $(editcap_OBJECTS) wsgetopt.obj strptime.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\editcap.res +editcap.exe : $(LIBS_CHECK) config.h $(editcap_OBJECTS) wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\editcap.res @echo Linking $@ $(LINK) @<< - /OUT:editcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(editcap_OBJECTS) wsgetopt.obj strptime.obj $(editcap_LIBS) image\editcap.res + /OUT:editcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(editcap_OBJECTS) $(editcap_LIBS) image\editcap.res << !IFDEF MANIFEST_INFO_REQUIRED mt.exe -nologo -manifest "editcap.exe.manifest" -outputresource:editcap.exe;1 !ENDIF # Linking with setargv.obj enables "wildcard expansion" of command-line arguments -mergecap.exe : $(LIBS_CHECK) config.h mergecap.obj merge.obj wsgetopt.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\mergecap.res +mergecap.exe : $(LIBS_CHECK) config.h mergecap.obj merge.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\mergecap.res @echo Linking $@ $(LINK) @<< - /OUT:mergecap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console mergecap.obj merge.obj wsgetopt.obj $(mergecap_LIBS) setargv.obj image\mergecap.res + /OUT:mergecap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console mergecap.obj merge.obj $(mergecap_LIBS) setargv.obj image\mergecap.res << !IFDEF MANIFEST_INFO_REQUIRED mt.exe -nologo -manifest "mergecap.exe.manifest" -outputresource:mergecap.exe;1 !ENDIF -text2pcap.exe : $(LIBS_CHECK) config.h text2pcap.obj text2pcap-scanner.obj wsgetopt.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib strptime.obj image\text2pcap.res +text2pcap.exe : $(LIBS_CHECK) config.h text2pcap.obj text2pcap-scanner.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\text2pcap.res @echo Linking $@ $(LINK) @<< - /OUT:text2pcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console text2pcap.obj text2pcap-scanner.obj wsgetopt.obj $(text2pcap_LIBS) strptime.obj image\text2pcap.res + /OUT:text2pcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console text2pcap.obj text2pcap-scanner.obj $(text2pcap_LIBS) image\text2pcap.res << !IFDEF MANIFEST_INFO_REQUIRED mt.exe -nologo -manifest "text2pcap.exe.manifest" -outputresource:text2pcap.exe;1 @@ -330,19 +324,19 @@ dftest.exe : $(dftest_OBJECTS) epan mt.exe -nologo -manifest "dftest.exe.manifest" -outputresource:dftest.exe;1 !ENDIF -randpkt.exe : $(randpkt_OBJECTS) wsgetopt.obj +randpkt.exe : $(randpkt_OBJECTS) @echo Linking $@ $(LINK) @<< - /OUT:randpkt.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(randpkt_LIBS) $(randpkt_OBJECTS) wsgetopt.obj + /OUT:randpkt.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(randpkt_LIBS) $(randpkt_OBJECTS) << !IFDEF MANIFEST_INFO_REQUIRED mt.exe -nologo -manifest "randpkt.exe.manifest" -outputresource:randpkt.exe;1 !ENDIF -dumpcap.exe : $(LIBS_CHECK) config.h $(dumpcap_OBJECTS) wsgetopt.obj inet_ntop.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\dumpcap.res +dumpcap.exe : $(LIBS_CHECK) config.h $(dumpcap_OBJECTS) wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\dumpcap.res @echo Linking $@ $(LINK) @<< - /OUT:dumpcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(dumpcap_LIBS) $(dumpcap_OBJECTS) wsgetopt.obj inet_ntop.obj image\dumpcap.res + /OUT:dumpcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(dumpcap_LIBS) $(dumpcap_OBJECTS) image\dumpcap.res << !IFDEF MANIFEST_INFO_REQUIRED mt.exe -nologo -manifest "dumpcap.exe.manifest" -outputresource:dumpcap.exe;1 @@ -428,7 +422,7 @@ text2pcap-scanner.obj : text2pcap-scanner.c $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $? # -# The following targets will rebuild their respective objs +# The following targets will rebuild their respective objs # if and when svnversion.h should change. # @@ -449,7 +443,7 @@ version_info.obj : $*.c svnversion.h clean-local: clean-deps rm -f $(wireshark_OBJECTS) $(tshark_OBJECTS) $(dumpcap_OBJECTS) $(rawshark_OBJECTS) \ - $(EXTRA_OBJECTS) $(EXECUTABLES) *.pdb *.exe.manifest \ + $(EXECUTABLES) *.pdb *.exe.manifest \ capinfos.obj editcap.obj mergecap.obj text2pcap.obj \ nio-ie5.obj update.obj \ text2pcap-scanner.obj text2pcap-scanner.c rdps.obj \ @@ -687,7 +681,7 @@ doxygen-run: !ENDIF doxygen: doxygen.cfg doxygen-run - + ################################################################################ # Prepare build environment by downloading and installing required libraries @@ -736,7 +730,7 @@ check_libs: # If $(CHECK_TAG) is non-null then checktag failed; Exit with an error message. (See beginning of this Makefile). # Otherwise do detailed library package files verification only if Makefile.nmake or config.make have been updated # (or dummy file doesn't exist because of 'make clean' or whatever). -# Note that the creation/modification time of a file after an svn update of that file +# Note that the creation/modification time of a file after an svn update of that file # is the time of the update (not the time of the file in the repository). # touch is only called if libverify succeeds. $(LIBS_CHECK): $(CHECK_TAG) config.nmake Makefile.nmake @@ -972,9 +966,9 @@ install-generated-files: xcopy ".\wimaxasncp\*.*" $(INSTALL_DIR)\wimaxasncp /d if not exist $(INSTALL_DIR)\plugins mkdir $(INSTALL_DIR)\plugins if not exist $(INSTALL_DIR)\plugins\$(VERSION) mkdir $(INSTALL_DIR)\plugins\$(VERSION) - cd plugins - $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake install-plugins - cd .. + cd plugins + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake install-plugins + cd .. # "install-all" will copy all files needed to run Wireshark/Tshark # to the INSTALL_DIR, so you can run/debug Wireshark/Tshark from there. diff --git a/capinfos.c b/capinfos.c index 4a9cf85ed0..7d3223098a 100644 --- a/capinfos.c +++ b/capinfos.c @@ -82,7 +82,7 @@ #ifdef HAVE_GETOPT_H #include #else -#include "wsgetopt.h" +#include "wsutil/wsgetopt.h" #endif #include "svnversion.h" diff --git a/capture_ifinfo.c b/capture_ifinfo.c index a9648753bd..f4dffd4530 100644 --- a/capture_ifinfo.c +++ b/capture_ifinfo.c @@ -44,7 +44,7 @@ #endif #ifdef NEED_INET_V6DEFS_H -# include "inet_v6defs.h" +# include "wsutil/inet_v6defs.h" #endif #include diff --git a/dftest.c b/dftest.c index 03e884b8a3..a9ed864588 100644 --- a/dftest.c +++ b/dftest.c @@ -33,7 +33,7 @@ #include #ifdef NEED_STRERROR_H -#include "strerror.h" +#include "wsutil/strerror.h" #endif #include diff --git a/dumpcap.c b/dumpcap.c index 3ba302e344..f01eca6960 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -62,7 +62,7 @@ #ifdef HAVE_GETOPT_H #include #else -#include "wsgetopt.h" +#include "wsutil/wsgetopt.h" #endif #ifdef HAVE_NETDB_H @@ -95,7 +95,7 @@ #endif #ifdef NEED_INET_V6DEFS_H -# include "inet_v6defs.h" +# include "wsutil/inet_v6defs.h" #endif #include @@ -674,7 +674,7 @@ get_if_capabilities(const char *devname, gboolean monitor_mode g_free(caps); return NULL; } - status = pcap_can_set_rfmon(pch); + status = pcap_can_set_rfmon(pch); if (status < 0) { /* Error. */ if (status == PCAP_ERROR) diff --git a/editcap.c b/editcap.c index 724f7abdd9..3492fb75cc 100644 --- a/editcap.c +++ b/editcap.c @@ -45,7 +45,7 @@ #ifdef HAVE_GETOPT_H #include #else -#include "wsgetopt.h" +#include "wsutil/wsgetopt.h" #endif #ifdef _WIN32 @@ -56,7 +56,7 @@ #endif #ifdef NEED_STRPTIME_H -# include "strptime.h" +# include "wsutil/strptime.h" #endif #include "epan/crypt/crypt-md5.h" @@ -141,7 +141,7 @@ abs_time_to_str_with_sec_resolution(const struct wtap_nstime *abs_time) { struct tm *tmp; gchar *buf = g_malloc(16); - + #ifdef _MSC_VER /* calling localtime() on MSVC 2005 with huge values causes it to crash */ /* XXX - find the exact value that still does work */ @@ -166,7 +166,7 @@ abs_time_to_str_with_sec_resolution(const struct wtap_nstime *abs_time) } static gchar* -fileset_get_filename_by_pattern(guint idx, const struct wtap_nstime *time_val, +fileset_get_filename_by_pattern(guint idx, const struct wtap_nstime *time_val, gchar *fprefix, gchar *fsuffix) { gchar filenum[5+1]; @@ -1003,7 +1003,7 @@ main(int argc, char *argv[]) pdh = wtap_dump_open(filename, out_file_type, out_frame_type, wtap_snapshot_length(wth), FALSE /* compressed */, &err); - if (pdh == NULL) { + if (pdh == NULL) { fprintf(stderr, "editcap: Can't open or create %s: %s\n", filename, wtap_strerror(err)); exit(2); @@ -1045,7 +1045,7 @@ main(int argc, char *argv[]) if (split_packet_count > 0) { /* time for the next file? */ - if (written_count > 0 && + if (written_count > 0 && written_count % split_packet_count == 0) { if (!wtap_dump_close(pdh, &err)) { fprintf(stderr, "editcap: Error writing to %s: %s\n", filename, @@ -1274,7 +1274,7 @@ main(int argc, char *argv[]) pdh = wtap_dump_open(filename, out_file_type, out_frame_type, wtap_snapshot_length(wth), FALSE /* compressed */, &err); if (pdh == NULL) { - fprintf(stderr, "editcap: Can't open or create %s: %s\n", filename, + fprintf(stderr, "editcap: Can't open or create %s: %s\n", filename, wtap_strerror(err)); exit(2); } diff --git a/epan/Makefile.am b/epan/Makefile.am index c7aa198e92..3200047410 100644 --- a/epan/Makefile.am +++ b/epan/Makefile.am @@ -87,10 +87,6 @@ libwireshark_asmopt_la_SOURCES = \ asm_utils.h \ asm_utils_win32_x86.asm -EXTRA_libwireshark_la_SOURCES = \ - inet_aton.c \ - inet_aton.h - EXTRA_DIST = \ diam_dict.l \ dtd_grammar.lemon \ @@ -116,8 +112,6 @@ CLEANFILES = \ libwireshark_generated.la \ libwireshark_asmopt.a \ libwireshark_asmopt.la \ - inet_ntop.c \ - inet_pton.c \ *~ DISTCLEANFILES = \ @@ -189,12 +183,6 @@ tvbtest.o exntest.o: exceptions.h sminmpec.c: enterprise-numbers ../tools/make-sminmpec.pl $(PERL) $(srcdir)/../tools/make-sminmpec.pl $(srcdir)/enterprise-numbers sminmpec.c -inet_ntop.c: - ln -s $(srcdir)/../inet_ntop.c . - -inet_pton.c: - ln -s $(srcdir)/../inet_pton.c . - if HAVE_PLUGINS if ENABLE_STATIC diff --git a/epan/Makefile.nmake b/epan/Makefile.nmake index 6db84ef56e..b0e2d43ed7 100644 --- a/epan/Makefile.nmake +++ b/epan/Makefile.nmake @@ -56,11 +56,6 @@ libwireshark_LIBS = \ LIBWIRESHARK_OBJECTS = $(LIBWIRESHARK_ALL_SRC:.c=.obj) EXTRA_OBJECTS = \ -# strerror.obj \ - inet_aton.obj \ - inet_pton.obj \ - inet_ntop.obj \ - strptime.obj \ !IF defined(NASM) && "$(WIRESHARK_TARGET_PLATFORM)" == "win32" asm_utils_win32_x86.obj !ELSE @@ -107,7 +102,7 @@ clean-local: libwireshark.lib libwireshark.dll *.manifest libwireshark.exp \ *.pdb doxygen.cfg html/*.* \ exntest.obj exntest.exe reassemble_test.obj reassemble_test.exe tvbtest.obj tvbtest.exe - if exist html rmdir html + if exist html rmdir html clean: clean-local cd crc @@ -134,13 +129,12 @@ clean: clean-local # the same for now. # distclean-local: clean-local - rm -f config.h register.c mkstemp.c strptime.c \ - inet_ntop.c inet_pton.c \ + rm -f config.h register.c mkstemp.c \ $(LIBWIRESHARK_DISTCLEAN_GENERATED_SRC) \ $(LIBWIRESHARK_DISTCLEAN_GENERATED_INCLUDES) \ $(LIBWIRESHARK_NODISTCLEAN_GENERATED_SRC) \ $(LIBWIRESHARK_NODISTCLEAN_GENERATED_INCLUDES) \ - dtd_grammar.out sminmpec.c + dtd_grammar.out sminmpec.c distclean: distclean-local cd crc @@ -285,28 +279,11 @@ asm_utils_win32_x86.obj: asm_utils_win32_x86.asm $(NASM) -f $(WIRESHARK_TARGET_PLATFORM) -o $@ $? !ENDIF -# (Windows only) Copy some sources from /trunk to /trunk/epan. -# It is a cleaner to compile these sources separately with this makefile than -# using the object code compiled by the makefile in /trunk for both dynamically -# and statically linking - -strptime.c: ..\strptime.c - set copycmd=/y - xcopy ..\strptime.c . /d - -inet_ntop.c: ..\inet_ntop.c - set copycmd=/y - xcopy ..\inet_ntop.c . /d - -inet_pton.c: ..\inet_pton.c - set copycmd=/y - xcopy ..\inet_pton.c . /d - sminmpec.c: enterprise-numbers ..\tools\make-sminmpec.pl $(PERL) ../tools/make-sminmpec.pl enterprise-numbers sminmpec.c RUNLEX=..\tools\runlex.sh - + diam_dict_lex.h: diam_dict.c diam_dict.obj : diam_dict.c $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $? diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index 4a33c8dd25..758f66a328 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -90,11 +90,11 @@ #endif #ifdef NEED_INET_ATON_H -# include "inet_aton.h" +# include "wsutil/inet_aton.h" #endif #ifdef NEED_INET_V6DEFS_H -# include "inet_v6defs.h" +# include "wsutil/inet_v6defs.h" #endif #if defined(_WIN32) && defined(INET6) diff --git a/epan/address_to_str.c b/epan/address_to_str.c index a09a4ae11c..1c39a57d66 100644 --- a/epan/address_to_str.c +++ b/epan/address_to_str.c @@ -50,7 +50,7 @@ #endif #ifdef NEED_INET_V6DEFS_H -# include "inet_v6defs.h" +# include "wsutil/inet_v6defs.h" #endif #include "to_str.h" @@ -395,7 +395,7 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len) /* copy to output buffer */ if (tempptr != temp) { size_t temp_len = (size_t) (tempptr - temp); - + if (temp_len < (size_t) buf_len) { memcpy(buf, temp, temp_len); buf[temp_len] = '\0'; diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c index 68672f4e0c..c14f8e3670 100644 --- a/epan/dissectors/packet-dcom.c +++ b/epan/dissectors/packet-dcom.c @@ -90,7 +90,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c index 5cc1bd437e..d4969b19e7 100644 --- a/epan/dissectors/packet-dtls.c +++ b/epan/dissectors/packet-dtls.c @@ -70,7 +70,9 @@ #include #include #include -#include "inet_v6defs.h" +#ifdef NEED_INET_V6DEFS_H +#include "wsutil/inet_v6defs.h" +#endif #include "packet-ssl-utils.h" /* we need to remember the top tree so that subdissectors we call are created diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c index 4858bd63e3..4beee5a6be 100644 --- a/epan/dissectors/packet-giop.c +++ b/epan/dissectors/packet-giop.c @@ -289,7 +289,7 @@ #include #include #ifdef NEED_STRERROR_H -#include "strerror.h" +#include "wsutil/strerror.h" #endif #include "isprint.h" diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index 877c867fc1..9e936f4568 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -50,7 +50,7 @@ #endif #ifdef NEED_INET_V6DEFS_H -# include "inet_v6defs.h" +# include "wsutil/inet_v6defs.h" #endif #include diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c index 2b95d9ca46..25b2aaca35 100644 --- a/epan/dissectors/packet-ssl.c +++ b/epan/dissectors/packet-ssl.c @@ -121,7 +121,9 @@ #include #include #include -#include "inet_v6defs.h" +#ifdef NEED_INET_V6DEFS_H +#include "wsutil/inet_v6defs.h" +#endif #include "packet-x509if.h" #include "packet-ssl.h" #include "packet-ssl-utils.h" diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index be9103a66e..898b63968a 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -59,7 +59,7 @@ #endif #ifdef NEED_INET_V6DEFS_H -# include "inet_v6defs.h" +# include "wsutil/inet_v6defs.h" #endif #include diff --git a/epan/ftypes/ftype-time.c b/epan/ftypes/ftype-time.c index fd81266722..b091c3bd23 100644 --- a/epan/ftypes/ftype-time.c +++ b/epan/ftypes/ftype-time.c @@ -42,7 +42,7 @@ #include #ifdef NEED_STRPTIME_H -#include "strptime.h" +#include "wsutil/strptime.h" #endif static gboolean @@ -175,14 +175,14 @@ relative_val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _ { char *curptr, *endptr; gboolean negative = FALSE; - + curptr = s; if(*curptr == '-') { negative = TRUE; curptr++; } - + /* * If it doesn't begin with ".", it should contain a seconds * value. @@ -313,7 +313,7 @@ value_get(fvalue_t *fv) { return &(fv->value.time); } - + static int absolute_val_repr_len(fvalue_t *fv, ftrepr_t rtype _U_) { @@ -331,7 +331,7 @@ absolute_val_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, char *buf) abs_time_to_str(&fv->value.time, ABSOLUTE_TIME_LOCAL, rtype == FTREPR_DISPLAY)); } - + static int relative_val_repr_len(fvalue_t *fv, ftrepr_t rtype _U_) { diff --git a/gtk/main.c b/gtk/main.c index 45e36a8512..cbb5f2d98f 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -42,13 +42,13 @@ #endif #ifdef NEED_STRERROR_H -#include "strerror.h" +#include "wsutil/strerror.h" #endif #ifdef HAVE_GETOPT_H #include #else -#include "wsgetopt.h" +#include "wsutil/wsgetopt.h" #endif #ifdef _WIN32 /* Needed for console I/O */ @@ -1774,7 +1774,7 @@ main_capture_callback(gint event, capture_options *capture_opts, gpointer user_d { #ifdef HAVE_GTKOSXAPPLICATION GtkOSXApplication *theApp; -#endif +#endif switch(event) { case(capture_cb_capture_prepared): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture prepared"); @@ -2058,7 +2058,7 @@ main(int argc, char *argv[]) #ifdef HAVE_GTKOSXAPPLICATION GtkOSXApplication *theApp; #endif - + #ifdef HAVE_LIBPCAP #if defined(_WIN32) || defined(HAVE_PCAP_CREATE) #define OPTSTRING_B "B:" @@ -3010,7 +3010,7 @@ main(int argc, char *argv[]) gtk_osxapplication_set_dock_icon_pixbuf(theApp,gdk_pixbuf_new_from_xpm_data(wsicon64_xpm)); gtk_osxapplication_ready(theApp); #endif - + g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_INFO, "Wireshark is up and ready to go"); /* we'll enter the GTK loop now and hand the control over to GTK ... */ @@ -3033,7 +3033,7 @@ main(int argc, char *argv[]) #ifdef HAVE_GTKOSXAPPLICATION g_object_unref(theApp); #endif - + /* Shutdown windows sockets */ WSACleanup(); diff --git a/mergecap.c b/mergecap.c index bf58298cca..05bb517666 100644 --- a/mergecap.c +++ b/mergecap.c @@ -30,7 +30,7 @@ #ifdef HAVE_GETOPT_H #include #else -#include "wsgetopt.h" +#include "wsutil/wsgetopt.h" #endif #include "svnversion.h" diff --git a/randpkt.c b/randpkt.c index 4b6644fa68..941b267643 100644 --- a/randpkt.c +++ b/randpkt.c @@ -30,7 +30,7 @@ #ifdef HAVE_GETOPT_H #include #else -#include "wsgetopt.h" +#include "wsutil/wsgetopt.h" #endif #ifdef HAVE_UNISTD_H diff --git a/rawshark.c b/rawshark.c index 23cff51cb5..6a7d89606c 100644 --- a/rawshark.c +++ b/rawshark.c @@ -62,13 +62,13 @@ #endif #ifdef NEED_STRERROR_H -#include "strerror.h" +#include "wsutil/strerror.h" #endif #ifdef HAVE_GETOPT_H #include #else -#include "wsgetopt.h" +#include "wsutil/wsgetopt.h" #endif #include diff --git a/text2pcap.c b/text2pcap.c index 825fa2a12b..f75a9f48df 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -128,11 +128,11 @@ #ifdef HAVE_GETOPT_H #include #else -#include "wsgetopt.h" +#include "wsutil/wsgetopt.h" #endif #ifdef NEED_STRPTIME_H -# include "strptime.h" +# include "wsutil/strptime.h" #endif #include "text2pcap.h" @@ -1075,7 +1075,7 @@ usage (void) " -u , prepend dummy UDP header with specified\n" " dest and source ports (in DECIMAL).\n" " Automatically prepends Ethernet & IP headers as well.\n" - " Example: -u 1000 69 to make the packets look like TFTP/UDP packets.\n" + " Example: -u 1000 69 to make the packets look like TFTP/UDP packets.\n" " -T , prepend dummy TCP header with specified\n" " dest and source ports (in DECIMAL).\n" " Automatically prepends Ethernet & IP headers as well.\n" diff --git a/tshark.c b/tshark.c index 73c810a2ca..f25305a669 100644 --- a/tshark.c +++ b/tshark.c @@ -52,13 +52,13 @@ #endif #ifdef NEED_STRERROR_H -#include "strerror.h" +#include "wsutil/strerror.h" #endif #ifdef HAVE_GETOPT_H #include #else -#include "wsgetopt.h" +#include "wsutil/wsgetopt.h" #endif #include diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt index 96b96b70d5..4bef18437d 100644 --- a/wsutil/CMakeLists.txt +++ b/wsutil/CMakeLists.txt @@ -29,6 +29,13 @@ IF(WIN32) ENDIF(WIN32) set(WSUTIL_FILES +# @GETOPT_O@ # wsgetopt.c +# @INET_ATON_LO@ # inet_aton.c +# @INET_NTOP_LO@ # inet_ntop.c +# @INET_PTON_LO@ # inet_pton.c +# @STRERROR_O@ # strerror.c +# @STRNCASECMP_O@ # strncasecmp.c +# @STRPTIME_O@ # strptime.c mpeg-audio.c privileges.c str_util.c diff --git a/wsutil/Makefile.am b/wsutil/Makefile.am index 461557d45c..84a643b6cf 100644 --- a/wsutil/Makefile.am +++ b/wsutil/Makefile.am @@ -28,24 +28,46 @@ if HAVE_WARNINGS_AS_ERRORS AM_CFLAGS = -Werror endif +# Optional objects that I know how to build. These will be +# linked into libwsutil. +wsutil_optional_objects = \ + @GETOPT_O@ \ + @STRERROR_O@ \ + @STRNCASECMP_O@ \ + @STRPTIME_O@ \ + @INET_PTON_LO@ \ + @INET_NTOP_LO@ + lib_LTLIBRARIES = libwsutil.la INCLUDES = -I$(srcdir)/.. -libwsutil_la_SOURCES = \ +libwsutil_la_SOURCES = \ $(LIBWSUTIL_SRC) \ $(LIBWSUTIL_INCLUDES) -libwsutil_la_LIBADD = @GLIB_LIBS@ +libwsutil_la_LIBADD = \ + @GLIB_LIBS@ \ + $(wsutil_optional_objects) -EXTRA_DIST = \ +EXTRA_DIST = \ Makefile.common \ Makefile.nmake \ file_util.c \ file_util.h \ + inet_ntop.c \ + inet_pton.c \ + inet_v6defs.h \ libwsutil.def \ + strerror.c \ + strerror.h \ + strncasecmp.c \ + strptime.c \ + strptime.h \ unicode-utils.c \ - unicode-utils.h + unicode-utils.h \ + wsgetopt.c \ + wsgetopt.h CLEANFILES = \ libwsutil.a \ diff --git a/wsutil/Makefile.common b/wsutil/Makefile.common index 08ee515026..9e9c56e716 100644 --- a/wsutil/Makefile.common +++ b/wsutil/Makefile.common @@ -29,14 +29,16 @@ # generated from YACC or Lex files (as Automake doesn't want them in # _SOURCES variables). LIBWSUTIL_SRC = \ + inet_aton.c \ mpeg-audio.c \ privileges.c \ - str_util.c \ + str_util.c \ type_util.c # Header files that are not generated from other files LIBWSUTIL_INCLUDES = \ + inet_aton.h \ mpeg-audio.h \ privileges.h \ - str_util.h \ + str_util.h \ type_util.h diff --git a/wsutil/Makefile.nmake b/wsutil/Makefile.nmake index d12fe41863..9f264b9292 100644 --- a/wsutil/Makefile.nmake +++ b/wsutil/Makefile.nmake @@ -22,8 +22,13 @@ CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL # For use when making libwsutil.dll libwsutil_LIBS = $(GLIB_LIBS) -OBJECTS = file_util.obj unicode-utils.obj $(LIBWSUTIL_SRC:.c=.obj) - +OBJECTS = file_util.obj \ + inet_ntop.obj \ + inet_pton.obj \ + $(LIBWSUTIL_SRC:.c=.obj) \ + strptime.obj \ + unicode-utils.obj \ + wsgetopt.obj # For use when making libwsutil.dll libwsutil.lib: libwsutil.dll diff --git a/epan/inet_aton.c b/wsutil/inet_aton.c similarity index 100% rename from epan/inet_aton.c rename to wsutil/inet_aton.c diff --git a/epan/inet_aton.h b/wsutil/inet_aton.h similarity index 100% rename from epan/inet_aton.h rename to wsutil/inet_aton.h diff --git a/inet_ntop.c b/wsutil/inet_ntop.c similarity index 100% rename from inet_ntop.c rename to wsutil/inet_ntop.c diff --git a/inet_pton.c b/wsutil/inet_pton.c similarity index 100% rename from inet_pton.c rename to wsutil/inet_pton.c diff --git a/inet_v6defs.h b/wsutil/inet_v6defs.h similarity index 100% rename from inet_v6defs.h rename to wsutil/inet_v6defs.h diff --git a/wsutil/libwsutil.def b/wsutil/libwsutil.def index db5d2ec498..ad304e8ef7 100644 --- a/wsutil/libwsutil.def +++ b/wsutil/libwsutil.def @@ -19,6 +19,15 @@ ws_stdio_rename ws_stdio_stat ws_stdio_unlink +; inet_aton.c +inet_aton + +; inet_ntop.c +inet_ntop + +; inet_pton.c +inet_pton + ; mpeg-audio.c mpa_bitrate mpa_frequency @@ -36,6 +45,9 @@ relinquish_special_privs_perm running_with_special_privs started_with_special_privs +; strptime.c +strptime + ; str_util.c ascii_strdown_inplace ascii_strup_inplace @@ -48,3 +60,9 @@ type_util_guint64_to_gdouble utf_16to8 utf_8to16 utf_8to16_snprintf + +; wsgetopt.c +getopt +optarg DATA +optind DATA +opterr DATA diff --git a/strerror.c b/wsutil/strerror.c similarity index 100% rename from strerror.c rename to wsutil/strerror.c diff --git a/strerror.h b/wsutil/strerror.h similarity index 100% rename from strerror.h rename to wsutil/strerror.h diff --git a/strncasecmp.c b/wsutil/strncasecmp.c similarity index 100% rename from strncasecmp.c rename to wsutil/strncasecmp.c diff --git a/strptime.c b/wsutil/strptime.c similarity index 100% rename from strptime.c rename to wsutil/strptime.c diff --git a/strptime.h b/wsutil/strptime.h similarity index 100% rename from strptime.h rename to wsutil/strptime.h diff --git a/wsgetopt.c b/wsutil/wsgetopt.c similarity index 100% rename from wsgetopt.c rename to wsutil/wsgetopt.c diff --git a/wsgetopt.h b/wsutil/wsgetopt.h similarity index 97% rename from wsgetopt.h rename to wsutil/wsgetopt.h index e22c634bcc..8744bed10f 100644 --- a/wsgetopt.h +++ b/wsutil/wsgetopt.h @@ -28,7 +28,7 @@ extern "C" { Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ -extern char *optarg; +WS_VAR_IMPORT char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller @@ -42,16 +42,16 @@ extern char *optarg; Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ -extern int optind; +WS_VAR_IMPORT int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ -extern int opterr; +WS_VAR_IMPORT int opterr; /* Set to an option character which was unrecognized. */ -extern int optopt; +WS_VAR_IMPORT int optopt; /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector