aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/toshiba.c
diff options
context:
space:
mode:
authorgram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>2000-09-07 05:34:23 +0000
committergram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>2000-09-07 05:34:23 +0000
commit1e5772081f03227dc1d592574bff66f20d91baf5 (patch)
tree31fc7f12926ced1a03d1ebd95053a6131039c09b /wiretap/toshiba.c
parentf26d1aec1fc976411cdefcc21b4aa24074f94fb2 (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). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2392 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'wiretap/toshiba.c')
-rw-r--r--wiretap/toshiba.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c
index caa0b6c249..407b52dab7 100644
--- a/wiretap/toshiba.c
+++ b/wiretap/toshiba.c
@@ -1,6 +1,6 @@
/* toshiba.c
*
- * $Id: toshiba.c,v 1.11 2000/05/19 23:07:03 gram Exp $
+ * $Id: toshiba.c,v 1.12 2000/09/07 05:34:20 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -104,7 +104,7 @@ static const char toshiba_hdr_magic[] =
static const char toshiba_rec_magic[] = { '[', 'N', 'o', '.' };
#define TOSHIBA_REC_MAGIC_SIZE (sizeof toshiba_rec_magic / sizeof toshiba_rec_magic[0])
-static int toshiba_read(wtap *wth, int *err);
+static gboolean toshiba_read(wtap *wth, int *err, int *data_offset);
static int toshiba_seek_read(wtap *wth, int seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
static gboolean parse_single_hex_dump_line(char* rec, guint8 *buf, int byte_offset);
@@ -200,7 +200,7 @@ int toshiba_open(wtap *wth, int *err)
}
/* Find the next packet and parse it; called from wtap_loop(). */
-static int toshiba_read(wtap *wth, int *err)
+static gboolean toshiba_read(wtap *wth, int *err, int *data_offset)
{
int offset = 0;
guint8 *buf;
@@ -209,7 +209,7 @@ static int toshiba_read(wtap *wth, int *err)
/* Find the next packet */
offset = toshiba_seek_next_packet(wth);
if (offset < 1) {
- return 0;
+ return FALSE;
}
/* Parse the header */
@@ -224,7 +224,8 @@ static int toshiba_read(wtap *wth, int *err)
parse_toshiba_hex_dump(wth->fh, pkt_len, buf, err);
wth->data_offset = offset;
- return offset;
+ *data_offset = offset;
+ return TRUE;
}
/* Used to read packets in random-access fashion */