Create a new "Wireshark utility" library and move the mpeg-audio stuff from

wiretap to this new libwsutil.  This solves
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1677 by making libwireshark
no longer depend on libwiretap.

svn path=/trunk/; revision=25330
This commit is contained in:
Jeff Morriss 2008-05-20 21:51:01 +00:00
parent 5364227de0
commit 58459d3fba
21 changed files with 208 additions and 35 deletions

View File

@ -310,6 +310,7 @@ wireshark_LDADD = \
codecs/libcodec.a \
wiretap/libwiretap.la \
epan/libwireshark.la \
wsutil/libwsutil.la \
@INET_PTON_LO@ \
@SSL_LIBS@ \
$(plugin_ldadd) \
@ -332,6 +333,7 @@ tshark_LDADD = \
$(wireshark_optional_objects) \
wiretap/libwiretap.la \
epan/libwireshark.la \
wsutil/libwsutil.la \
@INET_PTON_LO@ \
@SSL_LIBS@ \
$(plugin_ldadd) \
@ -355,6 +357,7 @@ rawshark_LDADD = \
$(wireshark_optional_objects) \
wiretap/libwiretap.la \
epan/libwireshark.la \
wsutil/libwsutil.la \
@INET_PTON_LO@ \
@SSL_LIBS@ \
$(plugin_ldadd) \
@ -375,26 +378,31 @@ text2pcap_optional_objects = @STRERROR_O@ @STRPTIME_O@
text2pcap_LDADD = \
$(text2pcap_optional_objects) \
wiretap/libwiretap.la \
wsutil/libwsutil.la \
@GLIB_LIBS@ -lm
# Libraries with which to link mergecap.
mergecap_LDADD = \
wiretap/libwiretap.la \
wsutil/libwsutil.la \
@GLIB_LIBS@
# Libraries with which to link capinfos.
capinfos_LDADD = \
wiretap/libwiretap.la \
wsutil/libwsutil.la \
@GLIB_LIBS@
# Libraries with which to link editcap.
editcap_LDADD = \
wiretap/libwiretap.la \
wsutil/libwsutil.la \
@GLIB_LIBS@
# Libraries with which to link randpkt.
randpkt_LDADD = \
wiretap/libwiretap.la \
wsutil/libwsutil.la \
@GLIB_LIBS@ -lm \
@PCAP_LIBS@ @SOCKET_LIBS@ @NSL_LIBS@ @ADNS_LIBS@
@ -402,6 +410,7 @@ randpkt_LDADD = \
dftest_LDADD = \
$(wireshark_optional_objects) \
wiretap/libwiretap.la \
wsutil/libwsutil.la \
epan/libwireshark.la \
@SSL_LIBS@ \
$(plugin_ldadd) \
@ -416,6 +425,7 @@ dftest_LDADD = \
# Libraries with which to link dumpcap.
dumpcap_LDADD = \
wiretap/libwiretap.la \
wsutil/libwsutil.la \
@INET_NTOP_LO@ \
@GLIB_LIBS@ \
@PCAP_LIBS@ @SOCKET_LIBS@ @NSL_LIBS@ @FRAMEWORKS@ \
@ -764,12 +774,12 @@ else
install-exec-hook:
endif
DIST_SUBDIRS = asn1 codecs doc epan gtk help packaging plugins tools wiretap
DIST_SUBDIRS = asn1 codecs doc epan gtk help packaging plugins tools wiretap wsutil
if HAVE_PLUGINS
SUBDIRS = tools wiretap doc epan plugins packaging help @wireshark_SUBDIRS@
SUBDIRS = tools wsutil wiretap doc epan plugins packaging help @wireshark_SUBDIRS@
else
SUBDIRS = tools wiretap doc epan packaging help @wireshark_SUBDIRS@
SUBDIRS = tools wsutil wiretap doc epan packaging help @wireshark_SUBDIRS@
endif
wireshark.1: doc/wireshark.pod AUTHORS-SHORT-FORMAT

View File

@ -53,6 +53,7 @@ wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
epan\crypt\airpdcap.lib \
epan\dfilter\dfilter.lib \
epan\ftypes\ftypes.lib \
wsutil\libwsutil.lib \
$(ADNS_LIBS) \
$(PCRE_LIBS) \
$(ZLIB_LIBS) \
@ -70,6 +71,7 @@ tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
epan\crypt\airpdcap.lib \
epan\dfilter\dfilter.lib \
epan\ftypes\ftypes.lib \
wsutil\libwsutil.lib \
$(ADNS_LIBS) \
$(PCRE_LIBS) \
$(ZLIB_LIBS) \
@ -87,6 +89,7 @@ rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
epan\crypt\airpdcap.lib \
epan\dfilter\dfilter.lib \
epan\ftypes\ftypes.lib \
wsutil\libwsutil.lib \
$(ADNS_LIBS) \
$(PCRE_LIBS) \
$(ZLIB_LIBS) \
@ -95,22 +98,27 @@ rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
capinfos_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib shell32.lib \
wsutil\libwsutil.lib \
$(GLIB_LIBS)
editcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib shell32.lib \
wsutil\libwsutil.lib \
$(GLIB_LIBS)
mergecap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib \
wsutil\libwsutil.lib \
$(GLIB_LIBS)
text2pcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib \
wsutil\libwsutil.lib \
$(GLIB_LIBS)
dumpcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib \
wsutil\libwsutil.lib \
$(GLIB_LIBS)
dftest_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
@ -122,6 +130,7 @@ dftest_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
epan\dissectors\dissectors.lib \
epan\wireshark.lib \
epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
wsutil\libwsutil.lib \
$(ADNS_LIBS) \
$(PCRE_LIBS) \
$(ZLIB_LIBS) \
@ -131,6 +140,7 @@ dftest_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
randpkt_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
user32.lib \
wsutil\libwsutil.lib \
$(GLIB_LIBS)
EXECUTABLES=wireshark.exe tshark.exe rawshark.exe \
@ -139,11 +149,11 @@ EXECUTABLES=wireshark.exe tshark.exe rawshark.exe \
RESOURCES=image\wireshark.res image\libwireshark.res image\tshark.res \
image\capinfos.res image\editcap.res image\mergecap.res \
image\text2pcap.res image\wiretap.res image\dumpcap.res \
image\rawshark.res
image\rawshark.res image\libwsutil.res
LIBS_CHECK=_libs_check_
all: $(LIBS_CHECK) config.h tools image codecs $(ADNS_DLL) $(ZLIB_DLL) wiretap epan $(EXECUTABLES) $(RESOURCES) doc install-all
all: $(LIBS_CHECK) config.h tools image codecs $(ADNS_DLL) $(ZLIB_DLL) wsutil wiretap epan $(EXECUTABLES) $(RESOURCES) doc install-all
packaging: all
cd packaging
@ -367,13 +377,15 @@ clean-local: clean-deps
AUTHORS-SHORT-FORMAT $(LIBS_CHECK) \
dftest.obj dftest.exe randpkt.obj randpkt.ext \
doxygen.cfg \
$(RESOURCES) libwireshark.dll wiretap-$(WTAP_VERSION).dll
$(RESOURCES) libwireshark.dll wiretap-$(WTAP_VERSION).dll \
libwsutil.dll
clean: clean-local
cd asn1
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
cd ..
cd wiretap
cd ../wiretap
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
cd ../wsutil
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
cd ../codecs
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
@ -417,6 +429,8 @@ distclean-local: clean-local
distclean: distclean-local
cd wiretap
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
cd ../wsutil
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
cd ../codecs
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
cd ../gtk
@ -450,6 +464,8 @@ maintainer-clean-local: distclean-local
maintainer-clean: maintainer-clean-local
cd wiretap
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
cd ../wsutil
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
cd ../codecs
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
cd ../gtk
@ -541,6 +557,10 @@ $(ZLIB_DLL):
rm -r -f zlib.tmp
!ENDIF
wsutil::
cd wsutil
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
cd ..
wiretap::
cd wiretap
@ -845,6 +865,7 @@ install-generated-files:
xcopy ".\wiretap\wiretap-$(WTAP_VERSION).dll" $(INSTALL_DIR) /d
if exist ".\wiretap\wiretap-$(WTAP_VERSION).pdb" xcopy ".\wiretap\wiretap-$(WTAP_VERSION).pdb" $(INSTALL_DIR) /d
xcopy ".\epan\libwireshark.dll" $(INSTALL_DIR) /d
xcopy ".\wsutil\libwsutil.dll" $(INSTALL_DIR) /d
if exist ".\epan\libwireshark.pdb" xcopy ".\epan\libwireshark.pdb" $(INSTALL_DIR) /d
if exist wireshark.exe copy wireshark.exe $(INSTALL_DIR)\wireshark.exe
if exist wireshark.pdb copy wireshark.pdb $(INSTALL_DIR)\wireshark.pdb

View File

@ -35,7 +35,7 @@
#include <epan/prefs.h>
#include <epan/asn1.h>
#include <wiretap/mpeg-audio.h>
#include <wsutil/mpeg-audio.h>
#include "packet-per.h"

View File

@ -1594,6 +1594,7 @@ AC_OUTPUT(
tools/idl2wrs.sh
tools/lemon/Makefile
wiretap/Makefile
wsutil/Makefile
,)
dnl AC_CONFIG_FILES([tools/setuid-root.pl], [chmod +x tools/setuid-root.pl])

View File

@ -36,6 +36,7 @@ libwireshark_LIBS = \
$(GNUTLS_LIBS) \
$(LUA_LIBS) \
$(SMI_LIBS) \
..\wsutil\wsutil.lib \
..\wiretap\wiretap-$(WTAP_VERSION).lib \
!IFDEF ICONV_DIR
$(ICONV_DIR)\lib\iconv.lib \

View File

@ -1,7 +1,7 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
/* packet-mpeg-audio.c */
/* ../../../tools/asn2wrs.py -p mpeg-audio -c ../../../asn1/mpeg-audio/mpeg-audio.cnf -s ../../../asn1/mpeg-audio/packet-mpeg-audio-template -D ../../../asn1/mpeg-audio mpeg-audio.asn */
/* ../../tools/asn2wrs.py -p mpeg-audio -c ./mpeg-audio.cnf -s ./packet-mpeg-audio-template -D . mpeg-audio.asn */
/* Input file: packet-mpeg-audio-template.c */
@ -43,7 +43,7 @@
#include <epan/prefs.h>
#include <epan/asn1.h>
#include <wiretap/mpeg-audio.h>
#include <wsutil/mpeg-audio.h>
#include "packet-per.h"
@ -153,7 +153,7 @@ dissect_mpeg_audio_T_protection(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a
static int
dissect_mpeg_audio_INTEGER_0_15(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
0U, 15U, NULL, FALSE);
0U, 15U, NULL, FALSE);
return offset;
}
@ -163,7 +163,7 @@ dissect_mpeg_audio_INTEGER_0_15(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a
static int
dissect_mpeg_audio_INTEGER_0_3(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
0U, 3U, NULL, FALSE);
0U, 3U, NULL, FALSE);
return offset;
}
@ -284,7 +284,7 @@ dissect_mpeg_audio_OCTET_STRING_SIZE_28(tvbuff_t *tvb _U_, int offset _U_, asn1_
static int
dissect_mpeg_audio_INTEGER_0_255(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
0U, 255U, NULL, FALSE);
0U, 255U, NULL, FALSE);
return offset;
}
@ -424,7 +424,7 @@ static const value_string mpeg_audio_T_genre_vals[] = {
static int
dissect_mpeg_audio_T_genre(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
0U, 255U, NULL, FALSE);
0U, 255U, NULL, FALSE);
return offset;
}

View File

@ -6,7 +6,7 @@ include ..\config.nmake
# Nmake uses an implicit rule to build a .res from a .rc file!
ALL_RC=wireshark.rc libwireshark.rc tshark.rc rawshark.rc capinfos.rc editcap.rc text2pcap.rc mergecap.rc wiretap.rc dumpcap.rc wireshark.exe.manifest
ALL_RC=wireshark.rc libwireshark.rc tshark.rc rawshark.rc capinfos.rc editcap.rc text2pcap.rc mergecap.rc wiretap.rc dumpcap.rc libwsutil.rc wireshark.exe.manifest
all : $(ALL_RC)
wireshark.exe.manifest: wireshark.exe.manifest.in ..\config.nmake
@ -60,6 +60,11 @@ wiretap.rc : wiretap.rc.in ..\config.nmake
-e s/@RC_VERSION@/$(RC_WTAP_VERSION)/ \
< wiretap.rc.in > $@
libwsutil.rc : libwsutil.rc.in ..\config.nmake
sed -e s/@VERSION@/$(VERSION)/ \
-e s/@RC_VERSION@/$(RC_VERSION)/ \
< libwsutil.rc.in > $@
dumpcap.rc : dumpcap.rc.in ..\config.nmake
sed -e s/@VERSION@/$(VERSION)/ \
-e s/@RC_VERSION@/$(RC_VERSION)/ \

34
image/libwsutil.rc.in Normal file
View File

@ -0,0 +1,34 @@
#include "winver.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION @RC_VERSION@
PRODUCTVERSION @RC_VERSION@
FILEFLAGSMASK 0x0L
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "The Wireshark developer community, http://www.wireshark.org/\0"
VALUE "FileDescription", "Wireshark utility library\0"
VALUE "FileVersion", "@VERSION@\0"
VALUE "InternalName", "libwsutil @VERSION@\0"
VALUE "LegalCopyright", "Copyright © 2000 Gerald Combs <gerald@wireshark.org>, Gilbert Ramirez <gram@alumni.rice.edu> and others\0"
VALUE "OriginalFilename", "libwsutil.dll\0"
VALUE "ProductName", "Wireshark\0"
VALUE "ProductVersion", "@VERSION@\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@ -17,7 +17,7 @@ EXE=../../tshark.exe ../../editcap.exe \
../../wireshark.exe \
!ENDIF
../../text2pcap.exe ../../mergecap.exe ../../capinfos.exe WinPcap_4_0_2.exe
DLL=../../wiretap/wiretap-$(WTAP_VERSION).dll
DLL=../../wiretap/wiretap-$(WTAP_VERSION).dll ../../wsutil/libwsutil.dll
DOC=../../doc/ws.css \
../../doc/capinfos.html \
../../doc/dumpcap.html \

View File

@ -294,6 +294,7 @@ File "..\..\wiretap\wiretap-${WTAP_VERSION}.dll"
!ifdef ENABLE_LIBWIRESHARK
File "..\..\epan\libwireshark.dll"
!endif
File "..\..\wsutil\libwsutil.dll"
File "${GLIB_DIR}\bin\libglib-2.0-0.dll"
File "${GLIB_DIR}\bin\libgobject-2.0-0.dll"
File "${GLIB_DIR}\bin\libgmodule-2.0-0.dll"

View File

@ -35,6 +35,8 @@ if HAVE_WARNINGS_AS_ERRORS
AM_NON_GENERATED_CFLAGS = -Werror
endif
INCLUDES = -I$(srcdir)/..
CLEANFILES = \
libwiretap.a \
libwiretap.la \

View File

@ -54,7 +54,6 @@ NONGENERATED_C_FILES = \
lanalyzer.c \
libpcap.c \
mpeg.c \
mpeg-audio.c \
netmon.c \
netscreen.c \
nettl.c \
@ -99,7 +98,6 @@ NONGENERATED_HEADER_FILES = \
lanalyzer.h \
libpcap.h \
mpeg.h \
mpeg-audio.h \
netmon.h \
netscreen.h \
nettl.h \

View File

@ -21,6 +21,7 @@ OBJECTS=$(NONGENERATED_C_FILES:.c=.obj) $(GENERATED_C_FILES:.c=.obj) file_util.o
wiretap_LIBS = \
$(GLIB_LIBS) \
..\wsutil\wsutil.lib \
$(ZLIB_LIBS)
all: checkapi wiretap-$(WTAP_VERSION).dll

View File

@ -155,10 +155,6 @@
RelativePath=".\libpcap.c"
>
</File>
<File
RelativePath=".\mpeg-audio.c"
>
</File>
<File
RelativePath=".\mpeg.c"
>
@ -321,10 +317,6 @@
RelativePath=".\libpcap.h"
>
</File>
<File
RelativePath=".\mpeg-audio.h"
>
</File>
<File
RelativePath=".\mpeg.h"
>

View File

@ -35,7 +35,7 @@
#endif
#include "mpeg.h"
#include "mpeg-audio.h"
#include "wsutil/mpeg-audio.h"
#include "wtap-int.h"
#include "buffer.h"

View File

@ -28,13 +28,6 @@ file_seek
file_tell
file_error
mpa_bitrate
mpa_frequency
mpa_layer
mpa_padding
mpa_samples
mpa_version
wtap_buf_ptr
wtap_close
wtap_dump

46
wsutil/Makefile.am Normal file
View File

@ -0,0 +1,46 @@
# Makefile.am
#
# $Id$
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
if HAVE_WARNINGS_AS_ERRORS
AM_CFLAGS = -Werror
endif
lib_LTLIBRARIES = libwsutil.la
CLEANFILES = \
libwsutil.a \
libwsutil.la \
*~
MAINTAINERCLEANFILES = \
Makefile.in
libwsutil_la_SOURCES = \
mpeg-audio.c \
mpeg-audio.h
libwsutil_la_LIBADD = @GLIB_LIBS@
EXTRA_DIST = \
Makefile.nmake

51
wsutil/Makefile.nmake Normal file
View File

@ -0,0 +1,51 @@
## Makefile for building wireshark.exe with Microsoft C and nmake
## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
#
# $Id$
include ..\config.nmake
include <win32.mak>
include ..\Makefile.nmake.inc
############### no need to modify below this line #########
CFLAGS=-WX -DHAVE_CONFIG_H /I. /I.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
.c.obj::
$(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
libwsutil_LIBS =
OBJECTS = \
mpeg-audio.obj
libwsutil.lib: libwsutil.dll
libwsutil.exp: libwsutil.dll
libwsutil.dll : $(OBJECTS) libwsutil.def ..\image\libwsutil.res
$(link) $(dlllflags) $(conlibsdll) \
$(LOCAL_LDFLAGS) \
/DEF:libwsutil.def /OUT:libwsutil.dll \
/IMPLIB:libwsutil.lib \
..\image\libwsutil.res \
$(OBJECTS) $(libwsutil_LIBS)
!IF "$(MSVC_VARIANT)" == "MSVC2005" || "$(MSVC_VARIANT)" == "MSVC2005EE" || "$(MSVC_VARIANT)" == "DOTNET20"
mt.exe -nologo -manifest "libwsutil.dll.manifest" -outputresource:libwsutil.dll;2
!ENDIF
clean :
rm -f $(OBJECTS) \
libwsutil.lib \
libwsutil.exp \
libwsutil.dll \
libwsutil.dll.manifest \
*.pdb
distclean: clean
maintainer-clean: distclean

17
wsutil/libwsutil.def Normal file
View File

@ -0,0 +1,17 @@
; wsutil.def
; $Id$
; Add symbols that should be exported out of libwsutil.dll
;
; DATA symbols must be declared WS_VAR_IMPORT in the header file!
;
; NOTE: TABS DON'T WORK IN THIS FILE, USE SPACES INSTEAD!!!
;
EXPORTS
mpa_bitrate
mpa_frequency
mpa_layer
mpa_padding
mpa_samples
mpa_version