Get rid of the "start" field in the private data for RADCOM, i4btrace,
authorGuy Harris <guy@alum.mit.edu>
Sat, 15 Apr 2000 21:12:37 +0000 (21:12 -0000)
committerGuy Harris <guy@alum.mit.edu>
Sat, 15 Apr 2000 21:12:37 +0000 (21:12 -0000)
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

wiretap/i4btrace.c
wiretap/nettl.c
wiretap/radcom.c
wiretap/wtap.h

index 7ddd847f78b9e850c04488a8eb5c516223c73191..c03f7be8716b64d154dfec7a11712ab5ae2682d0 100644 (file)
@@ -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;
index 8e713ea83a30dc2d812fa4af3add1e8179adf39f..2748809e69ca362a70495460b00596a710355e7f 100644 (file)
@@ -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);
 
        /*
index 69dc70a7d4ee511bf2c925b12d9650892d9abda4..ac378a2a831e6dd4a05c5c3f795cdd6b6b6cd36a 100644 (file)
@@ -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);
-}
index 28b6f5d9acfb466bf45c54856b73e7ead1104086..33b05011e07106ba957da4ecae85c433d3be8a44 100644 (file)
@@ -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>
@@ -155,18 +155,13 @@ typedef struct {
        int     is_atm;
 } 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;