diff options
author | Guy Harris <guy@alum.mit.edu> | 1999-01-17 09:33:15 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 1999-01-17 09:33:15 +0000 |
commit | 5910deaa460df74e66d8b4b4aa5f3293c31cd472 (patch) | |
tree | 2b334f7a4f0a6508e758291d9357487a274a8de2 | |
parent | ea75a2a99ec61f9a7193f858f99935a78229ad47 (diff) | |
download | wireshark-5910deaa460df74e66d8b4b4aa5f3293c31cd472.tar.gz |
Add suppport for Microsoft Network Monitor Ethernet capture files.
svn path=/trunk/; revision=171
-rw-r--r-- | wiretap/Makefile.am | 2 | ||||
-rw-r--r-- | wiretap/Makefile.in | 8 | ||||
-rw-r--r-- | wiretap/aclocal.m4 | 5 | ||||
-rwxr-xr-x | wiretap/configure | 43 | ||||
-rw-r--r-- | wiretap/file.c | 12 | ||||
-rw-r--r-- | wiretap/wtap.h | 10 |
6 files changed, 54 insertions, 26 deletions
diff --git a/wiretap/Makefile.am b/wiretap/Makefile.am index af49decf99..f1cdeb1e2c 100644 --- a/wiretap/Makefile.am +++ b/wiretap/Makefile.am @@ -16,6 +16,8 @@ libwiretap_a_SOURCES = \ lanalyzer.h \ libpcap.c \ libpcap.h \ + netmon.c \ + netmon.h \ ngsniffer.c \ ngsniffer.h \ snoop.c \ diff --git a/wiretap/Makefile.in b/wiretap/Makefile.in index 6a435cac2a..98172ea63e 100644 --- a/wiretap/Makefile.in +++ b/wiretap/Makefile.in @@ -85,6 +85,8 @@ libwiretap_a_SOURCES = \ lanalyzer.h \ libpcap.c \ libpcap.h \ + netmon.c \ + netmon.h \ ngsniffer.c \ ngsniffer.h \ snoop.c \ @@ -104,7 +106,7 @@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ libwiretap_a_LIBADD = libwiretap_a_OBJECTS = buffer.o file.o iptrace.o lanalyzer.o libpcap.o \ -ngsniffer.o snoop.o wtap.o +netmon.o ngsniffer.o snoop.o wtap.o AR = ar CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @@ -119,8 +121,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP = --best DEP_FILES = .deps/buffer.P .deps/file.P .deps/iptrace.P \ -.deps/lanalyzer.P .deps/libpcap.P .deps/ngsniffer.P .deps/snoop.P \ -.deps/wtap.P +.deps/lanalyzer.P .deps/libpcap.P .deps/netmon.P .deps/ngsniffer.P \ +.deps/snoop.P .deps/wtap.P SOURCES = $(libwiretap_a_SOURCES) OBJECTS = $(libwiretap_a_OBJECTS) diff --git a/wiretap/aclocal.m4 b/wiretap/aclocal.m4 index c425057428..c009d8039e 100644 --- a/wiretap/aclocal.m4 +++ b/wiretap/aclocal.m4 @@ -197,10 +197,13 @@ int main () { int major, minor, micro; + char *tmp_version; system ("touch conf.gtktest"); - if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtk_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } diff --git a/wiretap/configure b/wiretap/configure index 59e4611db1..8b2c0eca1a 100755 --- a/wiretap/configure +++ b/wiretap/configure @@ -1098,10 +1098,13 @@ int main () { int major, minor, micro; + char *tmp_version; system ("touch conf.gtktest"); - if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtk_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } @@ -1151,7 +1154,7 @@ main () } EOF -if { (eval echo configure:1155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1185,7 +1188,7 @@ fi CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat > conftest.$ac_ext <<EOF -#line 1189 "configure" +#line 1192 "configure" #include "confdefs.h" #include <gtk/gtk.h> @@ -1195,7 +1198,7 @@ int main() { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } EOF -if { (eval echo configure:1199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1202: \"$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" @@ -1236,7 +1239,7 @@ rm -f conftest* # Wiretap check (copied and modified from ethereal) echo $ac_n "checking whether to include wiretap library""... $ac_c" 1>&6 -echo "configure:1240: checking whether to include wiretap library" >&5 +echo "configure:1243: 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" @@ -1258,7 +1261,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1262: checking how to run the C preprocessor" >&5 +echo "configure:1265: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1273,13 +1276,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 1277 "configure" +#line 1280 "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:1283: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1286: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1290,13 +1293,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1294 "configure" +#line 1297 "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:1300: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1303: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1319,12 +1322,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1323: checking for ANSI C header files" >&5 +echo "configure:1326: 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 1328 "configure" +#line 1331 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1332,7 +1335,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1336: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1339: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1349,7 +1352,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 1353 "configure" +#line 1356 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1367,7 +1370,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 1371 "configure" +#line 1374 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1388,7 +1391,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1392 "configure" +#line 1395 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1399,7 +1402,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1426,17 +1429,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1430: checking for $ac_hdr" >&5 +echo "configure:1433: 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 1435 "configure" +#line 1438 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1440: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1443: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* diff --git a/wiretap/file.c b/wiretap/file.c index 9ff7538b24..28f1adf076 100644 --- a/wiretap/file.c +++ b/wiretap/file.c @@ -1,6 +1,6 @@ /* file.c * - * $Id: file.c,v 1.5 1999/01/02 06:10:55 gram Exp $ + * $Id: file.c,v 1.6 1999/01/17 09:33:15 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -30,6 +30,7 @@ #include "libpcap.h" #include "snoop.h" #include "iptrace.h" +#include "netmon.h" /* The open_file_* routines should return the WTAP_FILE_* type * that they are checking for if the file is successfully recognized @@ -70,6 +71,10 @@ wtap* wtap_open_offline(char *filename, int filetype) if ((wth->file_type = iptrace_open(wth)) != WTAP_FILE_UNKNOWN) { goto success; } + /* WTAP_FILE_NETMON */ + if ((wth->file_type = netmon_open(wth)) != WTAP_FILE_UNKNOWN) { + goto success; + } printf("failed\n"); /* WTAP_FILE_UNKNOWN */ @@ -103,6 +108,11 @@ wtap* wtap_open_offline(char *filename, int filetype) goto success; } break; + case WTAP_FILE_NETMON: + if ((wth->file_type = netmon_open(wth)) != WTAP_FILE_UNKNOWN) { + goto success; + } + break; default: goto failure; } diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 84bde9447f..45afc04ac9 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -1,6 +1,6 @@ /* wtap.h * - * $Id: wtap.h,v 1.10 1999/01/07 16:15:37 gram Exp $ + * $Id: wtap.h,v 1.11 1999/01/17 09:33:15 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -41,6 +41,7 @@ #define WTAP_FILE_NGSNIFFER 4 #define WTAP_FILE_SNOOP 6 #define WTAP_FILE_IPTRACE 7 +#define WTAP_FILE_NETMON 8 #include <sys/types.h> #include <sys/time.h> @@ -70,6 +71,12 @@ typedef struct { guint16 version_minor; } libpcap_t; +typedef struct { + time_t start_secs; + guint32 start_msecs; + int end_offset; +} netmon_t; + struct wtap_pkthdr { struct timeval ts; guint32 caplen; @@ -95,6 +102,7 @@ typedef struct wtap { libpcap_t *pcap; lanalyzer_t *lanalyzer; ngsniffer_t *ngsniffer; + netmon_t *netmon; } capture; subtype_func subtype_read; |