aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/nettl.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2000-09-07 05:34:23 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2000-09-07 05:34:23 +0000
commitf52ffba40709c1d134671eef22086827cdeda0f3 (patch)
tree31fc7f12926ced1a03d1ebd95053a6131039c09b /wiretap/nettl.c
parente1f3604b376f38c081ff142d54d91aa3f68bd0f8 (diff)
Change wtap_read() API so that the data offset is set via a pointer, and
a "keep reading" boolean value is returned from the function. This avoids having to hack around the fact that some file formats truly do have records that start at offset 0. (i4btrace and csids have no file header. Neither does the pppdump-style file that I'm looking at right now). svn path=/trunk/; revision=2392
Diffstat (limited to 'wiretap/nettl.c')
-rw-r--r--wiretap/nettl.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/wiretap/nettl.c b/wiretap/nettl.c
index 3bd86d378e..314ab95a96 100644
--- a/wiretap/nettl.c
+++ b/wiretap/nettl.c
@@ -1,6 +1,6 @@
/* nettl.c
*
- * $Id: nettl.c,v 1.15 2000/08/25 21:25:40 gram Exp $
+ * $Id: nettl.c,v 1.16 2000/09/07 05:34:13 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -63,7 +63,7 @@ struct nettlrec_ns_ls_ip_hdr {
/* header is followed by data and once again the total length (2 bytes) ! */
-static int nettl_read(wtap *wth, int *err);
+static gboolean nettl_read(wtap *wth, int *err, int *data_offset);
static int nettl_seek_read(wtap *wth, int seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int length);
static int nettl_read_rec_header(wtap *wth, FILE_T fh,
@@ -122,18 +122,17 @@ int nettl_open(wtap *wth, int *err)
}
/* Read the next packet */
-static int nettl_read(wtap *wth, int *err)
+static gboolean nettl_read(wtap *wth, int *err, int *data_offset)
{
- int record_offset;
int ret;
/* Read record header. */
- record_offset = wth->data_offset;
+ *data_offset = wth->data_offset;
ret = nettl_read_rec_header(wth, wth->fh, &wth->phdr, &wth->pseudo_header,
err);
if (ret <= 0) {
/* Read error or EOF */
- return ret;
+ return FALSE;
}
wth->data_offset += ret;
@@ -143,9 +142,9 @@ static int nettl_read(wtap *wth, int *err)
buffer_assure_space(wth->frame_buffer, wth->phdr.caplen);
if (nettl_read_rec_data(wth->fh, buffer_start_ptr(wth->frame_buffer),
wth->phdr.caplen, err) < 0)
- return -1; /* Read error */
+ return FALSE; /* Read error */
wth->data_offset += wth->phdr.caplen;
- return record_offset;
+ return TRUE;
}
static int