aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-04-15 21:12:37 +0000
committerGuy Harris <guy@alum.mit.edu>2000-04-15 21:12:37 +0000
commitd51f36236f28138f5780b27816ba43473b7a64fb (patch)
tree44cbba3b187f57522bc9e820adb55d4b5e316e6b /wiretap
parente97af6559072e29d14221ab35e545dd7c9b45b7a (diff)
Get rid of the "start" field in the private data for RADCOM, i4btrace,
and nettl captures - a "start" field is used for capture files where the time stamps on packets are relative to some initial time stamp, e.g. the time the capture started, but those file formats use absolute time stamps, so no "start" field is needed. Make the "this is an HP-UX 11.x nettl capture" flag a member of the private data structure for a nettl capture, rather than a global - it's per-capture-file state. Once the "start" field is removed from the RADCOM private data structure, there's nothing left, so eliminate the private data structure. svn path=/trunk/; revision=1863
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/i4btrace.c3
-rw-r--r--wiretap/nettl.c22
-rw-r--r--wiretap/radcom.c17
-rw-r--r--wiretap/wtap.h10
4 files changed, 12 insertions, 40 deletions
diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c
index 7ddd847f78..c03f7be871 100644
--- a/wiretap/i4btrace.c
+++ b/wiretap/i4btrace.c
@@ -1,6 +1,6 @@
/* i4btrace.c
*
- * $Id: i4btrace.c,v 1.3 2000/01/13 07:09:16 guy Exp $
+ * $Id: i4btrace.c,v 1.4 2000/04/15 21:12:37 guy Exp $
*
* Wiretap Library
* Copyright (c) 1999 by Bert Driehuis <driehuis@playbeing.org>
@@ -93,7 +93,6 @@ int i4btrace_open(wtap *wth, int *err)
wth->subtype_read = i4btrace_read;
wth->snapshot_length = 2048; /* actual length set per packet */
- wth->capture.i4btrace->start = hdr.time.tv_sec;
wth->capture.i4btrace->bchannel_prot[0] = -1;
wth->capture.i4btrace->bchannel_prot[1] = -1;
wth->capture.i4btrace->byte_swapped = byte_swapped;
diff --git a/wiretap/nettl.c b/wiretap/nettl.c
index 8e713ea83a..2748809e69 100644
--- a/wiretap/nettl.c
+++ b/wiretap/nettl.c
@@ -1,6 +1,6 @@
/* nettl.c
*
- * $Id: nettl.c,v 1.9 2000/03/22 07:06:56 guy Exp $
+ * $Id: nettl.c,v 1.10 2000/04/15 21:12:37 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -39,8 +39,6 @@ static char nettl_magic_hpux10[12] = {
0x54, 0x52, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80
};
-static gboolean is_hpux_11;
-
/* HP nettl record header for the SX25L2 subsystem - The FCS is not included in the file. */
struct nettlrec_sx25l2_hdr {
guint8 xxa[8];
@@ -99,10 +97,6 @@ int nettl_open(wtap *wth, int *err)
return -1;
return 0;
}
- if (os_vers[0] == '1' && os_vers[1] == '1')
- is_hpux_11 = TRUE;
- else
- is_hpux_11 = FALSE;
file_seek(wth->fh, 0x80, SEEK_SET);
wth->data_offset = 0x80;
@@ -110,12 +104,14 @@ int nettl_open(wtap *wth, int *err)
/* This is an nettl file */
wth->file_type = WTAP_FILE_NETTL;
wth->capture.nettl = g_malloc(sizeof(nettl_t));
+ if (os_vers[0] == '1' && os_vers[1] == '1')
+ wth->capture.nettl->is_hpux_11 = TRUE;
+ else
+ wth->capture.nettl->is_hpux_11 = FALSE;
wth->subtype_read = nettl_read;
wth->subtype_close = nettl_close;
wth->snapshot_length = 16384; /* not available in header, only in frame */
- wth->capture.nettl->start = 0;
-
return 1;
}
@@ -162,7 +158,7 @@ static int nettl_read(wtap *wth, int *err)
/* The packet header in HP-UX 11 nettl traces is 4 octets longer than
* HP-UX 9 and 10 */
- if (is_hpux_11) {
+ if (wth->capture.nettl->is_hpux_11) {
bytes_read = file_read(dummy, 1, 4, wth->fh);
if (bytes_read != 4) {
*err = file_error(wth->fh);
@@ -184,8 +180,6 @@ static int nettl_read(wtap *wth, int *err)
wth->phdr.ts.tv_sec = pntohl(&ip_hdr.sec);
wth->phdr.ts.tv_usec = pntohl(&ip_hdr.usec);
- if (wth->capture.nettl->start == 0)
- wth->capture.nettl->start = wth->phdr.ts.tv_sec;
/*
* Read the packet data.
@@ -219,7 +213,7 @@ static int nettl_read(wtap *wth, int *err)
}
wth->data_offset += sizeof lapb_hdr;
- if (is_hpux_11) {
+ if (wth->capture.nettl->is_hpux_11) {
bytes_read = file_read(dummy, 1, 4, wth->fh);
if (bytes_read != 4) {
*err = file_error(wth->fh);
@@ -241,8 +235,6 @@ static int nettl_read(wtap *wth, int *err)
wth->phdr.ts.tv_sec = pntohl(&lapb_hdr.sec);
wth->phdr.ts.tv_usec = pntohl(&lapb_hdr.usec);
- if (wth->capture.nettl->start == 0)
- wth->capture.nettl->start = wth->phdr.ts.tv_sec;
wth->phdr.pseudo_header.x25.flags = (lapb_hdr.from_dce & 0x20 ? 0x80 : 0x00);
/*
diff --git a/wiretap/radcom.c b/wiretap/radcom.c
index 69dc70a7d4..ac378a2a83 100644
--- a/wiretap/radcom.c
+++ b/wiretap/radcom.c
@@ -1,6 +1,6 @@
/* radcom.c
*
- * $Id: radcom.c,v 1.19 2000/03/22 07:06:56 guy Exp $
+ * $Id: radcom.c,v 1.20 2000/04/15 21:12:37 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -68,7 +68,6 @@ struct radcomrec_hdr {
};
static int radcom_read(wtap *wth, int *err);
-static void radcom_close(wtap *wth);
int radcom_open(wtap *wth, int *err)
{
@@ -134,9 +133,7 @@ int radcom_open(wtap *wth, int *err)
/* This is a radcom file */
wth->file_type = WTAP_FILE_RADCOM;
- wth->capture.radcom = g_malloc(sizeof(radcom_t));
wth->subtype_read = radcom_read;
- wth->subtype_close = radcom_close;
wth->snapshot_length = 16384; /* not available in header, only in frame */
tm.tm_year = pletohs(&start_date.year)-1900;
@@ -147,7 +144,6 @@ int radcom_open(wtap *wth, int *err)
tm.tm_min = (sec%3600)/60;
tm.tm_sec = sec%60;
tm.tm_isdst = -1;
- wth->capture.radcom->start = mktime(&tm);
file_seek(wth->fh, sizeof(struct frame_date), SEEK_CUR);
wth->data_offset += sizeof(struct frame_date);
@@ -214,11 +210,8 @@ int radcom_open(wtap *wth, int *err)
read_error:
*err = file_error(wth->fh);
- if (*err != 0) {
- g_free(wth->capture.radcom);
+ if (*err != 0)
return -1;
- }
- g_free(wth->capture.radcom);
return 0;
}
@@ -303,9 +296,3 @@ static int radcom_read(wtap *wth, int *err)
return data_offset;
}
-
-static void
-radcom_close(wtap *wth)
-{
- g_free(wth->capture.radcom);
-}
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 28b6f5d9ac..33b05011e0 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -1,6 +1,6 @@
/* wtap.h
*
- * $Id: wtap.h,v 1.66 2000/04/08 01:16:52 guy Exp $
+ * $Id: wtap.h,v 1.67 2000/04/15 21:12:36 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -156,17 +156,12 @@ typedef struct {
} ngsniffer_t;
typedef struct {
- time_t start;
-} radcom_t;
-
-typedef struct {
gboolean byte_swapped;
- time_t start;
int bchannel_prot[2]; /* For the V.120 heuristic */
} i4btrace_t;
typedef struct {
- time_t start;
+ gboolean is_hpux_11;
} nettl_t;
typedef struct {
@@ -333,7 +328,6 @@ typedef struct wtap {
libpcap_t *pcap;
lanalyzer_t *lanalyzer;
ngsniffer_t *ngsniffer;
- radcom_t *radcom;
i4btrace_t *i4btrace;
nettl_t *nettl;
netmon_t *netmon;