summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>1998-11-12 00:06:47 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>1998-11-12 00:06:47 +0000
commitfcb4c78a6a01d22f0db9d6de870342511030cb01 (patch)
treed32b2d7467b0266e722aa763c9b48cf0df2c802c
parentc2eeef9467d44eb4ea2cd6bd08f62f5c9c293810 (diff)
downloadwireshark-fcb4c78a6a01d22f0db9d6de870342511030cb01.tar.gz
A lengthy patch to add the wiretap library. Wiretap is not used by default
because it is still in its infancy, but it can be compiled in optionally. The library exists in its own subdirectory ethereal/wiretap. This patch also edits all the packet-*.c files to remove the #include <pcap.h> line which is unnecessary in these files. In the ethereal code, file.c is the most heavily modified with #ifdef WITH_WIRETAP lines for the optional library. svn path=/trunk/; revision=82
-rw-r--r--Makefile.am4
-rw-r--r--Makefile.in128
-rw-r--r--acconfig.h3
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure243
-rw-r--r--configure.in27
-rw-r--r--ethereal.c14
-rw-r--r--ethertype.c4
-rw-r--r--file.c53
-rw-r--r--file.h16
-rw-r--r--menu.c4
-rw-r--r--packet-aarp.c1
-rw-r--r--packet-arp.c3
-rw-r--r--packet-atalk.c1
-rw-r--r--packet-bootp.c3
-rw-r--r--packet-data.c3
-rw-r--r--packet-dns.c3
-rw-r--r--packet-eth.c3
-rw-r--r--packet-fddi.c3
-rw-r--r--packet-ip.c3
-rw-r--r--packet-ipv6.c3
-rw-r--r--packet-ipx.c8
-rw-r--r--packet-llc.c3
-rw-r--r--packet-lpd.c3
-rw-r--r--packet-nbipx.c3
-rw-r--r--packet-nbns.c3
-rw-r--r--packet-ncp.c3
-rw-r--r--packet-null.c3
-rw-r--r--packet-osi.c3
-rw-r--r--packet-ppp.c3
-rw-r--r--packet-raw.c3
-rw-r--r--packet-tr.c3
-rw-r--r--packet-trmac.c3
-rw-r--r--packet-vines.c3
-rw-r--r--packet.c25
-rw-r--r--wiretap/AUTHORS1
-rw-r--r--wiretap/COPYING1
-rw-r--r--wiretap/ChangeLog0
-rw-r--r--wiretap/INSTALL3
-rw-r--r--wiretap/Makefile.am8
-rw-r--r--wiretap/Makefile.in282
-rw-r--r--wiretap/NEWS2
-rw-r--r--wiretap/README30
-rw-r--r--wiretap/buffer.c130
-rw-r--r--wiretap/buffer.h34
-rw-r--r--wiretap/configure.in16
-rw-r--r--wiretap/debug.h57
-rw-r--r--wiretap/file.c208
-rw-r--r--wiretap/ngsniffer.c36
-rw-r--r--wiretap/ngsniffer.h11
-rw-r--r--wiretap/wtap.c69
-rw-r--r--wiretap/wtap.h104
52 files changed, 1414 insertions, 172 deletions
diff --git a/Makefile.am b/Makefile.am
index edef16f148..3031ce9b1f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -73,7 +73,7 @@ EXTRA_ethereal_SOURCES = \
snprintf-imp.h
ethereal_DEPENDENCIES = @SNPRINTF_O@
-ethereal_LDADD = @SNPRINTF_O@
+ethereal_LDADD = @SNPRINTF_O@ @LIBWIRETAP_A@
ps.c: print.ps rdps
./rdps print.ps ps.c
@@ -94,3 +94,5 @@ EXTRA_DIST = \
manuf \
print.ps \
rdps.c
+
+SUBDIRS=wiretap
diff --git a/Makefile.in b/Makefile.in
index ce37b949d6..cc4cde5cef 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -64,8 +64,10 @@ DATAFILE_DIR = @DATAFILE_DIR@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@
+LIBWIRETAP_A = @LIBWIRETAP_A@
MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
SNPRINTF_C = @SNPRINTF_C@
SNPRINTF_O = @SNPRINTF_O@
VERSION = @VERSION@
@@ -145,7 +147,7 @@ EXTRA_ethereal_SOURCES = \
snprintf-imp.h
ethereal_DEPENDENCIES = @SNPRINTF_O@
-ethereal_LDADD = @SNPRINTF_O@
+ethereal_LDADD = @SNPRINTF_O@ @LIBWIRETAP_A@
DISTCLEANFILES = \
rdps \
@@ -160,6 +162,8 @@ EXTRA_DIST = \
manuf \
print.ps \
rdps.c
+
+SUBDIRS=wiretap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
@@ -215,7 +219,7 @@ DEP_FILES = .deps/capture.P .deps/ethereal.P .deps/ethertype.P \
SOURCES = $(ethereal_SOURCES) $(EXTRA_ethereal_SOURCES)
OBJECTS = $(ethereal_OBJECTS)
-all: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h
+all: all-recursive-am all-am
.SUFFIXES:
.SUFFIXES: .S .c .o .s
@@ -358,15 +362,55 @@ uninstall-sysconfDATA:
rm -f $(DESTDIR)$(sysconfdir)/$$p; \
done
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+@SET_MAKE@
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ target=`echo $@ | sed s/-recursive//`; \
+ echo "Making $$target in $$subdir"; \
+ (cd $$subdir && $(MAKE) $$target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+ rev="$$subdir $$rev"; \
+ done; \
+ for subdir in $$rev; do \
+ target=`echo $@ | sed s/-recursive//`; \
+ echo "Making $$target in $$subdir"; \
+ (cd $$subdir && $(MAKE) $$target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ (cd $$subdir && $(MAKE) tags); \
+ done
+
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
-TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ done; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
@@ -431,6 +475,14 @@ distdir: $(DISTFILES)
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file; \
done
+ for subdir in $(SUBDIRS); do \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ chmod 777 $(distdir)/$$subdir; \
+ (cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+ || exit 1; \
+ done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
@@ -455,25 +507,36 @@ maintainer-clean-depend:
@-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
< .deps/$(*F).p > .deps/$(*F).P
@-rm -f .deps/$(*F).p
-info:
-dvi:
-check: all
- $(MAKE)
-installcheck:
-install-exec: install-binPROGRAMS install-sysconfDATA
+info: info-recursive
+dvi: dvi-recursive
+check: all-am
+ $(MAKE) check-recursive
+installcheck: installcheck-recursive
+all-recursive-am: config.h
+ $(MAKE) all-recursive
+
+all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h
+
+install-exec-am: install-binPROGRAMS install-sysconfDATA
+
+install-data-am: install-man
+
+uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall-sysconfDATA
+
+install-exec: install-exec-recursive install-exec-am
@$(NORMAL_INSTALL)
-install-data: install-man
+install-data: install-data-recursive install-data-am
@$(NORMAL_INSTALL)
-install: install-exec install-data all
+install: install-recursive install-exec-am install-data-am
@:
-uninstall: uninstall-binPROGRAMS uninstall-man uninstall-sysconfDATA
+uninstall: uninstall-recursive uninstall-am
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
-installdirs:
+installdirs: installdirs-recursive
$(mkinstalldirs) $(DATADIR)$(bindir) $(DESTDIR)$(mandir)/man1 \
$(DATADIR)$(sysconfdir)
@@ -492,21 +555,30 @@ distclean-generic:
maintainer-clean-generic:
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean: mostlyclean-hdr mostlyclean-binPROGRAMS \
+mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
mostlyclean-compile mostlyclean-tags mostlyclean-depend \
mostlyclean-generic
-clean: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
- clean-depend clean-generic mostlyclean
+clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
+ clean-depend clean-generic mostlyclean-am
-distclean: distclean-hdr distclean-binPROGRAMS distclean-compile \
- distclean-tags distclean-depend distclean-generic clean
- -rm -f config.status
+distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
+ distclean-tags distclean-depend distclean-generic \
+ clean-am
-maintainer-clean: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
+maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
- distclean
+ distclean-am
+
+mostlyclean: mostlyclean-recursive mostlyclean-am
+
+clean: clean-recursive clean-am
+
+distclean: distclean-recursive distclean-am
+ -rm -f config.status
+
+maintainer-clean: maintainer-clean-recursive maintainer-clean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
-rm -f config.status
@@ -516,10 +588,16 @@ mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile install-man1 uninstall-man1 install-man \
-uninstall-man uninstall-sysconfDATA install-sysconfDATA tags \
-mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
-distdir mostlyclean-depend distclean-depend clean-depend \
-maintainer-clean-depend info dvi installcheck install-exec install-data \
+uninstall-man uninstall-sysconfDATA install-sysconfDATA \
+install-data-recursive uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir \
+mostlyclean-depend distclean-depend clean-depend \
+maintainer-clean-depend info dvi installcheck all-recursive-am all-am \
+install-exec-am install-data-am uninstall-am install-exec install-data \
install uninstall all installdirs mostlyclean-generic distclean-generic \
clean-generic maintainer-clean-generic clean mostlyclean distclean \
maintainer-clean
diff --git a/acconfig.h b/acconfig.h
index ea2366596e..e24f8eb258 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -7,3 +7,6 @@
#undef DATAFILE_DIR
#undef NEED_SNPRINTF_H
+
+/* Define this to use the wiretap library */
+#undef WITH_WIRETAP
diff --git a/config.h.in b/config.h.in
index 3320eae5eb..83c80f7690 100644
--- a/config.h.in
+++ b/config.h.in
@@ -17,6 +17,9 @@
#undef NEED_SNPRINTF_H
+/* Define this to use the wiretap library */
+#undef WITH_WIRETAP
+
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
diff --git a/configure b/configure
index 3c568726e3..e08b44ee67 100755
--- a/configure
+++ b/configure
@@ -17,6 +17,9 @@ ac_help="$ac_help
--with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)"
ac_help="$ac_help
--disable-gtktest Do not try to compile and run a test GTK program"
+ac_help="$ac_help
+ --with-wiretap Include wiretap library.
+ --without-wiretap Don't include wiretap library (default)"
# Initialize some variables set by options.
# The variables have the same names as the options, with
@@ -555,7 +558,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:559: checking for a BSD compatible install" >&5
+echo "configure:562: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -608,7 +611,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:612: checking whether build environment is sane" >&5
+echo "configure:615: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -665,7 +668,7 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:669: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:672: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -711,7 +714,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:715: checking for working aclocal" >&5
+echo "configure:718: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -724,7 +727,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:728: checking for working autoconf" >&5
+echo "configure:731: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -737,7 +740,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:741: checking for working automake" >&5
+echo "configure:744: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -750,7 +753,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:754: checking for working autoheader" >&5
+echo "configure:757: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -763,7 +766,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:767: checking for working makeinfo" >&5
+echo "configure:770: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -784,7 +787,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:788: checking host system type" >&5
+echo "configure:791: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -808,7 +811,7 @@ echo "$ac_t""$host" 1>&6
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:812: checking for $ac_word" >&5
+echo "configure:815: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -837,7 +840,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:841: checking for $ac_word" >&5
+echo "configure:844: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -885,7 +888,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:889: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:892: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -895,11 +898,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 899 "configure"
+#line 902 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -919,12 +922,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:923: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:926: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:928: checking whether we are using GNU C" >&5
+echo "configure:931: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -933,7 +936,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:937: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:940: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -948,7 +951,7 @@ if test $ac_cv_prog_gcc = yes; then
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:952: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:955: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -975,6 +978,35 @@ else
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:985: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
# Create DATAFILE_DIR #define for config.h
DATAFILE_DIR=$sysconfdir
@@ -994,7 +1026,7 @@ EOF
case "$host_os" in
solaris*)
echo $ac_n "checking for LD_LIBRARY_PATH""... $ac_c" 1>&6
-echo "configure:998: checking for LD_LIBRARY_PATH" >&5
+echo "configure:1030: checking for LD_LIBRARY_PATH" >&5
if test x$LD_LIBRARY_PATH != x ; then
LIBS="$LIBS -R$LD_LIBRARY_PATH"
echo "$ac_t""yes -- added LD_LIBRARY_PATH to run-time linker path" 1>&6
@@ -1046,7 +1078,7 @@ fi
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1050: checking for $ac_word" >&5
+echo "configure:1082: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1077,7 +1109,7 @@ fi
min_gtk_version=1.0.0
echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:1081: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:1113: checking for GTK - version >= $min_gtk_version" >&5
no_gtk=""
if test "$GTK_CONFIG" = "no" ; then
no_gtk=yes
@@ -1100,7 +1132,7 @@ echo "configure:1081: checking for GTK - version >= $min_gtk_version" >&5
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat > conftest.$ac_ext <<EOF
-#line 1104 "configure"
+#line 1136 "configure"
#include "confdefs.h"
#include <gtk/gtk.h>
@@ -1163,7 +1195,7 @@ main ()
}
EOF
-if { (eval echo configure:1167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1197,7 +1229,7 @@ fi
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1201 "configure"
+#line 1233 "configure"
#include "confdefs.h"
#include <gtk/gtk.h>
@@ -1207,7 +1239,7 @@ int main() {
return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version));
; return 0; }
EOF
-if { (eval echo configure:1211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GTK or finding the wrong"
@@ -1248,7 +1280,7 @@ rm -f conftest*
# Pcap checks
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1252: checking how to run the C preprocessor" >&5
+echo "configure:1284: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1263,13 +1295,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1267 "configure"
+#line 1299 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1305: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -1280,13 +1312,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1284 "configure"
+#line 1316 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1290: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1322: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -1308,19 +1340,19 @@ else
fi
echo "$ac_t""$CPP" 1>&6
-ac_safe=`echo "pcap.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for pcap.h""... $ac_c" 1>&6
-echo "configure:1314: checking for pcap.h" >&5
+ac_safe=`echo "net/bpf.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for net/bpf.h""... $ac_c" 1>&6
+echo "configure:1346: checking for net/bpf.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1319 "configure"
+#line 1351 "configure"
#include "confdefs.h"
-#include <pcap.h>
+#include <net/bpf.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1324: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1356: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1339,22 +1371,22 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
:
else
echo "$ac_t""no" 1>&6
-{ echo "configure: error: Header file pcap.h not found." 1>&2; exit 1; }
+{ echo "configure: error: Header file net/bpf.h not found." 1>&2; exit 1; }
fi
-ac_safe=`echo "net/bpf.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for net/bpf.h""... $ac_c" 1>&6
-echo "configure:1348: checking for net/bpf.h" >&5
+ac_safe=`echo "pcap.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for pcap.h""... $ac_c" 1>&6
+echo "configure:1380: checking for pcap.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1353 "configure"
+#line 1385 "configure"
#include "confdefs.h"
-#include <net/bpf.h>
+#include <pcap.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1358: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1390: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1373,11 +1405,11 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
:
else
echo "$ac_t""no" 1>&6
-{ echo "configure: error: Header file net/bpf.h not found." 1>&2; exit 1; }
+{ echo "configure: error: Header file pcap.h not found." 1>&2; exit 1; }
fi
echo $ac_n "checking for pcap_open_offline in -lpcap""... $ac_c" 1>&6
-echo "configure:1381: checking for pcap_open_offline in -lpcap" >&5
+echo "configure:1413: checking for pcap_open_offline in -lpcap" >&5
ac_lib_var=`echo pcap'_'pcap_open_offline | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1385,7 +1417,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpcap $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1389 "configure"
+#line 1421 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1396,7 +1428,7 @@ int main() {
pcap_open_offline()
; return 0; }
EOF
-if { (eval echo configure:1400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1425,13 +1457,59 @@ else
fi
+# Evidently, some systems have pcap.h, etc. in */include/pcap
+echo $ac_n "checking for extraneous pcap header directories""... $ac_c" 1>&6
+echo "configure:1463: checking for extraneous pcap header directories" >&5
+found_pcap_dir=""
+for pcap_dir in /usr/include/pcap /usr/local/include/pcap
+do
+ if test -d $pcap_dir ; then
+ LIBS="$LIBS -L$pcap_dir"
+ found_pcap_dir=" $found_pcap_dir -L$pcap_dir"
+ fi
+done
+
+if test "$found_pcap_dir" != "" ; then
+ echo "$ac_t""found --$found_pcap_dir added to LIBS" 1>&6
+else
+ echo "$ac_t""not found" 1>&6
+fi
+
+# Wiretap check
+echo $ac_n "checking whether to include wiretap library""... $ac_c" 1>&6
+echo "configure:1481: checking whether to include wiretap library" >&5
+# Check whether --with-wiretap or --without-wiretap was given.
+if test "${with_wiretap+set}" = set; then
+ withval="$with_wiretap"
+ case "$withval" in
+ yes)
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define WITH_WIRETAP 1
+EOF
+
+ CFLAGS="$CFLAGS -Iwiretap"
+ LIBWIRETAP_A="wiretap/libwiretap.a"
+ ;;
+ *)
+ echo "$ac_t""no" 1>&6
+ LIBWIRETAP_A=""
+ ;;
+ esac
+else
+ echo "$ac_t""no" 1>&6
+
+fi
+
+
+
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1430: checking for ANSI C header files" >&5
+echo "configure:1508: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1435 "configure"
+#line 1513 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1439,7 +1517,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1443: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1521: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1456,7 +1534,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1460 "configure"
+#line 1538 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1474,7 +1552,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1478 "configure"
+#line 1556 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1495,7 +1573,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 1499 "configure"
+#line 1577 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1506,7 +1584,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:1510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1588: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1533,17 +1611,17 @@ for ac_hdr in fcntl.h strings.h sys/ioctl.h sys/time.h unistd.h stdarg.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1537: checking for $ac_hdr" >&5
+echo "configure:1615: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1542 "configure"
+#line 1620 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1547: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1625: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1574,17 +1652,17 @@ for ac_hdr in sys/sockio.h sys/types.h netinet/in.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1578: checking for $ac_hdr" >&5
+echo "configure:1656: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1583 "configure"
+#line 1661 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1588: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1666: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1616,12 +1694,12 @@ done
# We need libpcap's AC_LBL_SOCKADDR_SA_LEN test for get_interface_list().
echo $ac_n "checking if sockaddr struct has sa_len member""... $ac_c" 1>&6
-echo "configure:1620: checking if sockaddr struct has sa_len member" >&5
+echo "configure:1698: checking if sockaddr struct has sa_len member" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_sockaddr_has_sa_len'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1625 "configure"
+#line 1703 "configure"
#include "confdefs.h"
# include <sys/types.h>
@@ -1630,7 +1708,7 @@ int main() {
u_int i = sizeof(((struct sockaddr *)0)->sa_len)
; return 0; }
EOF
-if { (eval echo configure:1634: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_lbl_sockaddr_has_sa_len=yes
else
@@ -1652,14 +1730,14 @@ EOF
# We must know our byte order
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:1656: checking whether byte ordering is bigendian" >&5
+echo "configure:1734: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
-#line 1663 "configure"
+#line 1741 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1670,11 +1748,11 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:1674: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1752: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
-#line 1678 "configure"
+#line 1756 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1685,7 +1763,7 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:1689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1767: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@@ -1705,7 +1783,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1709 "configure"
+#line 1787 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@@ -1718,7 +1796,7 @@ main () {
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:1722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
@@ -1744,13 +1822,13 @@ fi
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:1748: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:1826: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 1754 "configure"
+#line 1832 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -1768,7 +1846,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 1772 "configure"
+#line 1850 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -1790,12 +1868,12 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
fi
echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:1794: checking for socket" >&5
+echo "configure:1872: checking for socket" >&5
if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1799 "configure"
+#line 1877 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char socket(); below. */
@@ -1818,7 +1896,7 @@ socket();
; return 0; }
EOF
-if { (eval echo configure:1822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_socket=yes"
else
@@ -1844,12 +1922,12 @@ fi
SNPRINTF_C=""
SNPRINTF_O=""
echo $ac_n "checking for snprintf""... $ac_c" 1>&6
-echo "configure:1848: checking for snprintf" >&5
+echo "configure:1926: checking for snprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_snprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1853 "configure"
+#line 1931 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char snprintf(); below. */
@@ -1872,7 +1950,7 @@ snprintf();
; return 0; }
EOF
-if { (eval echo configure:1876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_snprintf=yes"
else
@@ -1905,6 +1983,7 @@ fi
+#AC_CONFIG_SUBDIRS(wiretap)
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
@@ -2006,7 +2085,7 @@ done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
-trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile wiretap/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -2053,11 +2132,13 @@ s%@host_cpu@%$host_cpu%g
s%@host_vendor@%$host_vendor%g
s%@host_os@%$host_os%g
s%@CC@%$CC%g
+s%@RANLIB@%$RANLIB%g
s%@DATAFILE_DIR@%$DATAFILE_DIR%g
s%@GTK_CONFIG@%$GTK_CONFIG%g
s%@GTK_CFLAGS@%$GTK_CFLAGS%g
s%@GTK_LIBS@%$GTK_LIBS%g
s%@CPP@%$CPP%g
+s%@LIBWIRETAP_A@%$LIBWIRETAP_A%g
s%@SNPRINTF_C@%$SNPRINTF_C%g
s%@SNPRINTF_O@%$SNPRINTF_O%g
@@ -2101,7 +2182,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile wiretap/Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
diff --git a/configure.in b/configure.in
index 75056d6ef1..08aa2e7402 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.9 1998/10/28 21:52:48 gerald Exp $
+# $Id: configure.in,v 1.10 1998/11/12 00:06:18 gram Exp $
dnl Process this file with autoconf to produce a configure script.
AC_INIT(etypes.h)
@@ -9,6 +9,7 @@ AC_CANONICAL_HOST
dnl Checks for programs.
AC_PROG_CC
+AC_PROG_RANLIB
# Create DATAFILE_DIR #define for config.h
DATAFILE_DIR=$sysconfdir
@@ -60,6 +61,27 @@ else
AC_MSG_RESULT(not found)
fi
+# Wiretap check
+AC_MSG_CHECKING(whether to include wiretap library)
+AC_ARG_WITH(wiretap,
+[ --with-wiretap Include wiretap library.
+ --without-wiretap Don't include wiretap library (default)],
+ [ case "$withval" in
+ yes)
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(WITH_WIRETAP)
+ CFLAGS="$CFLAGS -Iwiretap"
+ LIBWIRETAP_A="wiretap/libwiretap.a"
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ LIBWIRETAP_A=""
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+AC_SUBST(LIBWIRETAP_A)
+
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h strings.h sys/ioctl.h sys/time.h unistd.h stdarg.h)
@@ -94,4 +116,5 @@ AC_SUBST(SNPRINTF_C)
AC_SUBST(SNPRINTF_O)
AM_CONFIG_HEADER(config.h)
-AC_OUTPUT(Makefile)
+#AC_CONFIG_SUBDIRS(wiretap)
+AC_OUTPUT(Makefile wiretap/Makefile)
diff --git a/ethereal.c b/ethereal.c
index 8cdb4a1297..4c9f5c9131 100644
--- a/ethereal.c
+++ b/ethereal.c
@@ -1,6 +1,6 @@
/* ethereal.c
*
- * $Id: ethereal.c,v 1.10 1998/10/29 15:58:59 gerald Exp $
+ * $Id: ethereal.c,v 1.11 1998/11/12 00:06:19 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -44,7 +44,7 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
+#include <pcap.h> /* needed for capture.h */
#include <stdio.h>
#include <string.h>
@@ -268,7 +268,11 @@ void
packet_list_select_cb(GtkWidget *w, gint row, gint col, gpointer evt) {
GList *l;
- if (cf.pfh) return;
+#ifdef WITH_WIRETAP
+ if (cf.wth) return;
+#else
+ if (cf.pfh) return;
+#endif
blank_packetinfo();
gtk_text_freeze(GTK_TEXT(byte_view));
gtk_text_set_point(GTK_TEXT(byte_view), 0);
@@ -377,7 +381,11 @@ main(int argc, char *argv[])
/* Initialize the capture file struct */
cf.plist = NULL;
+#ifdef WITH_WIRETAP
+ cf.wth = NULL;
+#else
cf.pfh = NULL;
+#endif
cf.fh = NULL;
cf.dfilter = NULL;
cf.cfilter = NULL;
diff --git a/ethertype.c b/ethertype.c
index 25a6f7f653..a42ad8b43f 100644
--- a/ethertype.c
+++ b/ethertype.c
@@ -2,7 +2,7 @@
* Routines for calling the right protocol for the ethertype.
* This is called by both packet-eth.c (Ethernet II) and packet-llc.c (SNAP)
*
- * $Id: ethertype.c,v 1.8 1998/11/03 07:45:09 guy Exp $
+ * $Id: ethertype.c,v 1.9 1998/11/12 00:06:20 gram Exp $
*
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
@@ -38,8 +38,6 @@
#include <stdio.h>
-#include <pcap.h>
-
#include "ethereal.h"
#include "packet.h"
#include "etypes.h"
diff --git a/file.c b/file.c
index 14a1598727..cd4d33a9cf 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.10 1998/10/13 07:03:32 guy Exp $
+ * $Id: file.c,v 1.11 1998/11/12 00:06:20 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -28,7 +28,10 @@
#endif
#include <gtk/gtk.h>
+
+#ifdef WITH_WIRETAP
#include <pcap.h>
+#endif
#include <stdio.h>
#include <unistd.h>
@@ -67,7 +70,9 @@ static guint32 lastsec, lastusec;
int
open_cap_file(char *fname, capture_file *cf) {
+#ifndef WITH_WIRETAP
guint32 magic[2];
+#endif
char err_str[PCAP_ERRBUF_SIZE];
struct stat cf_stat;
@@ -88,19 +93,24 @@ open_cap_file(char *fname, capture_file *cf) {
fseek(cf->fh, 0L, SEEK_END);
cf->f_len = ftell(cf->fh);
+#ifndef WITH_WIRETAP
fseek(cf->fh, 0L, SEEK_SET);
fread(magic, sizeof(guint32), 2, cf->fh);
fseek(cf->fh, 0L, SEEK_SET);
+#endif
fclose(cf->fh);
cf->fh = NULL;
-
/* set the file name beacuse we need it to set the follow stream filter */
cf->filename = g_strdup( fname );
/* Next, find out what type of file we're dealing with */
-
+#ifdef WITH_WIRETAP
+ cf->cd_t = WTAP_FILE_UNKNOWN;
+ cf->lnk_t = WTAP_ENCAP_NONE;
+#else
cf->cd_t = CD_UNKNOWN;
cf->lnk_t = DLT_NULL;
+#endif
cf->swap = 0;
cf->count = 0;
cf->drops = 0;
@@ -115,16 +125,23 @@ open_cap_file(char *fname, capture_file *cf) {
}
ssec = 0, susec = 0;
lastsec = 0, lastusec = 0;
-
+
+#ifndef WITH_WIRETAP
if (magic[0] == PCAP_MAGIC || magic[0] == SWAP32(PCAP_MAGIC)) {
/* Pcap/Tcpdump file */
cf->pfh = pcap_open_offline(fname, err_str);
if (cf->pfh == NULL) {
+#else
+ cf->wth = wtap_open_offline(fname, WTAP_FILE_UNKNOWN);
+ if (cf->wth == NULL) {
+#endif
+
simple_dialog(ESD_TYPE_WARN, NULL, "Could not open file.");
return 1;
}
+#ifndef WITH_WIRETAP
if (cf->dfilter) {
if (pcap_compile(cf->pfh, &cf->fcode, cf->dfilter, 1, 0) < 0) {
simple_dialog(ESD_TYPE_WARN, NULL, "Unable to parse filter string "
@@ -172,6 +189,13 @@ open_cap_file(char *fname, capture_file *cf) {
simple_dialog(ESD_TYPE_WARN, NULL, "Can't determine file type.");
return 1;
}
+#else
+ cf->fh = wtap_file(cf->wth);
+ cf->cd_t = wtap_file_type(cf->wth);
+ cf->snap = wtap_snapshot_length(cf->wth);
+ cf->lnk_t = wtap_encapsulation(cf->wth);
+#endif
+
return 0;
}
@@ -182,10 +206,17 @@ close_cap_file(capture_file *cf, GtkWidget *w, guint context) {
fclose(cf->fh);
cf->fh = NULL;
}
+#ifdef WITH_WIRETAP
+ if (cf->wth) {
+ wtap_close(cf->wth);
+ cf->wth = NULL;
+ }
+#else
if (cf->pfh) {
pcap_close(cf->pfh);
cf->pfh = NULL;
}
+#endif
gtk_text_freeze(GTK_TEXT(byte_view));
gtk_text_set_point(GTK_TEXT(byte_view), 0);
gtk_text_forward_delete(GTK_TEXT(byte_view),
@@ -222,11 +253,21 @@ load_cap_file(char *fname, capture_file *cf) {
timeout = gtk_timeout_add(250, file_progress_cb, (gpointer) &cf);
err = open_cap_file(fname, cf);
+#ifdef WITH_WIRETAP
+ if ((err == 0) && (cf->cd_t != WTAP_FILE_UNKNOWN)) {
+#else
if ((err == 0) && (cf->cd_t != CD_UNKNOWN)) {
+#endif
gtk_clist_freeze(GTK_CLIST(packet_list));
+#ifdef WITH_WIRETAP
+ wtap_loop(cf->wth, 0, wtap_dispatch_cb, (u_char *) cf);
+ wtap_close(cf->wth);
+ cf->wth = NULL;
+#else
pcap_loop(cf->pfh, 0, pcap_dispatch_cb, (u_char *) cf);
pcap_close(cf->pfh);
cf->pfh = NULL;
+#endif
cf->plist = g_list_first(cf->plist);
cf->fh = fopen(fname, "r");
gtk_clist_thaw(GTK_CLIST(packet_list));
@@ -261,7 +302,11 @@ load_cap_file(char *fname, capture_file *cf) {
}
void
+#ifdef WITH_WIRETAP
+wtap_dispatch_cb(u_char *user, const struct wtap_pkthdr *phdr,
+#else
pcap_dispatch_cb(u_char *user, const struct pcap_pkthdr *phdr,
+#endif
const u_char *buf) {
frame_data *fdata;
/* To do: make sure this is big enough. */
diff --git a/file.h b/file.h
index f2da3feb14..ea0c487a3f 100644
--- a/file.h
+++ b/file.h
@@ -1,7 +1,7 @@
/* file.h
* Definitions for file structures and routines
*
- * $Id: file.h,v 1.4 1998/10/12 01:40:49 gerald Exp $
+ * $Id: file.h,v 1.5 1998/11/12 00:06:21 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -29,7 +29,11 @@
#include <sys/types.h>
#include <sys/time.h>
-#include <pcap.h>
+#ifdef WITH_WIRETAP
+ #include <wtap.h>
+#else
+ #include <pcap.h>
+#endif
/* Data file formats */
#define CD_UNKNOWN 0
@@ -67,7 +71,11 @@ typedef struct _capture_file {
guint32 snap; /* Captured packet length */
gchar *iface; /* Interface */
gchar *save_file; /* File to write capture data */
+#ifdef WITH_WIRETAP
+ wtap *wth; /* Wiretap session */
+#else
pcap_t *pfh; /* Pcap session */
+#endif
gchar *dfilter; /* Display filter string */
gchar *cfilter; /* Capture filter string */
bpf_prog fcode; /* Compiled filter program */
@@ -97,7 +105,11 @@ typedef struct _snoop_frame_hdr {
int open_cap_file(char *, capture_file *);
void close_cap_file(capture_file *, GtkWidget *, guint);
int load_cap_file(char *, capture_file *);
+#ifdef WITH_WIRETAP
+void wtap_dispatch_cb(u_char *, const struct wtap_pkthdr *, const u_char *);
+#else
void pcap_dispatch_cb(u_char *, const struct pcap_pkthdr *, const u_char *);
+#endif
/* size_t read_frame_header(capture_file *); */
#endif /* file.h */
diff --git a/menu.c b/menu.c
index 5735fe1321..69fb831a3e 100644
--- a/menu.c
+++ b/menu.c
@@ -1,7 +1,7 @@
/* menu.c
* Menu routines
*
- * $Id: menu.c,v 1.9 1998/10/28 21:38:08 gerald Exp $
+ * $Id: menu.c,v 1.10 1998/11/12 00:06:22 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -30,7 +30,7 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include <pcap.h>
+#include <pcap.h> /* for capture.h */
#include <strings.h>
diff --git a/packet-aarp.c b/packet-aarp.c
index 564eeba613..33f374bc20 100644
--- a/packet-aarp.c
+++ b/packet-aarp.c
@@ -23,7 +23,6 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
diff --git a/packet-arp.c b/packet-arp.c
index 02e35f51c9..d6a9bf0498 100644
--- a/packet-arp.c
+++ b/packet-arp.c
@@ -1,7 +1,7 @@
/* packet-arp.c
* Routines for ARP packet disassembly
*
- * $Id: packet-arp.c,v 1.8 1998/11/03 07:45:10 guy Exp $
+ * $Id: packet-arp.c,v 1.9 1998/11/12 00:06:23 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -28,7 +28,6 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
diff --git a/packet-atalk.c b/packet-atalk.c
index 27f0da3ea2..6fce54b4a8 100644
--- a/packet-atalk.c
+++ b/packet-atalk.c
@@ -23,7 +23,6 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
diff --git a/packet-bootp.c b/packet-bootp.c
index 6b354d6ccc..e6e58a2008 100644
--- a/packet-bootp.c
+++ b/packet-bootp.c
@@ -2,7 +2,7 @@
* Routines for BOOTP/DHCP packet disassembly
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-bootp.c,v 1.7 1998/10/13 03:39:15 gram Exp $
+ * $Id: packet-bootp.c,v 1.8 1998/11/12 00:06:24 gram Exp $
*
* The information used comes from:
* RFC 2132: DHCP Options and BOOTP Vendor Extensions
@@ -45,7 +45,6 @@
# include <netinet/in.h>
#endif
-#include <pcap.h>
#include "ethereal.h"
#include "packet.h"
diff --git a/packet-data.c b/packet-data.c
index 95ff720da1..e389ab56c6 100644
--- a/packet-data.c
+++ b/packet-data.c
@@ -2,7 +2,7 @@
* Routines for raw data (default case)
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-data.c,v 1.4 1998/10/22 19:10:19 gram Exp $
+ * $Id: packet-data.c,v 1.5 1998/11/12 00:06:25 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -29,7 +29,6 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
diff --git a/packet-dns.c b/packet-dns.c
index 770de7bc39..21f7a67be0 100644
--- a/packet-dns.c
+++ b/packet-dns.c
@@ -1,7 +1,7 @@
/* packet-dns.c
* Routines for DNS packet disassembly
*
- * $Id: packet-dns.c,v 1.7 1998/10/15 06:40:50 guy Exp $
+ * $Id: packet-dns.c,v 1.8 1998/11/12 00:06:26 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -28,7 +28,6 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
#include <memory.h>
diff --git a/packet-eth.c b/packet-eth.c
index c33ec5039c..60aeddf88e 100644
--- a/packet-eth.c
+++ b/packet-eth.c
@@ -1,7 +1,7 @@
/* packet-eth.c
* Routines for ethernet packet disassembly
*
- * $Id: packet-eth.c,v 1.5 1998/10/10 03:32:11 gerald Exp $
+ * $Id: packet-eth.c,v 1.6 1998/11/12 00:06:26 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -35,7 +35,6 @@
#include <stdio.h>
-#include <pcap.h>
#include "ethereal.h"
#include "packet.h"
diff --git a/packet-fddi.c b/packet-fddi.c
index 51ad3df218..6b2a3f8dd1 100644
--- a/packet-fddi.c
+++ b/packet-fddi.c
@@ -3,7 +3,7 @@
*
* Laurent Deniel <deniel@worldnet.fr>
*
- * $Id: packet-fddi.c,v 1.5 1998/10/13 07:48:03 guy Exp $
+ * $Id: packet-fddi.c,v 1.6 1998/11/12 00:06:27 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -33,7 +33,6 @@
#include <stdio.h>
-#include <pcap.h>
#include "ethereal.h"
#include "packet.h"
diff --git a/packet-ip.c b/packet-ip.c
index 6363e6b049..5f70b4299f 100644
--- a/packet-ip.c
+++ b/packet-ip.c
@@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
- * $Id: packet-ip.c,v 1.10 1998/10/28 01:16:47 guy Exp $
+ * $Id: packet-ip.c,v 1.11 1998/11/12 00:06:28 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -28,7 +28,6 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
diff --git a/packet-ipv6.c b/packet-ipv6.c
index 8a775f9343..1335f58685 100644
--- a/packet-ipv6.c
+++ b/packet-ipv6.c
@@ -1,7 +1,7 @@
/* packet-ipv6.c
* Routines for IPv6 packet disassembly
*
- * $Id: packet-ipv6.c,v 1.3 1998/09/27 22:12:30 gerald Exp $
+ * $Id: packet-ipv6.c,v 1.4 1998/11/12 00:06:29 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -28,7 +28,6 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
diff --git a/packet-ipx.c b/packet-ipx.c
index 93334ac25c..e94fbc0bef 100644
--- a/packet-ipx.c
+++ b/packet-ipx.c
@@ -2,7 +2,7 @@
* Routines for NetWare's IPX
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-ipx.c,v 1.11 1998/10/14 05:18:30 gram Exp $
+ * $Id: packet-ipx.c,v 1.12 1998/11/12 00:06:30 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -29,7 +29,6 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
@@ -37,10 +36,6 @@
# include <sys/types.h>
#endif
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
#include "ethereal.h"
#include "packet.h"
#include "packet-ipx.h"
@@ -94,6 +89,7 @@ static struct port_info ports[] = {
{ 0x0551, NULL, "NWLink SMB Name Query" },
{ 0x0553, dissect_nwlink_dg,"NWLink SMB Datagram" },
{ 0x055d, NULL, "Attachmate Gateway" },
+ { 0x4001, NULL, "IPX Message" },
{ 0x0000, NULL, NULL }
};
diff --git a/packet-llc.c b/packet-llc.c
index ac342313a1..9b63756e13 100644
--- a/packet-llc.c
+++ b/packet-llc.c
@@ -2,7 +2,7 @@
* Routines for IEEE 802.2 LLC layer
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-llc.c,v 1.8 1998/10/10 03:32:12 gerald Exp $
+ * $Id: packet-llc.c,v 1.9 1998/11/12 00:06:30 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -32,7 +32,6 @@
# include <sys/types.h>
#endif
-#include <pcap.h>
#include <gtk/gtk.h>
diff --git a/packet-lpd.c b/packet-lpd.c
index 39740b95f3..151cd63e4d 100644
--- a/packet-lpd.c
+++ b/packet-lpd.c
@@ -2,7 +2,7 @@
* Routines for LPR and LPRng packet disassembly
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-lpd.c,v 1.3 1998/09/27 22:12:32 gerald Exp $
+ * $Id: packet-lpd.c,v 1.4 1998/11/12 00:06:31 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -41,7 +41,6 @@
# include <netinet/in.h>
#endif
-#include <pcap.h>
#include "ethereal.h"
#include "packet.h"
diff --git a/packet-nbipx.c b/packet-nbipx.c
index 490f29a944..d35a7f04a9 100644
--- a/packet-nbipx.c
+++ b/packet-nbipx.c
@@ -2,7 +2,7 @@
* Routines for NetBIOS over IPX packet disassembly
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-nbipx.c,v 1.3 1998/10/14 05:18:32 gram Exp $
+ * $Id: packet-nbipx.c,v 1.4 1998/11/12 00:06:32 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -29,7 +29,6 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
#include <memory.h>
diff --git a/packet-nbns.c b/packet-nbns.c
index 04b36e36f6..86f24f412d 100644
--- a/packet-nbns.c
+++ b/packet-nbns.c
@@ -3,7 +3,7 @@
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
* Much stuff added by Guy Harris <guy@netapp.com>
*
- * $Id: packet-nbns.c,v 1.5 1998/10/15 06:55:42 guy Exp $
+ * $Id: packet-nbns.c,v 1.6 1998/11/12 00:06:32 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -30,7 +30,6 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
#include <memory.h>
diff --git a/packet-ncp.c b/packet-ncp.c
index 65499ae51a..6c9a10ed7f 100644
--- a/packet-ncp.c
+++ b/packet-ncp.c
@@ -2,7 +2,7 @@
* Routines for NetWare Core Protocol
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-ncp.c,v 1.5 1998/10/27 16:43:15 gram Exp $
+ * $Id: packet-ncp.c,v 1.6 1998/11/12 00:06:34 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -29,7 +29,6 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
diff --git a/packet-null.c b/packet-null.c
index 38170cc2a6..cc7e9c7edd 100644
--- a/packet-null.c
+++ b/packet-null.c
@@ -1,7 +1,7 @@
/* packet-null.c
* Routines for null packet disassembly
*
- * $Id: packet-null.c,v 1.3 1998/11/05 10:23:27 guy Exp $
+ * $Id: packet-null.c,v 1.4 1998/11/12 00:06:34 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -35,7 +35,6 @@
#include <gtk/gtk.h>
#include <stdio.h>
#include <sys/socket.h>
-#include <pcap.h>
#include "ethereal.h"
#include "packet.h"
diff --git a/packet-osi.c b/packet-osi.c
index b12a1b800d..7434ff0261 100644
--- a/packet-osi.c
+++ b/packet-osi.c
@@ -1,7 +1,7 @@
/* packet-osi.c
* Routines for ISO/OSI network and transport protocol packet disassembly
*
- * $Id: packet-osi.c,v 1.3 1998/10/13 17:56:41 deniel Exp $
+ * $Id: packet-osi.c,v 1.4 1998/11/12 00:06:35 gram Exp $
* Laurent Deniel <deniel@worldnet.fr>
*
* Ethereal - Network traffic analyzer
@@ -37,7 +37,6 @@
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
#include <string.h>
diff --git a/packet-ppp.c b/packet-ppp.c
index 3118dfc16e..2a30a24912 100644
--- a/packet-ppp.c
+++ b/packet-ppp.c
@@ -1,7 +1,7 @@
/* packet-ppp.c
* Routines for ppp packet disassembly
*
- * $Id: packet-ppp.c,v 1.6 1998/11/05 10:16:59 guy Exp $
+ * $Id: packet-ppp.c,v 1.7 1998/11/12 00:06:36 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -34,7 +34,6 @@
#include <gtk/gtk.h>
#include <stdio.h>
-#include <pcap.h>
#include "ethereal.h"
#include "packet.h"
diff --git a/packet-raw.c b/packet-raw.c
index 656c3cc8f4..af01fe3aba 100644
--- a/packet-raw.c
+++ b/packet-raw.c
@@ -1,7 +1,7 @@
/* packet-raw.c
* Routines for raw packet disassembly
*
- * $Id: packet-raw.c,v 1.5 1998/11/05 10:23:26 guy Exp $
+ * $Id: packet-raw.c,v 1.6 1998/11/12 00:06:37 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -34,7 +34,6 @@
#include <gtk/gtk.h>
#include <stdio.h>
-#include <pcap.h>
#include "ethereal.h"
#include "packet.h"
diff --git a/packet-tr.c b/packet-tr.c
index 2c89d44f77..b14e75e6a5 100644
--- a/packet-tr.c
+++ b/packet-tr.c
@@ -2,7 +2,7 @@
* Routines for Token-Ring packet disassembly
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-tr.c,v 1.6 1998/10/13 03:38:16 gram Exp $
+ * $Id: packet-tr.c,v 1.7 1998/11/12 00:06:38 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -40,7 +40,6 @@
# include <netinet/in.h>
#endif
-#include <pcap.h>
#include "ethereal.h"
#include "packet.h"
diff --git a/packet-trmac.c b/packet-trmac.c
index d3447fcb2f..c9e06b3abe 100644
--- a/packet-trmac.c
+++ b/packet-trmac.c
@@ -2,7 +2,7 @@
* Routines for Token-Ring Media Access Control
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-trmac.c,v 1.6 1998/10/22 04:03:40 gram Exp $
+ * $Id: packet-trmac.c,v 1.7 1998/11/12 00:06:39 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -32,7 +32,6 @@
# include <sys/types.h>
#endif
-#include <pcap.h>
#include <gtk/gtk.h>
diff --git a/packet-vines.c b/packet-vines.c
index 5cb05996f2..453cf60447 100644
--- a/packet-vines.c
+++ b/packet-vines.c
@@ -1,7 +1,7 @@
/* packet-vines.c
* Routines for Banyan VINES protocol packet disassembly
*
- * $Id: packet-vines.c,v 1.2 1998/09/27 22:12:41 gerald Exp $
+ * $Id: packet-vines.c,v 1.3 1998/11/12 00:06:39 gram Exp $
*
* Don Lafontaine <lafont02@cn.ca>
*
@@ -28,7 +28,6 @@
#include "config.h"
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
diff --git a/packet.c b/packet.c
index 672058fb28..226adcd861 100644
--- a/packet.c
+++ b/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.9 1998/10/28 01:16:48 guy Exp $
+ * $Id: packet.c,v 1.10 1998/11/12 00:06:40 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -295,6 +295,28 @@ dissect_packet(const u_char *pd, guint32 ts_secs, guint32 ts_usecs,
fd->cap_len);
}
+#ifdef WITH_WIRETAP
+ switch (cf.lnk_t) {
+ case WTAP_ENCAP_ETHERNET :
+ dissect_eth(pd, fd, tree);
+ break;
+ case WTAP_ENCAP_FDDI :
+ dissect_fddi(pd, fd, tree);
+ break;
+ case WTAP_ENCAP_TR :
+ dissect_tr(pd, fd, tree);
+ break;
+ case WTAP_ENCAP_NONE :
+ dissect_null(pd, fd, tree);
+ break;
+ case WTAP_ENCAP_PPP :
+ dissect_ppp(pd, fd, tree);
+ break;
+ case WTAP_ENCAP_RAW_IP :
+ dissect_raw(pd, fd, tree);
+ break;
+ }
+#else
switch (cf.lnk_t) {
case DLT_EN10MB :
dissect_eth(pd, fd, tree);
@@ -315,4 +337,5 @@ dissect_packet(const u_char *pd, guint32 ts_secs, guint32 ts_usecs,
dissect_raw(pd, fd, tree);
break;
}
+#endif
}
diff --git a/wiretap/AUTHORS b/wiretap/AUTHORS
new file mode 100644
index 0000000000..80d5fc4440
--- /dev/null
+++ b/wiretap/AUTHORS
@@ -0,0 +1 @@
+Gilbert Ramirez Jr. <gram@verdict.uthscsa.edu>
diff --git a/wiretap/COPYING b/wiretap/COPYING
new file mode 100644
index 0000000000..6989ebe7b3
--- /dev/null
+++ b/wiretap/COPYING
@@ -0,0 +1 @@
+LGPL
diff --git a/wiretap/ChangeLog b/wiretap/ChangeLog
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/wiretap/ChangeLog
diff --git a/wiretap/INSTALL b/wiretap/INSTALL
new file mode 100644
index 0000000000..deae1bba6d
--- /dev/null
+++ b/wiretap/INSTALL
@@ -0,0 +1,3 @@
+Currently there is no need to install this library. Since wiretap has just
+been born, only ethereal uses it. Once wiretap becomes powerful enough to be
+use outside of ethereal, then we can worry about installation.
diff --git a/wiretap/Makefile.am b/wiretap/Makefile.am
new file mode 100644
index 0000000000..3cba708398
--- /dev/null
+++ b/wiretap/Makefile.am
@@ -0,0 +1,8 @@
+noinst_LIBRARIES = libwiretap.a
+
+libwiretap_a_SOURCES = \
+ buffer.c \
+ file.c \
+ ngsniffer.c \
+ wtap.c
+
diff --git a/wiretap/Makefile.in b/wiretap/Makefile.in
new file mode 100644
index 0000000000..957629736c
--- /dev/null
+++ b/wiretap/Makefile.in
@@ -0,0 +1,282 @@
+# Makefile.in generated automatically by automake 1.3 from Makefile.am
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = /bin/sh
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DISTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+CC = @CC@
+DATAFILE_DIR = @DATAFILE_DIR@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+LIBWIRETAP_A = @LIBWIRETAP_A@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SNPRINTF_C = @SNPRINTF_C@
+SNPRINTF_O = @SNPRINTF_O@
+VERSION = @VERSION@
+
+noinst_LIBRARIES = libwiretap.a
+
+libwiretap_a_SOURCES = \
+ buffer.c \
+ file.c \
+ ngsniffer.c \
+ wtap.c
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I..
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libwiretap_a_LIBADD =
+libwiretap_a_OBJECTS = buffer.o file.o ngsniffer.o wtap.o
+AR = ar
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
+LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
+Makefile.in NEWS configure.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP = --best
+DEP_FILES = .deps/buffer.P .deps/file.P .deps/ngsniffer.P .deps/wtap.P
+SOURCES = $(libwiretap_a_SOURCES)
+OBJECTS = $(libwiretap_a_OBJECTS)
+
+all: Makefile $(LIBRARIES)
+
+.SUFFIXES:
+.SUFFIXES: .S .c .o .s
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu wiretap/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-noinstLIBRARIES:
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+distclean-noinstLIBRARIES:
+
+maintainer-clean-noinstLIBRARIES:
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+libwiretap.a: $(libwiretap_a_OBJECTS) $(libwiretap_a_DEPENDENCIES)
+ -rm -f libwiretap.a
+ $(AR) cru libwiretap.a $(libwiretap_a_OBJECTS) $(libwiretap_a_LIBADD)
+ $(RANLIB) libwiretap.a
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = wiretap
+
+distdir: $(DISTFILES)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(top_distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu wiretap/Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file; \
+ done
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+
+maintainer-clean-depend:
+ -rm -rf .deps
+
+%.o: %.c
+ @echo '$(COMPILE) -c $<'; \
+ $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $<
+
+%.lo: %.c
+ @echo '$(LTCOMPILE) -c $<'; \
+ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
+ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
+ < .deps/$(*F).p > .deps/$(*F).P
+ @-rm -f .deps/$(*F).p
+info:
+dvi:
+check: all
+ $(MAKE)
+installcheck:
+install-exec:
+ @$(NORMAL_INSTALL)
+
+install-data:
+ @$(NORMAL_INSTALL)
+
+install: install-exec install-data all
+ @:
+
+uninstall:
+
+install-strip:
+ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+installdirs:
+
+
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f Makefile $(DISTCLEANFILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+mostlyclean: mostlyclean-noinstLIBRARIES mostlyclean-compile \
+ mostlyclean-tags mostlyclean-depend mostlyclean-generic
+
+clean: clean-noinstLIBRARIES clean-compile clean-tags clean-depend \
+ clean-generic mostlyclean
+
+distclean: distclean-noinstLIBRARIES distclean-compile distclean-tags \
+ distclean-depend distclean-generic clean
+ -rm -f config.status
+
+maintainer-clean: maintainer-clean-noinstLIBRARIES \
+ maintainer-clean-compile maintainer-clean-tags \
+ maintainer-clean-depend maintainer-clean-generic \
+ distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
+clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile tags mostlyclean-tags distclean-tags \
+clean-tags maintainer-clean-tags distdir mostlyclean-depend \
+distclean-depend clean-depend maintainer-clean-depend info dvi \
+installcheck install-exec install-data install uninstall all \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/wiretap/NEWS b/wiretap/NEWS
new file mode 100644
index 0000000000..bd097fd879
--- /dev/null
+++ b/wiretap/NEWS
@@ -0,0 +1,2 @@
+Wiretap 0.0.0:
+* Initial public release (in ethereal CVS tree)
diff --git a/wiretap/README b/wiretap/README
new file mode 100644
index 0000000000..82e1aad7db
--- /dev/null
+++ b/wiretap/README
@@ -0,0 +1,30 @@
+Wiretap is a library that is being developed as a future replacement for
+libpcap, the current standard Unix library for packet capturing. Libpcap is
+great in that it is very platform independent and has a wonderful BPF
+optimizing engine. But it has some shortcomings as well. These shortcomings
+came to a head during the development of Ethereal (http://ethereal.zing.org),
+a packet analyzer. As such, I began developing wiretap so that:
+
+1. The library can easily be amended with new packet filtering objects.
+Libpcap is very TCP/IP-oriented. I want to filter on IPX objects, SNA objects,
+etc. I also want any decent programmer to be able to add new filters to the
+library.
+
+2. The library can read file formats from many packet-capturing utilities.
+Libpcap only reads Libpcap files.
+
+3. The library can capture on more than one network interface at a time, and
+save this trace in one file.
+
+4. Network names can be resolved immediately after a trace and saved in the
+trace file. That way, I can ship a trace of my firewall-protected network to a
+colleague, and he'll see the proper hostnames for the IP addresses in the
+packet capture, even though he doesn't have access to the DNS server behind my
+LAN's firewall.
+
+5. I want to look into the possibility of compressing packet data when saved
+to a file, like Sniffer.
+
+
+Currently, only #2 is available. Wiretap doesn't even do any filtering yet. It
+can only be used to read packet capture files.
diff --git a/wiretap/buffer.c b/wiretap/buffer.c
new file mode 100644
index 0000000000..e39e33114f
--- /dev/null
+++ b/wiretap/buffer.c
@@ -0,0 +1,130 @@
+/*
+ buffer.c
+ --------
+
+*/
+
+
+#include <stdio.h>
+#include <string.h>
+
+#include "buffer.h"
+
+/*#define DEBUG*/
+#define DEBUG_PROGRAM_NAME "buffer.c"
+#include "debug.h"
+
+/* Initializes a buffer with a certain amount of allocated space */
+void buffer_init(Buffer* buffer, unsigned int space)
+{
+ debug("buffer_init\n");
+ buffer->data = (char*)g_malloc(space);
+ buffer->allocated = space;
+ buffer->start = 0;
+ buffer->first_free = 0;
+}
+
+/* Frees the memory used by a buffer, and the buffer struct */
+void buffer_free(Buffer* buffer)
+{
+ debug("buffer_free\n");
+ free(buffer->data);
+}
+
+/* Assures that there are 'space' bytes at the end of the used space
+ so that another routine can copy directly into the buffer space. After
+ doing that, the routine will also want to run
+ buffer_increase_length(). */
+void buffer_assure_space(Buffer* buffer, unsigned int space)
+{
+ unsigned int available_at_end = buffer->allocated - buffer->first_free;
+ unsigned int space_used;
+ int space_at_beginning;
+
+ debug("buffer_assure_space %d bytes\n", space);
+ /* If we've got the space already, good! */
+ if (space <= available_at_end) {
+ return;
+ }
+
+ /* Maybe we don't have the space available at the end, but we would
+ if we moved the used space back to the beginning of the
+ allocation. The buffer could have become fragmented through lots
+ of calls to buffer_remove_start(). I'm using buffer->start as the
+ same as 'available_at_start' in this comparison. */
+
+ /* or maybe there's just no more room. */
+
+ space_at_beginning = buffer->start >= space;
+ if (space_at_beginning || buffer->start > 0) {
+ space_used = buffer->first_free - buffer->start;
+ /* this memory copy better be safe for overlapping memory regions! */
+ memmove(buffer->data, buffer->data + buffer->start, space_used);
+ buffer->start = 0;
+ buffer->first_free = space_used;
+ }
+ /*if (buffer->start >= space) {*/
+ if (space_at_beginning) {
+ return;
+ }
+
+ /* We'll allocate more space */
+ buffer->allocated += space + 1024;
+ buffer->data = (char*)g_realloc(buffer->data, buffer->allocated);
+}
+
+void buffer_append(Buffer* buffer, char *from, unsigned int bytes)
+{
+ debug("buffer_append %d bytes\n", bytes);
+ buffer_assure_space(buffer, bytes);
+ memcpy(buffer->data + buffer->first_free, from, bytes);
+ buffer->first_free += bytes;
+}
+
+void buffer_remove_start(Buffer* buffer, unsigned int bytes)
+{
+ debug("buffer_remove_start %d bytes\n", bytes);
+ if (buffer->start + bytes > buffer->first_free) {
+ die("buffer_remove_start trying to remove %d bytes. s=%d ff=%d!\n",
+ bytes, buffer->start, buffer->first_free);
+ }
+ buffer->start += bytes;
+
+ if (buffer->start == buffer->first_free) {
+ buffer->start = 0;
+ buffer->first_free = 0;
+ }
+}
+
+
+#ifndef SOME_FUNCTIONS_ARE_DEFINES
+void buffer_increase_length(Buffer* buffer, unsigned int bytes)
+{
+ debug("buffer_increase_length %d bytes\n", bytes);
+ buffer->first_free += bytes;
+}
+#endif
+
+#ifndef SOME_FUNCTIONS_ARE_DEFINES
+unsigned int buffer_length(Buffer* buffer)
+{
+ debug("buffer_length\n");
+ return buffer->first_free - buffer->start;
+}
+#endif
+
+#ifndef SOME_FUNCTIONS_ARE_DEFINES
+char* buffer_start_ptr(Buffer* buffer)
+{
+ debug("buffer_start_ptr\n");
+ return buffer->data + buffer->start;
+}
+#endif
+
+#ifndef SOME_FUNCTIONS_ARE_DEFINES
+char* buffer_end_ptr(Buffer* buffer)
+{
+ debug("buffer_end_ptr\n");
+ return buffer->data + buffer->first_free;
+}
+#endif
diff --git a/wiretap/buffer.h b/wiretap/buffer.h
new file mode 100644
index 0000000000..1354b910de
--- /dev/null
+++ b/wiretap/buffer.h
@@ -0,0 +1,34 @@
+/*
+ buffer.h
+ --------
+
+*/
+
+#define SOME_FUNCTIONS_ARE_DEFINES
+
+typedef struct Buffer {
+
+ char *data;
+ unsigned int allocated;
+ unsigned int start;
+ unsigned int first_free;
+
+} Buffer;
+
+void buffer_init(Buffer* buffer, unsigned int space);
+void buffer_free(Buffer* buffer);
+void buffer_assure_space(Buffer* buffer, unsigned int space);
+void buffer_append(Buffer* buffer, char *from, unsigned int bytes);
+void buffer_remove_start(Buffer* buffer, unsigned int bytes);
+
+#ifdef SOME_FUNCTIONS_ARE_DEFINES
+ #define buffer_increase_length(buffer,bytes) (buffer)->first_free += (bytes)
+ #define buffer_length(buffer) ((buffer)->first_free - (buffer)->start)
+ #define buffer_start_ptr(buffer) ((buffer)->data + (buffer)->start)
+ #define buffer_end_ptr(buffer) ((buffer)->data + (buffer)->first_free)
+#else
+ void buffer_increase_length(Buffer* buffer, unsigned int bytes);
+ unsigned int buffer_length(Buffer* buffer);
+ char* buffer_start_ptr(Buffer* buffer);
+ char* buffer_end_ptr(Buffer* buffer);
+#endif
diff --git a/wiretap/configure.in b/wiretap/configure.in
new file mode 100644
index 0000000000..b52222fec2
--- /dev/null
+++ b/wiretap/configure.in
@@ -0,0 +1,16 @@
+# $Id: configure.in,v 1.1 1998/11/12 00:06:45 gram Exp $
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(wtap.c)
+AM_INIT_AUTOMAKE(libwtap.a, 0.0.0)
+AM_CONFIG_HEADER(config.h)
+
+#AC_PROG_RANLIB
+
+# Pcap checks (copied from ethereal)
+AC_CHECK_HEADER(pcap.h,, AC_MSG_ERROR(Header file pcap.h not found.))
+
+dnl Checks for header files
+AC_HEADER_STDC
+AC_CHECK_HEADERS(unistd.h)
+
+AC_OUTPUT(Makefile)
diff --git a/wiretap/debug.h b/wiretap/debug.h
new file mode 100644
index 0000000000..0c9c84489e
--- /dev/null
+++ b/wiretap/debug.h
@@ -0,0 +1,57 @@
+/* debug.h
+ -------
+ Macros for doing debug work.
+
+ Define DEBUG_PROGRAM_NAME to the name of your program. It will print out in
+ all debug messages, to separate your program's debug messages from
+ other programs' messages.
+
+ Define DEBUG to invoke the debug macros. Undefine (or don't define)
+ DEBUG to not have debug messages.
+
+ In either case, you now have three printf()-like functions:
+
+ debug() for debug-only messages
+ warn() to print to stderr
+ die() to print to stderr and exit with failure
+
+ Copyright (C) 1997 Gilbert Ramirez <gram@merece.uthscsa.edu>
+ $Id: debug.h,v 1.1 1998/11/12 00:06:45 gram Exp $
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+
+#ifdef DEBUG
+ #define debug(format, args...) fprintf(stdout, format, ## args)
+ #define warn(format, args...) { \
+ fprintf(stdout, DEBUG_PROGRAM_NAME ": " format, ## args); \
+ fprintf(stderr, DEBUG_PROGRAM_NAME ": " format, ## args); \
+ }
+ #define die(format, args...) { \
+ fprintf(stdout, DEBUG_PROGRAM_NAME ": " format, ## args); \
+ fprintf(stderr, DEBUG_PROGRAM_NAME ": " format, ## args); \
+ exit(-1); \
+ }
+#else /* not DEBUG */
+ #define debug(format, args...)
+ #define warn(format, args...) \
+ fprintf(stderr, DEBUG_PROGRAM_NAME ": " format, ## args)
+ #define die(format, args...) { \
+ fprintf(stderr, DEBUG_PROGRAM_NAME ": " format, ## args); \
+ exit(-1); \
+ }
+#endif /* DEBUG */
diff --git a/wiretap/file.c b/wiretap/file.c
new file mode 100644
index 0000000000..9265a956d6
--- /dev/null
+++ b/wiretap/file.c
@@ -0,0 +1,208 @@
+
+#include <stdio.h>
+#include <string.h>
+#include "wtap.h"
+
+/* The open_file_* routines should return the WTAP_FILE_* type
+ * that they are checking for if the file is successfully recognized
+ * as such. If the file is not of that type, the routine should return
+ * WTAP_FILE_UNKNOWN */
+static int open_file_pcap(wtap *wth, char *filename);
+static int open_file_ngsniffer(wtap *wth);
+static int open_file_lanalyzer(wtap *wth);
+static int convert_dlt_to_wtap_encap(int dlt);
+
+/* Opens a file and prepares a wtap struct */
+wtap* wtap_open_offline(char *filename, int filetype)
+{
+ wtap *wth;
+
+ wth = (wtap*)malloc(sizeof(wtap));
+
+ /* Open the file */
+ if (!(wth->fh = fopen(filename, "rb"))) {
+ return NULL;
+ }
+
+ /* If the filetype is unknown, try all my file types */
+ if (filetype == WTAP_FILE_UNKNOWN) {
+ /* WTAP_FILE_PCAP */
+ if (wth->file_type = open_file_pcap(wth, filename)) {
+ goto success;
+ }
+ /* WTAP_FILE_NGSNIFFER */
+ if (wth->file_type = open_file_ngsniffer(wth)) {
+ goto success;
+ }
+ /* WTAP_FILE_LANALYZER */
+ if (wth->file_type = open_file_lanalyzer(wth)) {
+ goto success;
+ }
+
+ printf("failed\n");
+ /* WTAP_FILE_UNKNOWN */
+ goto failure;
+ }
+
+ /* If the user tells us what the file is supposed to be, check it */
+ switch (filetype) {
+ case WTAP_FILE_PCAP:
+ if (wth->file_type = open_file_pcap(wth, filename)) {
+ goto success;
+ }
+ break;
+ case WTAP_FILE_NGSNIFFER:
+ if (wth->file_type = open_file_ngsniffer(wth)) {
+ goto success;
+ }
+ break;
+ case WTAP_FILE_LANALYZER:
+ if (wth->file_type = open_file_lanalyzer(wth)) {
+ goto success;
+ }
+ break;
+ default:
+ goto failure;
+ }
+
+ /* If we made it through the switch() statement w/o going to "success",
+ * then we failed. */
+ goto failure;
+
+failure:
+ fclose(wth->fh);
+ free(wth);
+ wth = NULL;
+ return wth;
+
+success:
+ buffer_init(&wth->frame_buffer, 1500);
+ wth->frame_number = 0;
+ wth->file_byte_offset = 0;
+ return wth;
+}
+
+
+/* libpcap/tcpdump files */
+static
+int open_file_pcap(wtap *wth, char *filename)
+{
+ int bytes_read, dlt;
+ struct pcap_file_header file_hdr;
+
+ fseek(wth->fh, 0, SEEK_SET);
+ bytes_read = fread((char*)&file_hdr, 1,
+ sizeof(struct pcap_file_header), wth->fh);
+
+ if (bytes_read != sizeof(struct pcap_file_header)) {
+ return WTAP_FILE_UNKNOWN;
+ }
+
+ if (file_hdr.magic != 0xa1b2c3d4) {
+ return WTAP_FILE_UNKNOWN;
+ }
+
+ /* This is a pcap file */
+ wth->pcap = pcap_open_offline(filename, wth->err_str);
+ dlt = pcap_datalink(wth->pcap);
+ wth->encapsulation = convert_dlt_to_wtap_encap(dlt);
+
+ /* For most file types I don't fclose my handle, but for pcap I'm
+ * letting libpcap handle the file, so I don't need an open file
+ * handle. Libpcap already has the file open with the above
+ * pcap_open_offline() */
+ fclose(wth->fh);
+
+ return WTAP_FILE_PCAP;
+}
+
+/* Network General Sniffer (c) */
+static
+int open_file_ngsniffer(wtap *wth)
+{
+ int bytes_read;
+ char magic[33];
+
+ fseek(wth->fh, 0, SEEK_SET);
+ bytes_read = fread(magic, 1, 32, wth->fh);
+
+ if (bytes_read != 32) {
+ return WTAP_FILE_UNKNOWN;
+ }
+
+ magic[16] = 0;
+
+ if (strcmp(magic, "TRSNIFF data ")) {
+ return WTAP_FILE_UNKNOWN;
+ }
+
+ /* This is a ngsniffer file */
+ wth->frame_number = 0;
+ wth->file_byte_offset = 0x10b;
+
+ /* I think this is link type */
+ if (magic[30] == 0x25) {
+ wth->encapsulation = WTAP_ENCAP_ETHERNET;
+ }
+ else if (magic[30] == 0x24) {
+ wth->encapsulation = WTAP_ENCAP_TR;
+ }
+ else {
+ g_error("The magic byte that I think tells DLT is 0x%02X\n", magic[30]);
+ exit(-1);
+ }
+
+ if (fseek(wth->fh, 0x10b, SEEK_SET) < 0) {
+ return WTAP_FILE_UNKNOWN; /* I should exit(-1) here */
+ }
+ return WTAP_FILE_NGSNIFFER;
+}
+
+/* Novell's LANAlyzer (c). */
+static
+int open_file_lanalyzer(wtap *wth)
+{
+ int bytes_read;
+ char magic[2];
+
+ fseek(wth->fh, 0, SEEK_SET);
+ bytes_read = fread(magic, 1, 2, wth->fh);
+
+ if (bytes_read != 2) {
+ return WTAP_FILE_UNKNOWN;
+ }
+
+ if (pletohs(magic) != 0x1001 && pletohs(magic) != 0x1007) {
+ return WTAP_FILE_UNKNOWN;
+ }
+
+/* return WTAP_FILE_LANALYZER; until I work on it some more */
+ return WTAP_FILE_UNKNOWN;
+}
+
+static
+int convert_dlt_to_wtap_encap(dlt)
+{
+ int encap[] = {
+ WTAP_ENCAP_NONE,
+ WTAP_ENCAP_ETHERNET,
+ WTAP_ENCAP_NONE,
+ WTAP_ENCAP_NONE,
+ WTAP_ENCAP_NONE,
+ WTAP_ENCAP_NONE,
+ WTAP_ENCAP_TR,
+ WTAP_ENCAP_NONE,
+ WTAP_ENCAP_SLIP,
+ WTAP_ENCAP_PPP,
+ WTAP_ENCAP_FDDI,
+ WTAP_ENCAP_NONE,
+ WTAP_ENCAP_RAW_IP,
+ WTAP_ENCAP_NONE,
+ WTAP_ENCAP_NONE,
+ WTAP_ENCAP_NONE,
+ WTAP_ENCAP_NONE
+ };
+
+ return encap[dlt];
+}
+
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
new file mode 100644
index 0000000000..dbe6bd57cf
--- /dev/null
+++ b/wiretap/ngsniffer.c
@@ -0,0 +1,36 @@
+#include "wtap.h"
+#include "ngsniffer.h"
+
+int ngsniffer_read(wtap *wth)
+{
+ struct ngsniffer_hdr frame_hdr;
+ int bytes_read, packet_size;
+
+ bytes_read = fread(&frame_hdr, 1, sizeof(struct ngsniffer_hdr), wth->fh);
+
+ if (bytes_read == sizeof(struct ngsniffer_hdr)) {
+ wth->frame_number++;
+ packet_size = frame_hdr.bytes;
+ buffer_assure_space(&wth->frame_buffer, packet_size);
+
+ bytes_read = fread(buffer_start_ptr(&wth->frame_buffer), 1,
+ frame_hdr.bytes, wth->fh);
+
+ if (bytes_read != packet_size) {
+ g_error("no good fread for data: %d bytes out of %d read\n",
+ bytes_read, packet_size);
+ return 0;
+ }
+
+ wth->file_byte_offset += sizeof(struct ngsniffer_hdr) + packet_size;
+
+ wth->phdr.ts.tv_sec = 0;
+ wth->phdr.ts.tv_usec = 0;
+ wth->phdr.caplen = packet_size;
+ wth->phdr.len = packet_size;
+
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/wiretap/ngsniffer.h b/wiretap/ngsniffer.h
new file mode 100644
index 0000000000..b3e3d065ff
--- /dev/null
+++ b/wiretap/ngsniffer.h
@@ -0,0 +1,11 @@
+struct ngsniffer_hdr {
+ guint32 junk1;
+ guint32 junk2;
+ guint32 junk3;
+ guint16 bytes;
+ guint16 junk4;
+ guint32 junk5;
+};
+
+
+int ngsniffer_read(wtap *wth);
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
new file mode 100644
index 0000000000..6aa2bde28a
--- /dev/null
+++ b/wiretap/wtap.c
@@ -0,0 +1,69 @@
+#include "wtap.h"
+#include "ngsniffer.h"
+
+static
+void pcap_callback_wrapper(u_char *user, const struct pcap_pkthdr *phdr,
+ const u_char *buf);
+
+wtap_handler wtap_callback = NULL;
+
+FILE* wtap_file(wtap *wth)
+{
+ if (wth->file_type == WTAP_FILE_PCAP) {
+ return pcap_file(wth->pcap);
+ }
+ else
+ return wth->fh;
+}
+
+int wtap_file_type(wtap *wth)
+{
+ return wth->file_type;
+}
+
+int wtap_encapsulation(wtap *wth)
+{
+ return wth->encapsulation;
+}
+
+
+int wtap_snapshot_length(wtap *wth)
+{
+ if (wth->file_type == WTAP_FILE_PCAP)
+ return pcap_snapshot(wth->pcap);
+ else
+ return 5000;
+}
+
+void wtap_close(wtap *wth)
+{
+ if (wth->file_type == WTAP_FILE_PCAP)
+ pcap_close(wth->pcap);
+ else
+ fclose(wth->fh);
+}
+
+void wtap_loop(wtap *wth, int count, wtap_handler callback, u_char* user)
+{
+ int i = 0;
+
+ if (wth->file_type == WTAP_FILE_PCAP) {
+ wtap_callback = callback;
+ pcap_loop(wth->pcap, count, pcap_callback_wrapper, user);
+ }
+ else {
+ while (ngsniffer_read(wth)) {
+ i++;
+ callback(user, &wth->phdr, buffer_start_ptr(&wth->frame_buffer));
+ }
+ }
+}
+
+static
+void pcap_callback_wrapper(u_char *user, const struct pcap_pkthdr *phdr,
+ const u_char *buf)
+{
+/* struct wtap_pkthdr whdr;
+ memcpy(&whdr, phdr, sizeof(struct wtap_pkthdr));*/
+ wtap_callback(user, (struct wtap_pkthdr*) phdr, buf);
+}
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
new file mode 100644
index 0000000000..65983722a3
--- /dev/null
+++ b/wiretap/wtap.h
@@ -0,0 +1,104 @@
+/*
+ * wtap.h
+ * ------
+ * Wiretap Library for Packet Capturing and Filtering
+ *
+ * Gilbert Ramirez
+ */
+
+/* Encapsulation types */
+#define WTAP_ENCAP_NONE 0
+#define WTAP_ENCAP_ETHERNET 1
+#define WTAP_ENCAP_TR 2
+#define WTAP_ENCAP_SLIP 3
+#define WTAP_ENCAP_PPP 4
+#define WTAP_ENCAP_FDDI 5
+#define WTAP_ENCAP_RAW_IP 6
+
+/* File types that can be read by wiretap */
+#define WTAP_FILE_UNKNOWN 0
+#define WTAP_FILE_WTAP 1
+#define WTAP_FILE_PCAP 2
+#define WTAP_FILE_LANALYZER 3
+#define WTAP_FILE_NGSNIFFER 4
+#define WTAP_FILE_SNOOP 6
+#define WTAP_FILE_IPTRACE 7
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <glib.h>
+#include <pcap.h>
+#include <buffer.h>
+
+struct wtap_pkthdr {
+ struct timeval ts;
+ guint32 caplen;
+ guint32 len;
+};
+
+typedef void (*wtap_handler)(u_char*, const struct wtap_pkthdr*,
+ const u_char *);
+
+typedef struct _wtap {
+ FILE* fh;
+ int file_type;
+ unsigned long frame_number;
+ unsigned long file_byte_offset;
+ Buffer frame_buffer;
+ struct wtap_pkthdr phdr;
+
+ pcap_t *pcap;
+ char err_str[PCAP_ERRBUF_SIZE];
+ int encapsulation;
+} wtap;
+
+
+wtap* wtap_open_offline(char *filename, int filetype);
+void wtap_loop(wtap *wth, int, wtap_handler, u_char*);
+
+FILE* wtap_file(wtap *wth);
+int wtap_snapshot_length(wtap *wth); /* per file */
+int wtap_file_type(wtap *wth);
+int wtap_encapsulation(wtap *wth); /* per file */
+void wtap_close(wtap *wth);
+
+/* Pointer versions of ntohs and ntohl. Given a pointer to a member of a
+ * byte array, returns the value of the two or four bytes at the pointer.
+ * The pletoh[sl] versions return the little-endian representation.
+ */
+
+#define pntohs(p) ((guint16) \
+ ((guint16)*((guint8 *)p+0)<<8| \
+ (guint16)*((guint8 *)p+1)<<0))
+
+#define pntohl(p) ((guint32)*((guint8 *)p+0)<<24| \
+ (guint32)*((guint8 *)p+1)<<16| \
+ (guint32)*((guint8 *)p+2)<<8| \
+ (guint32)*((guint8 *)p+3)<<0)
+
+#define pletohs(p) ((guint16) \
+ ((guint16)*((guint8 *)p+1)<<8| \
+ (guint16)*((guint8 *)p+0)<<0))
+
+#define pletohl(p) ((guint32)*((guint8 *)p+3)<<24| \
+ (guint32)*((guint8 *)p+2)<<16| \
+ (guint32)*((guint8 *)p+1)<<8| \
+ (guint32)*((guint8 *)p+0)<<0)
+
+
+
+#define DLT_NULL 0 /* no link-layer encapsulation */
+#define DLT_EN10MB 1 /* Ethernet (10Mb) */
+#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */
+#define DLT_AX25 3 /* Amateur Radio AX.25 */
+#define DLT_PRONET 4 /* Proteon ProNET Token Ring */
+#define DLT_CHAOS 5 /* Chaos */
+#define DLT_IEEE802 6 /* IEEE 802 Networks */
+#define DLT_ARCNET 7 /* ARCNET */
+#define DLT_SLIP 8 /* Serial Line IP */
+#define DLT_PPP 9 /* Point-to-point Protocol */
+#define DLT_FDDI 10 /* FDDI */
+#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */
+#define DLT_RAW 12 /* raw IP */
+#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */
+#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */