diff options
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/iptrace.c | 3 | ||||
-rw-r--r-- | wiretap/lanalyzer.c | 3 | ||||
-rw-r--r-- | wiretap/libpcap.c | 3 | ||||
-rw-r--r-- | wiretap/ngsniffer.c | 3 | ||||
-rw-r--r-- | wiretap/snoop.c | 3 | ||||
-rw-r--r-- | wiretap/wtap.c | 29 | ||||
-rw-r--r-- | wiretap/wtap.h | 4 |
7 files changed, 32 insertions, 16 deletions
diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c index 315fa51d53..02445c3257 100644 --- a/wiretap/iptrace.c +++ b/wiretap/iptrace.c @@ -1,6 +1,6 @@ /* iptrace.c * - * $Id: iptrace.c,v 1.1 1999/01/03 04:30:13 gram Exp $ + * $Id: iptrace.c,v 1.2 1999/01/07 16:15:35 gram Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -41,7 +41,6 @@ int iptrace_open(wtap *wth) if (strcmp(name, "iptrace 2.0") != 0) { return WTAP_FILE_UNKNOWN; } - wth->encapsulation = WTAP_ENCAP_PER_PACKET; wth->subtype_read = iptrace_read; return WTAP_FILE_IPTRACE; diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c index 7399b43041..bb59762626 100644 --- a/wiretap/lanalyzer.c +++ b/wiretap/lanalyzer.c @@ -1,6 +1,6 @@ /* lanalyzer.c * - * $Id: lanalyzer.c,v 1.6 1998/12/13 05:38:13 gram Exp $ + * $Id: lanalyzer.c,v 1.7 1999/01/07 16:15:35 gram Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -214,6 +214,7 @@ int lanalyzer_read(wtap *wth) wth->phdr.len = true_size - 4; wth->phdr.caplen = packet_size; + wth->phdr.pkt_encap = wth->encapsulation; return data_offset; } diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index 4285319f02..bb9d0361c9 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -1,6 +1,6 @@ /* libpcap.c * - * $Id: libpcap.c,v 1.2 1998/12/17 06:39:10 gram Exp $ + * $Id: libpcap.c,v 1.3 1999/01/07 16:15:36 gram Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -207,6 +207,7 @@ int libpcap_read(wtap *wth) wth->phdr.ts.tv_usec = hdr.ts_usec; wth->phdr.caplen = packet_size; wth->phdr.len = hdr.orig_len; + wth->phdr.pkt_encap = wth->encapsulation; return data_offset; } diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index 082f2fedf4..6b74696d93 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -1,6 +1,6 @@ /* ngsniffer.c * - * $Id: ngsniffer.c,v 1.10 1998/12/17 06:39:12 gram Exp $ + * $Id: ngsniffer.c,v 1.11 1999/01/07 16:15:36 gram Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -746,5 +746,6 @@ found: wth->phdr.ts.tv_sec = (long)t; wth->phdr.ts.tv_usec = (unsigned long)((t-(double)(wth->phdr.ts.tv_sec)) *1.0e6); + wth->phdr.pkt_encap = wth->encapsulation; return data_offset; } diff --git a/wiretap/snoop.c b/wiretap/snoop.c index c43f9f5f38..1aedc9406f 100644 --- a/wiretap/snoop.c +++ b/wiretap/snoop.c @@ -1,6 +1,6 @@ /* snoop.c * - * $Id: snoop.c,v 1.1 1998/11/15 05:29:14 guy Exp $ + * $Id: snoop.c,v 1.2 1999/01/07 16:15:36 gram Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -145,6 +145,7 @@ int snoop_read(wtap *wth) wth->phdr.ts.tv_usec = ntohl(hdr.ts_usec); wth->phdr.caplen = packet_size; wth->phdr.len = ntohl(hdr.orig_len); + wth->phdr.pkt_encap = wth->encapsulation; /* Skip over the padding. */ fseek(wth->fh, ntohl(hdr.rec_len) - (sizeof hdr + packet_size), diff --git a/wiretap/wtap.c b/wiretap/wtap.c index f8e02cd8e8..1f5dac1334 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -1,6 +1,6 @@ /* wtap.c * - * $Id: wtap.c,v 1.3 1998/11/15 05:29:16 guy Exp $ + * $Id: wtap.c,v 1.4 1999/01/07 16:15:36 gram Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -33,11 +33,6 @@ int wtap_file_type(wtap *wth) return wth->file_type; } -int wtap_encapsulation(wtap *wth) -{ - return wth->encapsulation; -} - int wtap_snapshot_length(wtap *wth) { @@ -46,7 +41,27 @@ int wtap_snapshot_length(wtap *wth) void wtap_close(wtap *wth) { - /* XXX - free up memory? */ + /* free up memory. If any capture structure ever allocates + * its own memory, it would be better to make a *close() function + * for each filetype, like pcap_close(0, lanalyzer_close(), etc. + * But for now this will work. */ + switch(wth->file_type) { + case WTAP_FILE_PCAP: + free(wth->capture.pcap); + break; + + case WTAP_FILE_LANALYZER: + free(wth->capture.lanalyzer); + break; + + case WTAP_FILE_NGSNIFFER: + free(wth->capture.ngsniffer); + break; + + default: + /* nothing */ + } + fclose(wth->fh); } diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 18c701bab0..84bde9447f 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -1,6 +1,6 @@ /* wtap.h * - * $Id: wtap.h,v 1.9 1999/01/02 06:10:55 gram Exp $ + * $Id: wtap.h,v 1.10 1999/01/07 16:15:37 gram Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -32,7 +32,6 @@ #define WTAP_ENCAP_RAW_IP 6 #define WTAP_ENCAP_ARCNET 7 #define WTAP_ENCAP_ATM_RFC1483 8 -#define WTAP_ENCAP_PER_PACKET 9 /* File types that can be read by wiretap */ #define WTAP_FILE_UNKNOWN 0 @@ -109,7 +108,6 @@ 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); |